Jan Bouwhuis
c44a7fe358
Do not trigger reload when unloading or reloading MQTT entry ( #93588 )
...
* Do not trigger reload when unloading MQTT entry
* More cleanup
* cleanup async_reload_manual_mqtt_items
* Add test
* Improve test
* Remove unuse mocks from test
* Add discovery item in test
2023-05-29 15:44:09 +02: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
5ee383456f
Catch exceptions and add logging when writing states on MQTT entities ( #89091 )
...
* Catch exceptions when writing states
* Do not use wrapper for logging and adjust tests
* Catch logging directly on async_write_ha_state()
* Update homeassistant/components/mqtt/models.py
Co-authored-by: Erik Montnemery <erik@montnemery.com>
* Fix test
---------
Co-authored-by: Erik Montnemery <erik@montnemery.com>
2023-03-06 15:34:47 +01:00
Marc Mueller
8abce25948
Update Union typing (4) [Py310] ( #86427 )
2023-01-23 09:04:40 +01:00
Franck Nijhof
baef267f33
String formatting and max line length - Part 3 ( #84394 )
2022-12-22 13:35:47 +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
23bc39b7f4
Add type hints on Template().__init__()
( #82574 )
2022-11-23 20:26:55 +01:00
epenet
9b2a8901b1
Adjust payload sentinel in mqtt ( #81553 )
...
* Adjust payload sentinel in mqtt
* Add type hints
* Update sensor.py
* Adjust vacuum
* Add type hints
* Adjust schema basic
* Remove invalid hint
2022-11-07 12:31:11 +01:00
Jan Bouwhuis
2f11385627
Add typing hints for MQTT mixins ( #80702 )
...
* Add typing hints for MQTT mixins
* Follow up comments
* config_entry is always set
* typing discovery_data - substate None assignment
* Rename `config[CONF_DEVICE]` -> specifications
2022-10-24 15:00:37 +02:00
Jan Bouwhuis
8aa30cce26
Fix state saving when sharing topics for MQTT entities ( #79421 )
...
* Do not write old state sharing availability topic
* Add a test
* Support for all availability topics
* delay async_write_ha_state till last callback
* Process write req after processing callback jobs
* Do not count subscription callbacks
* Simplify
* Stale docsting
* No topic needed for delays state write
* No need to clear when reloading
* Move test to test_mixins.py
* Only set up sensor platform for test
2022-10-11 10:49:54 +02:00
Jan Bouwhuis
84b2c74746
Move MQTT discovery hass.data globals to dataclass ( #78706 )
...
* Add MQTT discovery hass.data globals to dataclass
* isort
* Additional rework
* Add hass.data["mqtt_tags"] to dataclass
* Follow-up comment
* Corrections
2022-09-28 14:13:44 +02:00
Jan Bouwhuis
7216d4c636
Add debug logging for MQTT templates ( #79016 )
2022-09-27 00:36:10 +02:00
Jan Bouwhuis
81514b0d1c
Move MQTT debug_info to dataclass ( #78788 )
...
* Add MQTT debug_info to dataclass
* Remove total attr, assign factory
* Rename typed dict to MqttDebugInfo and use helper
* Split entity and trigger debug info
* Refactor
* More rework
2022-09-23 20:55:29 +02:00
epenet
e58531f118
Add MqttData helper to mqtt ( #78825 )
...
* Add MqttData helper to mqtt
* Adjust client for circular dependencies
* Move MqttData to models.py
* Move get_mqtt_data to util.py
2022-09-20 19:40:06 +02:00
Jan Bouwhuis
be2366d773
Add this
object to MQTT templates ( #77142 )
...
* Add `this` object to MQTT templates
* Only set once, remove hass guard
* Set once if there is a state
* Add tests TemplateStateFromEntityId calls once
2022-08-23 08:43:07 +02:00
Marc Mueller
2b617e3885
Improve mqtt MessageCallback typing ( #75614 )
...
* Improve mqtt MessageCallback typing
* Use MQTTMessage
2022-07-26 03:04:19 +02:00
J. Nick Koston
666f715e76
Avoid importing MQTT into core for ServiceInfo dataclass ( #74418 )
...
* Avoid importing MQTT into core for discovery dataclass
Likely fixes #73863
* relo
* adjust
* rename
* rename
* rename
* adjust missed imports
* drop compat
* fix conflict correctly
* Update homeassistant/helpers/config_entry_flow.py
* fix black from trying to fix the conflict in github
2022-07-14 11:09:09 -05:00
Erik Montnemery
635d7085cf
Move MQTT config schemas and client to separate modules ( #71995 )
...
* Move MQTT config schemas and client to separate modules
* Update integrations depending on MQTT
2022-05-31 09:32:44 +02:00
Jan Bouwhuis
3b2aae5045
Refactor MQTT discovery ( #67966 )
...
* Proof of concept
* remove notify platform
* remove loose test
* Add rework from #67912 (#1 )
* Move notify serviceupdater to Mixins
* Move tag discovery handler to Mixins
* fix tests
* Add typing for async_load_platform_helper
* Add add entry unload support for notify platform
* Simplify discovery updates
* Remove not needed extra logic
* Cleanup inrelevant or duplicate code
* reuse update_device and move to mixins
* Remove notify platform
* revert changes to notify platform
* Rename update class
* unify tag entry setup
* Use shared code for device_trigger `update_device`
* PoC shared dispatcher for device_trigger
* Fix bugs
* Improve typing - remove async_update
* Unload config_entry and tests
* Release dispatcher after setup and deduplicate
* closures to methods, revert `in` to `=`, updates
* Re-add update support for tag platform
* Re-add update support for device-trigger platform
* Cleanup rediscovery code revert related changes
* Undo discovery code shift
* Update homeassistant/components/mqtt/mixins.py
Co-authored-by: Erik Montnemery <erik@montnemery.com>
* Update homeassistant/components/mqtt/device_trigger.py
Co-authored-by: Erik Montnemery <erik@montnemery.com>
* Update homeassistant/components/mqtt/mixins.py
Co-authored-by: Erik Montnemery <erik@montnemery.com>
* revert doc string changes
* move conditions
* typing and check config_entry_id
* Update homeassistant/components/mqtt/mixins.py
Co-authored-by: Erik Montnemery <erik@montnemery.com>
* cleanup not used attribute
* Remove entry_unload code and tests
* update comment
* add second comment
Co-authored-by: Erik Montnemery <erik@montnemery.com>
2022-04-15 12:35:08 +02:00
Marc Mueller
67c35652f0
Update typing - collections.abc (2) ( #63934 )
2022-01-12 09:04:37 +01:00
Erik Montnemery
4d32e1ed01
Minor improvements of MQTT typing ( #52578 )
...
* Minor improvements of MQTT typing
* Tweak
2021-07-06 14:38:48 +02:00
Erik Montnemery
79ee112490
Enable basic type checking for mqtt ( #52463 )
...
* Enable basic type checking for mqtt
* Tweak
2021-07-05 10:33:12 +02:00
Marc Mueller
25a13d1554
Update typing 10 ( #48071 )
2021-03-18 13:07:04 +01:00
Ville Skyttä
ac0dbb17af
Attrs cleanups ( #37849 )
2020-07-14 10:30:30 -07:00
Erik Montnemery
877eb0c3ad
Don't log same MQTT message multiple times ( #34511 )
2020-04-21 16:48:04 -07:00
Erik Montnemery
f3b6575272
Fix MQTT debug info for subscriptions with wildcard. ( #33744 )
2020-04-06 10:25:09 -07:00
Bas Nijholt
ce5072fc91
use isort to sort imports according to PEP8 for mqtt ( #29649 )
2019-12-08 22:45:26 +05:30
Ville Skyttä
99c7608fb4
Lint config cleanups ( #28864 )
...
* Remove bunch of unneeded lint exclusions
* Use symbolic names instead of identifiers in pylint disables
* Tighten scope of some pylint disables
2019-11-25 22:40:08 -08:00
Malte Franken
1a5b4c105a
Move imports in mqtt component ( #27835 )
...
* move imports to top-level in mqtt server
* move imports to top-level in mqtt configflow
* move imports to top-level in mqtt init
* move imports to top-level in mqtt vacuum
* move imports to top-level in mqtt light
2019-10-17 17:04:27 -07:00