Jan Bouwhuis
afa4e76248
Optimize mqtt device cleanup ( #111170 )
...
Thnx
2024-02-23 07:29:50 +01:00
Jan Bouwhuis
09f1ec78a5
Handle template errors on MQTT payload handling ( #110180 )
...
* Handle template errors on MQTT payload handling (alt)
* Handle mqtt event en image template errors correctly
2024-02-13 10:59:55 +01:00
Marc Mueller
bf8bd5ff21
Use dict.get instead of inline if ( #109693 )
2024-02-05 13:56:10 +01:00
Jan Bouwhuis
26058bf922
Add serial_number attribute to MQTT device properties ( #108105 )
2024-01-16 14:02:34 +01:00
Jan Bouwhuis
f0ec1235b1
Remove naming warnings and work-a-rounds for incorrectly configured MQTT entities ( #107188 )
...
* Remove naming warnings for MQTT entities
* Remove unused const
2024-01-05 09:32:22 +01:00
Jan Bouwhuis
c7b6c9da31
Remove work-a-round for mqtt sensors with an entity_category set to config
( #107199 )
...
* Remove work-a-round for mqtt sensors with an entity_category set to `config`
* Cleanup strings
2024-01-05 09:24:52 +01:00
Ville Skyttä
24b1e01d71
Update Ruff to 0.1.8, avoid linter/formatter conflicts ( #106080 )
...
* Disable Ruff rules that may conflict with the formatter
* Upgrade Ruff to 0.1.8
- https://github.com/astral-sh/ruff/releases/tag/v0.1.7
- https://github.com/astral-sh/ruff/releases/tag/v0.1.8
* Format with Ruff 0.1.8
2023-12-20 23:55:09 +01:00
Erik Montnemery
9020dbb093
Remove context_recent_time property from entity base class ( #105652 )
2023-12-14 08:33:31 +01:00
Jan Bouwhuis
8a1f7b6802
Add translation key for some mqtt exceptions ( #104550 )
2023-11-26 17:33:54 +01:00
Jan Bouwhuis
cbccdbc6fa
Fix entity category for sensor fails mqtt sensor platform setup ( #103449 )
2023-11-08 00:03:47 +01:00
Jan Bouwhuis
4a4d2ad743
Fix mqtt config validation error handling ( #103210 )
...
* Fix MQTT config check
* Fix handling invalid enity_category for sensors
* Improve docstr
* Update comment
* Use correct util for yaml dump
2023-11-02 10:57:00 +01:00
Jan Bouwhuis
973b8900a9
Optimize mqtt platform setup ( #102449 )
...
* Optimize mqtt platform setup and correct issue
* Avoid coroutine for setup entity from discovery
* Avoid extra check
* Revert string constants
* Add comment
2023-10-22 08:31:08 +02:00
Jan Bouwhuis
25ab622b51
Rename mqtt entry setup helpers to reflect their purpose ( #102378 )
...
Rename mqtt entry setup helpers
2023-10-20 13:36:24 +02:00
Jan Bouwhuis
7d9014ae41
Do not fail MQTT setup if events or sensors configured via yaml can't be validated ( #102309 )
...
* Add event and sensor
* Cleanup unused code
* Schema cannot be None for supported platform
2023-10-20 12:09:52 +02:00
Jan Bouwhuis
d149bffb07
Do not fail MQTT setup if lights configured via yaml can't be validated ( #101649 )
...
* Add light
* Deduplicate code
* Follow up comment
2023-10-19 17:34:43 +02:00
Jan Bouwhuis
c377cf1ce0
Do not fail mqtt entry on single platform config schema error ( #101373 )
...
* Do not fail mqtt entry on platform config
* Raise on reload with invalid config
* Do not store issues
* Follow up
2023-10-19 12:06:33 +02:00
Jan Bouwhuis
aed3ba3acd
Avoid redundant calls to async_ha_write_state
in MQTT (binary) sensor ( #100438 )
...
* Only call `async_ha_write_state` on changes.
* Make helper class
* Use UndefinedType
* Remove del
* Integrate monitor into MqttEntity
* Track extra state attributes and availability
* Add `__slots__`
* Add monitor to MqttAttributes and MqttAvailability
* Write out loop
* Add test
* Make common test and parameterize
* Add test for last_reset attribute
* MqttMonitorEntity base class
* Rename attr and update docstr `track` method.
* correction doct
* Implement as a decorator
* Move tracking functions into decorator
* Rename decorator
* Follow up comment
2023-09-21 13:33:26 +02:00
Jan Bouwhuis
6b265120b3
Fix entity name attribute on mqtt entity is not removed on update ( #100187 )
...
Fix entity name attribute is not remove on update
2023-09-12 15:22:37 +02:00
Jan Bouwhuis
20d0ebe3fa
Add TYPE_CHECKING condition on type assertions for mqtt ( #100107 )
...
Add TYPE_CHECKING condition on type assertions
2023-09-11 10:58:33 +02:00
Jan Bouwhuis
8b232047c4
Add origin info support for MQTT discovered items ( #98782 )
...
* Add integration info support for MQTT discovery.
* Moving logs to discovery
* Revert adding class property
* Rename to origin
* Follow up comments
2023-08-24 09:50:39 +02:00
Franck Nijhof
c39fc0766e
Remove repair issue for MQTT discovered items ( #98768 )
2023-08-21 20:03:19 +02:00
Erik Montnemery
045c327928
Move DeviceInfo from entity to device registry ( #98149 )
...
* Move DeviceInfo from entity to device registry
* Update integrations
2023-08-10 22:04:26 -04:00
Jan Bouwhuis
9c6c391eea
Offer work- a-round for MQTT entity names that start with the device name ( #97495 )
...
Co-authored-by: SukramJ <sukramj@icloud.com>
Co-authored-by: Franck Nijhof <git@frenck.dev>
2023-08-01 10:03:08 +02:00
Jan Bouwhuis
3fcfe7d0c6
Set mqtt entity name to null
when it is a duplicate of the device name ( #97304 )
2023-07-27 09:23:23 +02:00
Marc Mueller
c0da6b822e
Fix ruff ( #97131 )
2023-07-24 10:34:16 +02:00
Marc Mueller
3371c41bda
Improve async_track_device_registry_updated_event
callback typing ( #97125 )
2023-07-24 09:42:01 +02:00
Marc Mueller
0624345322
Improve async_track_entity_registry_updated_event
callback typing ( #97124 )
2023-07-24 09:14:10 +02:00
Jan Bouwhuis
9424d11408
Allow homeassistant in MQTT configuration_url schema ( #96107 )
2023-07-22 22:50:58 +02:00
Jan Bouwhuis
447fbf58c9
Change naming of MQTT entities to correspond with HA guidelines ( #95159 )
...
* Set has_entity_name if device_name is set
* revert unneeded formatting change
* Add image platform
* Follow up comment
* Don't set `has_entity_name` without device name
* Only set has_entity_name if a valid name is set
* Follow device_class name and add tests
* Follow up comments add extra tests
* Move to helper - Log a warning
* fix test
* Allow to assign None as name explictly
* Refactor
* Log info messages when device name is not set
* Revert scene schema change - no device link
* Always set has_entity_name with device mapping
* Always set `_attr_has_entity_name`
* Cleanup
2023-07-21 12:52:10 +02:00
Jan Bouwhuis
b504665b56
Do not override extra_state_attributes property for MqttEntity ( #96890 )
2023-07-21 06:35:58 +02:00
Jan Bouwhuis
7c22225cd1
Allow ADR 0007 compliant schema for mqtt ( #94305 )
...
* Enforce listed entities in MQTT yaml config
* Add tests for setup with listed items
* Fix test
* Remove validator add comment
* Update homeassistant/components/mqtt/__init__.py
Co-authored-by: Erik Montnemery <erik@montnemery.com>
---------
Co-authored-by: Erik Montnemery <erik@montnemery.com>
2023-07-18 14:29:45 +02:00
Jan Bouwhuis
0134ee9305
Fix incorrect leagacy code tweak for MQTT ( #96812 )
...
Cleanup mqtt_data_updated_config
2023-07-18 10:50:34 +02:00
Jan Bouwhuis
82b9a31ea7
Improve logging of mqtt discovery message errors ( #94491 )
...
* Improve logging on mqtt discovery message errors
* Create shared helper
* Apply suggestion
* Catch base class vol.Invalid
2023-06-12 21:28:28 +02:00
Jan Bouwhuis
661aedde90
Remove MQTT platform schema warnings ( #93785 )
2023-05-31 09:02:48 +02:00
J. Nick Koston
3db59908ca
Switch mqtt to use async_track_device_registry_updated_event ( #93603 )
2023-05-29 09:43:01 -05:00
Jan Bouwhuis
88f0e4000b
Cleanup unreachable code where device_entry will never be None on an update event ( #91855 )
2023-04-24 16:09:36 +02:00
J. Nick Koston
66b105fb21
Reduce creation of MQTT related discovery tasks ( #90801 )
...
* Reduce creation of MQTT related discovery tasks
Most of the branching can avoid creating a task as it
did not need to await for the majority of cases. We
fallback to creating a task for the cases were we do
need to await.
* comment
* revert
2023-04-08 23:14:22 -04:00
Jan Bouwhuis
4a0d3e881a
Rework MQTT config merging and adding defaults ( #90529 )
...
* Cleanup config merging and adding defaults
* Optimize and update tests
* Do not mix entry and yaml config
* Make sure hass.data is initilized
* remove check on get_mqtt_data
* Tweaks to MQTT client
* Remove None assigment mqtt client and fix mock
2023-04-04 18:12:18 +02:00
Jan Bouwhuis
14ffda9758
Remove dependency on async_setup from mqtt integration ( #87987 )
...
* Remove async_setup from mqtt integration
* Final update common tests
* Related tests init
* Related tests diagnostics
* Related tests config_flow
* Cleanup and correct test
* Keep websockets_api commands in async_setup
2023-03-28 09:37:07 +02:00
epenet
ba23816a0c
Inverse json import logic ( #88099 )
...
* Fix helpers and util
* Adjust components
* Move back errors
* Add report
* mypy
* mypy
* Assert deprecation messages
* Move test_json_loads_object
* Adjust tests
* Fix rebase
* Adjust pylint plugin
* Fix plugin
* Adjust references
* Adjust backup tests
2023-02-16 11:37:57 +01:00
Jan Bouwhuis
33ede351f0
Cleanup code for parsing yaml MQTT config ( #86944 )
...
* Cleanup code for parsing yaml configs
* Add abstractmethod decorator to async_update
* Replace get() with default-list ensured by schema
2023-01-31 08:24:33 +01:00
Jan Bouwhuis
e57dad79fc
Fix MQTT discovery failing after bad config update ( #86935 )
...
* Fix MQTT discovery failing after bad config update
* Update last discovery payload after update success
* Improve test, correct update assignment
* send_discovery_done to finally-catch vol.Error
* Just use try..finally
* Remove extra line
* use elif to avoid log confusion
2023-01-30 19:15:11 +01:00
Shay Levy
6938f791f9
Downgrade MQTT logging ( #85867 )
2023-01-14 13:28:41 +01:00
Franck Nijhof
800b8abe39
Code styling tweaks to the MQTT integration ( #85463 )
2023-01-08 22:07:10 +01:00
Franck Nijhof
baef267f33
String formatting and max line length - Part 3 ( #84394 )
2022-12-22 13:35:47 +01:00
Jan Bouwhuis
b4984ea255
Use native _attr_
properties for MqttEntity ( #83639 )
2022-12-09 13:37:26 +01:00
Erik Montnemery
c4afc33fc5
Add abc.ABC to classes with abstract methods ( #83546 )
2022-12-08 17:50:36 +01:00
Jan Bouwhuis
8a8732f0bc
Strict type hints for MQTT integration ( #82317 )
...
* Strict type hints for MQTT integration
* Fix errors
* Additional corrections
* Use cv.template to avoid untyped calls
* Enable strict typing policy for MQTT integration
* Use ignore[no-untyped-call]
* Use # type: ignore[unreachable]
* Correct cast
* Refactor getting discovery_payload
* Remove unused type ignore comments
2022-11-24 08:25:44 +01:00
Jan Bouwhuis
7c2e7863d2
Remove legacy YAML support from MQTT ( #82102 )
2022-11-17 22:55:31 +01:00
Jan Bouwhuis
6975186f2f
Improve MQTT type hints / refactor part 10 - vacuum ( #81253 )
...
* Improve type hints vacuum __init__ and schema
* Improve type hints and refactor templates legacy
* Improve type hints state vacuum
* Add hint for template parameters
* Apply suggestions from code review
Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>
* Some corrections
* Remove stale constant
* Use bitwise and
* Follow-up comment
* Remove incorrect type hint
* Remove asserts
* Cleanup asserts and reduce code
Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>
2022-11-15 12:48:02 +01:00