Commit Graph

531 Commits (3840cbd012485e7cdae16421930b906f7e673791)

Author SHA1 Message Date
Martin Hjelmare 62c4cd3c26
Add name and slug to supervisor discovery info (#80094) 2022-10-11 16:56:45 +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
Bert Melis 6546bba233
Process abbreviated availability options in mqtt discovery payload (#79712)
Expand availability in mqtt discovery payload
2022-10-08 15:36:49 +02:00
Jan Bouwhuis aee82e2b3b
De-duplicate MQTT config_flow code (#79369)
* De-duplicate config_flow code

* De duplicate code birth and will
2022-10-07 10:12:19 +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 c5a58c8501
Fix MQTT setup after changing config entry flow options (#79103)
Fix issues with config flow options
2022-09-27 08:05:28 +02:00
J. Nick Koston 75104159c6
Fix mqtt tests (#79079) 2022-09-25 20:07:50 -10: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 0d696b84b2
Cleanup root component imports in tests (#78893) 2022-09-21 06:57:41 -10:00
epenet 7bc2712142
Adjust root-import in tests (#78761)
* Adjust root-import in tests

* Adjust diagnostics

* Adjust button

* Adjust select

* Adjust device_tracker

* Adjust camera

* Adjust humidifier

* Adjust media_source

* Adjust update

* Adjust siren

* Adjust number

* Adjust alarm_control_panel

* Adjust notify

* Adjust sensor

* Adjust switch

* Revert anthemav

* Don't adjust demo humidifier
2022-09-19 15:22:23 +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 9a4c8f5f0e
Refactor common MQTT tests to use modern schema (#77583)
* Common tests availability

* Common tests attributes

* Common tests unique id

* Common tests discovery

* Common tests encoding

* Common tests device info

* Common tests entity_id updated

* Common tests entity debug info

* Common test entity category

* Common tests setup reload unload+corrections

* Cleanup sweep

* Comments from curent change

* Cleanup

* Remove unused legacy config
2022-09-09 11:15:48 +02:00
Erik Montnemery b21f8c9ea8
Remove use of deprecated SUPPORT_* constants from MQTT light (#77828)
* Remove use of deprecated SUPPORT_* constants from MQTT light

* Refactor
2022-09-08 11:21:46 +02:00
Jan Bouwhuis 13188a5c63
Refactor MQTT tests to use modern platform schema part 2 (#77525)
* Tests light json

* Tests light template

* Missed test light json

* Tests light

* Tests lock

* Tests number

* Tests scene

* Tests select

* Tests sensor

* Tests siren

* Tests state vacuuum

* Tests switch

* Derive DEFAULT_CONFIG_LEGACY from DEFAULT_CONFIG

* Suggested comment changes
2022-09-06 11:03:02 +02:00
Jan Bouwhuis a4792998a2
Refactor MQTT tests to use modern platform schema part 1 (#77387)
* Tests alarm_control_panel

* Tests binary_sensor

* Tests button

* Tests camera

* Tests Climate + corrections default config

* Tests cover

* Tests device_tracker

* Tests fan

* Tests humidifier

* Fix test_supported_features test fan

* Tests init

* Tests legacy vacuum

* Derive DEFAULT_CONFIG_LEGACY from DEFAULT_CONFIG

* Commit suggestion comment changes
2022-09-06 11:02:15 +02:00
Jan Bouwhuis a3e6abd396
Use hass.config_entries.async_setup in mqtt test (#77750)
* Use hass.config_entries.async_setup

* The setup is awaited hence waiting is not needed
2022-09-03 15:44:50 +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
Erik Montnemery 14717951c3
Support configuring the mode of MQTT number entities (#77478)
* Support configuring the mode of MQTT number entities

* Use modern schema for tests

Co-authored-by: jbouwh <jan@jbsoft.nl>
2022-08-30 12:47:35 +02:00
Franck Nijhof 5f0cca9b26
Raise repairs issue if automation calls unknown service (#76949) 2022-08-25 20:56:26 -04: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
Erik Montnemery c55505b47b
Use mock_restore_cache in mqtt tests (#77297) 2022-08-25 09:27:38 +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
Erik Montnemery 60c8d95a77
Remove white_value support from light (#76926) 2022-08-18 08:21:05 -04:00
Erik Montnemery 4cc1428eea
Add support for color_mode white to MQTT JSON light (#76918) 2022-08-17 13:07:50 +02:00
Erik Montnemery 73001e29ff
Remove deprecated white_value support from MQTT light (#76848)
* Remove deprecated white_value support from MQTT light

* Remove deprecated white_value support from MQTT JSON light

* Remove deprecated white_value support from MQTT template light
2022-08-16 16:47:21 +02:00
Jan Bouwhuis 161e533c5f
Remove MQTT climate support for hold and away modes (#76299)
Remove support for hold and away modes
2022-08-15 08:27:37 +02:00
Jan Bouwhuis f72cfef7be
Fix MQTT camera encoding (#76124)
* Fix MQTT camera encoding

* Reduce code

* Add test for using image_encoding parameter

* Move deprecation check to validation

* Dependency

* Set correct strings and log warning

* Rename constant

* Use better issue string identifier

* Revert unwanted change to hassio test

* Avoid term `deprecated` in issue description

* Revert changes using the repairs API

* Add a notice when work-a-round will be removed

* Update homeassistant/components/mqtt/camera.py

Co-authored-by: Erik Montnemery <erik@montnemery.com>

Co-authored-by: Erik Montnemery <erik@montnemery.com>
2022-08-15 08:26:17 +02:00
Jan Bouwhuis 741efb89d5
Remove deprecated `send_if_off` option for MQTT climate (#76293)
* Remove `send_if_off` option for mqtt climate

* Use cv.remove()
2022-08-05 13:17:46 +02:00
uvjustin 9ad273a59f
Fix entity typo (#75767) 2022-07-26 16:27:16 +02:00
Erik Montnemery 9d0a252ca7
Improve handling of MQTT config entry data (#72691)
* Improve handling of MQTT config entry data

* Add test

* Add warning

* Adjust tests
2022-07-22 13:36:43 +02:00
Jan Bouwhuis 5ef92e5e95
Fix MQTT race awaiting an ACK when disconnecting (#75117)
Co-authored-by: Erik <erik@montnemery.com>
2022-07-20 11:58:54 +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
Franck Nijhof 7cd68381f1
Search/replace RESULT_TYPE_* by FlowResultType enum (#74642) 2022-07-07 19:57:36 +03:00
epenet 8ef87205f9
Improve type hints in mqtt (#74247) 2022-06-30 21:11:45 +02: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
J. Nick Koston 19b2b33037
Speed up subscribing to mqtt topics on connect (#73685)
* Speed up subscribing to mqtt topics

* update tests

* Remove extra function wrapper

* Recover debug logging for subscriptions

* Small changes and test

* Update homeassistant/components/mqtt/client.py

* Update client.py

Co-authored-by: jbouwh <jan@jbsoft.nl>
Co-authored-by: Erik Montnemery <erik@montnemery.com>
2022-06-22 16:03:18 +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 dea8041461
Add device_class to MQTT number and migrate to native_value (#73534) 2022-06-16 13:34:54 +02:00
J. Nick Koston 51b4d15c8c
Speed up mqtt tests (#73423)
Co-authored-by: jbouwh <jan@jbsoft.nl>
Co-authored-by: Jan Bouwhuis <jbouwh@users.noreply.github.com>
2022-06-13 10:17:10 -10:00
Jan Bouwhuis 657e7f9a4c
Simplify MQTT test for setup manual mqtt item from yaml (#72916)
simplify test setup manual mqtt item from yaml
2022-06-13 13:44:12 +02:00
Jan Bouwhuis 48e3d68b53
Clean up MQTT platform entry setup at discovery (#72371)
* Setup MQTT discovery with entry setup

* Wait for entry setup in test

* flake
2022-06-13 13:38:53 +02:00
Erik Montnemery 3d78240cee
Fix initial tilt value of MQTT cover (#73308) 2022-06-10 11:11:40 +02:00
Erik Montnemery b97d346df7
Fix reload of MQTT yaml config (#72901) 2022-06-02 11:32:31 -07:00
Jan Bouwhuis 52561ce076
Update MQTT tests to use the config entry setup (#72373)
* New testframework and tests for fan platform

* Merge test_common_new to test_common

* Add alarm_control_panel

* Add binary_sensor

* Add button

* Add camera

* Add climate

* Add config_flow

* Add cover

* Add device_tracker_disovery

* Add device_trigger

* Add diagnostics

* Add discovery

* Add humidifier

* Add init

* Add lecacy_vacuum

* Add light_json

* Add light_template

* Add light

* Add lock

* Add number

* Add scene

* Add select

* Add sensor

* Add siren

* Add state_vacuum

* Add subscription

* Add switch

* Add tag

* Add trigger

* Add missed tests

* Add another missed test

* Add device_tracker

* Remove commented out code

* Correct tests according comments

* Improve mqtt_mock_entry and recover tests

* Split fixtures with and without yaml setup

* Update fixtures manual_mqtt

* Update fixtures mqtt_json

* Fix test tasmota

* Update fixture mqtt_room

* Revert fixture changes, improve test

* re-add test
2022-06-02 14:24:46 +02: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
Erik Montnemery 84243cf560
Tweak MQTT hassio discovery flow (#72699) 2022-05-30 14:25:36 +02:00
Erik Montnemery 342ccb5bf1
Improve handling of MQTT overridden settings (#72698)
* Improve handling of MQTT overridden settings

* Don't warn unless config entry overrides yaml
2022-05-30 14:21:20 +02:00
Jan Bouwhuis d092861926
Move manual configuration of MQTT device_tracker to the integration key (#72493) 2022-05-26 13:02:39 -07:00