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
Jan Bouwhuis
4da3fb5baa
Correct Import of ReceivePayloadType ( #81035 )
2022-10-26 20:26:05 +02:00
Jan Bouwhuis
2d9f39d406
Strict typing for shared MQTT modules ( #80913 )
...
Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
2022-10-26 13:52:34 +02: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
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
354411feed
Link manually added MQTT entities the the MQTT config entry ( #78547 )
...
Co-authored-by: Erik <erik@montnemery.com>
2022-09-18 12:55:31 -04:00
Jan Bouwhuis
1f410e884a
Make hass.data["mqtt"] an instance of a DataClass ( #77972 )
...
* Use dataclass to reference hass.data globals
* Add discovery_registry_hooks to dataclass
* Move discovery registry hooks to dataclass
* Add device triggers to dataclass
* Cleanup DEVICE_TRIGGERS const
* Add last_discovery to data_class
* Simplify typing for class `Subscription`
* Follow up on comment
* Redo suggested typing change to sasisfy mypy
* Restore typing
* Add mypy version to CI check logging
* revert changes to ci.yaml
* Add docstr for protocol
Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
* Mypy update after merging #78399
* Remove mypy ignore
* Correct return type
Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
2022-09-17 21:43:42 +02:00
Jan Bouwhuis
fb67123d77
Clear MQTT discovery topic when a disabled entity is removed ( #77757 )
...
* Cleanup discovery on entity removal
* Add test
* Cleanup and test
* Test with clearing payload not unique id
* Address comments
* Tests cover and typing
* Just pass hass
* reuse code
* Follow up comments revert changes to cover tests
* Add test unique_id has priority over disabled
* Update homeassistant/components/mqtt/__init__.py
Co-authored-by: Erik Montnemery <erik@montnemery.com>
Co-authored-by: Erik Montnemery <erik@montnemery.com>
2022-09-09 15:24:26 +02:00
Jan Bouwhuis
2e34814d7a
Fix reload of MQTT config entries ( #76089 )
...
* Wait for unsubscribes
* Spelling comment
* Remove notify_all() during _register_mid()
* Update homeassistant/components/mqtt/client.py
Co-authored-by: Erik Montnemery <erik@montnemery.com>
* Correct handling reload manual set up MQTT items
* Save and restore device trigger subscriptions
* Clarify we are storing all remaining subscriptions
Co-authored-by: Erik Montnemery <erik@montnemery.com>
2022-09-02 18:54:20 +02:00
epenet
dff9baf880
Use _attr_should_poll in components [j-n] ( #77357 )
2022-08-26 21:19:37 +02:00
Jan Bouwhuis
5d9e462118
Add repair for deprecated MQTT yaml config ( #77174 )
...
* Add repair for deprecated MQTT yaml config
* Update homeassistant/components/mqtt/strings.json
Co-authored-by: Erik Montnemery <erik@montnemery.com>
* Update homeassistant/components/mqtt/strings.json
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Add restart instruction
* Update homeassistant/components/mqtt/strings.json
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Update English translation
* update issue_registry imports
* Update homeassistant/components/mqtt/manifest.json
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
Co-authored-by: Erik Montnemery <erik@montnemery.com>
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2022-08-25 13:30:05 +02:00
Maciej Bieniek
ad6beac535
Add hw_version
to MQTT device info ( #77210 )
...
* Add hw_version
* Add abbreviation for hw_version
* Update tests
* Update discovery tests
2022-08-25 11:55:33 +02:00
Marc Mueller
cf7c716bda
Fix implicit Optional [core] ( #76719 )
2022-08-13 18:46:08 +02:00
Erik Montnemery
f0eea62c1e
Address some MQTT review comments ( #75482 )
2022-07-22 11:12:00 +02:00
Jan Bouwhuis
5930f056a8
Mqtt support config_entry unload ( #70149 )
...
* squashed commits for rebase
* Flake
* Fix reloading issue manual legacy items
* Improve ACS sync for unsubscribe at disconnect
* Processed review comments
* Update homeassistant/components/mqtt/client.py
Co-authored-by: Erik Montnemery <erik@montnemery.com>
* No need to await entry setup
* Remove complication is_connected
* Update homeassistant/components/mqtt/__init__.py
Co-authored-by: Erik Montnemery <erik@montnemery.com>
2022-07-12 11:07:18 +02:00
epenet
64bfa20f6a
Improve type hints in mqtt ( #74295 )
2022-07-02 20:15:54 +03:00
Erik Montnemery
f05b4a0ca0
Fire event_mqtt_reloaded only after reload is completed ( #74226 )
2022-06-30 10:15:25 -07:00
J. Nick Koston
2742bf86e3
Switch mqtt to use json helper ( #73871 )
...
* Switch mqtt to use json helper
* whitespace
2022-06-23 14:29:09 +02:00
Jan Bouwhuis
57daeaa174
Fix MQTT config schema to ensure correct validation ( #73619 )
...
* Ensure config schema validation
* Use correct schema for device_tracker
* Remove schema validation from the platform setup
* Remove loop to build schema
2022-06-20 08:51:12 +02:00
Erik Montnemery
de2fade8c6
Improve MQTT reload performance ( #73313 )
...
* Improve MQTT reload performance
* Update homeassistant/components/mqtt/__init__.py
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Update homeassistant/components/mqtt/mixins.py
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Update homeassistant/components/mqtt/__init__.py
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2022-06-10 14:23:08 +02:00
Erik Montnemery
b97d346df7
Fix reload of MQTT yaml config ( #72901 )
2022-06-02 11:32:31 -07: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
ed1c2ea2b8
Move manual configuration of MQTT fan and light to the integration key ( #71676 )
...
* Processing yaml config through entry setup
* Setup all platforms
* Update homeassistant/components/mqtt/__init__.py
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* adjust mock_mqtt - reference config from cache
* Fix test config entry override
* Add tests yaml setup
* additional tests
* Introduce PLATFORM_SCHEMA_MODERN
* recover temporary MQTT_BASE_PLATFORM_SCHEMA
* Allow extra key in light base schema, restore test
* Fix test for exception on platform key
* One deprecation message per platform
* Remove deprecation checks from modern schema
* Update homeassistant/components/mqtt/fan.py
Co-authored-by: Erik Montnemery <erik@montnemery.com>
* Update homeassistant/components/mqtt/fan.py
Co-authored-by: Erik Montnemery <erik@montnemery.com>
* Update homeassistant/components/mqtt/light/__init__.py
Co-authored-by: Erik Montnemery <erik@montnemery.com>
* Update homeassistant/components/mqtt/light/__init__.py
Co-authored-by: Erik Montnemery <erik@montnemery.com>
* Update homeassistant/components/mqtt/light/schema_json.py
Co-authored-by: Erik Montnemery <erik@montnemery.com>
* Update homeassistant/components/mqtt/light/schema_template.py
Co-authored-by: Erik Montnemery <erik@montnemery.com>
* Update homeassistant/components/mqtt/mixins.py
Co-authored-by: Erik Montnemery <erik@montnemery.com>
* rename validate_modern_schema
* Do not fail platform if a single config is broken
* Update homeassistant/components/mqtt/__init__.py
Co-authored-by: Erik Montnemery <erik@montnemery.com>
* Fix tests on asserting log
* Update log. Make helper transparant, remove patch
* Perform parallel processing
* Update tests/components/mqtt/test_init.py
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Apply suggestions from code review
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Update homeassistant/components/mqtt/mixins.py
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* black
* Fix tests and add #new_format anchor
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
Co-authored-by: Erik Montnemery <erik@montnemery.com>
2022-05-19 15:04:53 +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
epenet
4c7e1fe060
Cleanup ENTITY_CATEGORIES_SCHEMA ( #66549 )
...
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
Co-authored-by: epenet <epenet@users.noreply.github.com>
2022-04-01 09:40:43 -07:00
Paulus Schoutsen
130ca2213f
Enforce EntityCategory enum ( #69015 )
...
Co-authored-by: Franck Nijhof <git@frenck.dev>
2022-03-31 15:04:33 -07:00
Erik Montnemery
7e8d52e5a3
Fix race when handling rapid succession of MQTT discovery messages ( #68785 )
...
Co-authored-by: jbouwh <jan@jbsoft.nl>
2022-03-29 20:26:11 -07:00
epenet
5830481a53
Use new CONF_MODEL in mqtt ( #68832 )
...
Co-authored-by: epenet <epenet@users.noreply.github.com>
2022-03-29 12:49:00 +02:00
Jan Bouwhuis
5afe8fd2db
Revert "Add MQTT notify platform ( #64728 )" ( #68505 )
...
This reverts commit e574a3ef1d
.
2022-03-22 12:51:24 +01:00
Jan Bouwhuis
e574a3ef1d
Add MQTT notify platform ( #64728 )
...
* Mqtt Notify service draft
* fix updates
* Remove TARGET config parameter
* do not use protected attributes
* complete tests
* device support for auto discovery
* Add targets attribute and support for data param
* Add tests and resolve naming issues
* CONF_COMMAND_TEMPLATE from .const
* Use mqtt as default service name
* make sure service has a unique name
* pylint error
* fix type error
* Conditional device removal and test
* Improve tests
* update description has_notify_services()
* Use TypedDict for service config
* casting- fix discovery - hass.data
* cleanup
* move MqttNotificationConfig after the schemas
* fix has_notify_services
* do not test log for reg update
* Improve casting types
* Simplify obtaining the device_id
Co-authored-by: Erik Montnemery <erik@montnemery.com>
* await not needed
Co-authored-by: Erik Montnemery <erik@montnemery.com>
* Improve casting types and naming
* cleanup_device_registry signature change and black
* remove not needed condition
Co-authored-by: Erik Montnemery <erik@montnemery.com>
2022-03-08 16:27:18 +01:00
Marc Mueller
45d8d04c40
Use assignment expressions [other] ( #66882 )
2022-02-19 17:22:51 +01:00
Erik Montnemery
fcf774ecfc
Small cleanup of MQTT mixins ( #66812 )
2022-02-18 16:51:14 +01:00
Erik Montnemery
ba6d1976df
Improve MQTT device removal ( #66766 )
...
* Improve MQTT device removal
* Update homeassistant/components/mqtt/mixins.py
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Adjust tests
* Improve test coverage
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2022-02-18 13:45:25 +01:00
Erik Montnemery
750b48dcaf
Use pylint disable-next in MQTT ( #66758 )
2022-02-17 11:12:12 -08:00
Erik Montnemery
fe38e6ba87
Drop MQTT import flow ( #66160 )
...
* Drop MQTT import flow
* Reload manually configured MQTT entities when config entry is setup
* Address review comments
* Actually remove the import flow
2022-02-10 21:09:57 +01:00
Erik Montnemery
911e488d48
Fix ENTITY_CATEGORIES_SCHEMA ( #66108 )
...
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2022-02-08 14:00:53 -08:00
Erik Montnemery
55d8314093
Fix cleanup of MQTT debug info ( #66104 )
2022-02-08 12:49:25 -08:00
Erik Montnemery
8245ff7473
Log transmitted MQTT messages ( #65550 )
2022-02-04 17:35:32 +01:00