Commit Graph

561 Commits (e35ab75c0b8378278310bfba35411dea5b7a9835)

Author SHA1 Message Date
Jan Bouwhuis 64e235285d
Deprecate power_command_topic for MQTT climate (#85229)
* Deprecate mode_command_topic for MQTT climate

* Correct deprecation and remove support release inf

* Do not use future tense for comment

* Extend deprecation period to 6 months
2023-01-12 09:49:14 +01:00
Jan Bouwhuis ee21bc5d7f
Allow MQTT device_class or state_class to be set as `None` (#85106)
* Allow MQTT device_class to be set as `None`

* Add test

* Also allow sensor state_class to be `None`
2023-01-04 15:21:07 +01:00
Jan Bouwhuis 9f24897814
Do not reset current selection on reconfig or MQTT select (#85099)
* Do not reset current selection on reconfig

* Add a test
2023-01-04 10:29:53 +01:00
Jan Bouwhuis b29c96639b
Correct initial config of MQTT climate (#85097)
* Do not reset MQTT climate state on re-config

* More corrections

* Correct startup behavior in optimistic mode
2023-01-04 10:29:02 +01:00
Mike K 799d527fb5
Add MQTT climate setting for current humidity (#84592)
* MQTT Climate: Add support for setting the current humidity via MQTT

* MQTT Climate: Add configuration constants related to setting the target humidity

* MQTT Climate: Add support for setting the humidity's state topic & template

* MQTT Climate: Add support for setting the initial humidity

* MQTT Climate: Add support for setting the humidity's command topic & template

* MQTT Climate: Add support for setting the min/max humidity

* MQTT Climate: Fix style & tests

* MQTT Climate: Set the initial humidity to None

* MQTT Climate: Rename _set_mqtt_attribute to _set_climate_attribute and handle_temperature_received to handle_climate_attribute_received

* MQTT Climate: Copy humidity range validation from MQTT Humidifier

* MQTT Climate: Remove CONF_HUMIDITY_INITIAL

* MQTT Climate: Only enable support for TARGET_HUMIDITY when the command topic is set

* MQTT Climate: Check if setting the target humidity is supported before actually setting it

* MQTT Climate: Make sure that CONF_HUMIDITY_COMMAND_TOPIC has been configured when setting CONF_HUMIDITY_STATE_TOPIC

* MQTT Climate: Fix broken tests

* MQTT Climate: Add test for optimistically setting the target humidity

* MQTT Climate: Remove references to "temperature" in handle_climate_attribute_received

* MQTT Climate: Add additional humidity-related tests

* MQTT Climate: Remove supported feature check in handle_target_humidity_received

It's not needed because this is covered by the `valid_humidity_state_configuration` validation.

Co-authored-by: Jan Bouwhuis <jbouwh@users.noreply.github.com>

* MQTT Climate: Remove supported feature check in async_set_humidity

It is covered by the base Climate entity.

Co-authored-by: Jan Bouwhuis <jbouwh@users.noreply.github.com>

Co-authored-by: Jan Bouwhuis <jbouwh@users.noreply.github.com>
2023-01-03 22:57:20 +01:00
Sándor Oroszi a0d41e1d97
Add hs_command_template and xy_command_template to mqtt light default schema (#84988)
* Add mqtt light hs_command_template

* Add mqtt light xy_command_template
2023-01-03 12:58:00 +01:00
Jan Bouwhuis 9cf86b234b
Add optimistic option for MQTT climate (#84777) 2023-01-02 11:39:42 +01:00
Jan Bouwhuis ee66ffc8de
Do not depend MQTT CI tests on debug logs (#84783)
* Do not depend MQTT CI tests on debug logs

* Leave Clean up expire as debug message
2022-12-29 18:29:28 +01:00
Jan Bouwhuis 5fbe36d43e
Fix MQTT test logging level after default pytest logging capture change (#84773)
Fix logging level for MQTT CI testing after #84672
2022-12-29 15:08:35 +01:00
Jonathan de Jong b67009dee3
Allow MQTT device trackers to be able to the reset the location name for auto zone inference (#83952)
* adds auto-zone to mqtt device trackers

* black formatting

* abbr

* change abbreviation

* add test

* fade to black

* Modify custom overrides

Co-authored-by: Jan Bouwhuis <jbouwh@users.noreply.github.com>

* add custom + abbr payload and fix test docstrings

* change auto_zone to reset

* change RST to None, address isort

Co-authored-by: Jan Bouwhuis <jbouwh@users.noreply.github.com>
2022-12-20 17:38:40 +01:00
Jan Bouwhuis 7ed1d4988b
Add QoS parameter to MQTT websocket_subscribe (#83241) 2022-12-06 09:31:19 +01:00
Joe Rogers f1ee920463
Handle numeric versions in mqtt update (#83218)
* Handle numeric versions in mqtt update

* Remove need for type:ignore

Co-authored-by: Jan Bouwhuis <jbouwh@users.noreply.github.com>

Co-authored-by: Jan Bouwhuis <jbouwh@users.noreply.github.com>
2022-12-04 21:52:48 +01:00
Jan Bouwhuis de77132a5a
Add the QoS in the MQTT debug log (#83195)
Logging the MQTT QoS in the debug log
2022-12-04 15:03:41 +01:00
Jan Bouwhuis 2785b2b52f
Add mqtt text platform (#82884) 2022-11-29 20:31:05 +01:00
Jan Bouwhuis 4335b0db25
Clean up or correct from removed deprecation for MQTT platform (#82684)
Clean up or correct from removed deprecation
2022-11-25 16:11:22 +01:00
Jan Bouwhuis 01b0f4d565
Announce a deprecated callback for MQTT subscribe will stop working (#82610)
* Announce a deprecated callback will stop working

* Use 2 months grace period

* Use 2 months grace period

* Use 2 months grace period

* Add deprecation comment to tests
2022-11-25 10:22:12 +01:00
epenet f91e250e90
Fix TemplateError definition (#82570) 2022-11-23 20:30:32 +01:00
Jan Bouwhuis 4f3919cb95
Move mqtt device_tracker files (#82581)
Move mqtt device_tracker files to single file
2022-11-23 16:24:56 +01:00
Jan Bouwhuis 32d68f375b
Add Mqtt WebSockets support (#82078)
* Add Mqtt WebSockets support

* Fix tests

* Add testing websockets options

* Add tests transport settings

* Do not use templates for ws_headers

* Use json helper - small corrections
2022-11-23 15:03:31 +01:00
Aarni Koskela e4c73259f7
Configure autoflake for pre-commit (#82414) 2022-11-22 08:10:36 +01:00
Jan Bouwhuis 7c2e7863d2
Remove legacy YAML support from MQTT (#82102) 2022-11-17 22:55:31 +01:00
Jan Bouwhuis b717da879f
Add support for Mqtt protocol version 5 (#82260) 2022-11-17 21:12:27 +01:00
Jan Bouwhuis f60850586e
Remove `b64` encoding work-a-round for MQTT camera (#82244) 2022-11-17 10:11:25 +01:00
Jan Bouwhuis 7932864e00
Always update attributes on an update for MQTT update (#82139) 2022-11-15 18:43:01 +01:00
Jan Bouwhuis db0785827f
Revert "Do not write state if payload is `''`" for MQTT sensor (#81347)
* Revert "Do not write state if payload is ''"

This reverts commit 869c11884e.

* Add test
2022-11-01 16:25:01 +01:00
Jan Bouwhuis bcae6d604e
Improve MQTT type hints part 8 (#81034)
* Improve typing device_tracker discovery

* Improve typing device_tracker yaml

* Add test source_type attribute

* Follow up comment

* Initialize at `__init__` not at class level.

* Use full name for return variable

* Correct import, remove assert

* Use AsyncSeeCallback
2022-10-28 18:20:33 +02:00
Maciej Bieniek 11ea834cbe
Improve MQTT update platform (#81131)
* Allow JSON as state_topic payload

* Add title

* Add release_url

* Add release_summary

* Add entity_picture

* Fix typo

* Add abbreviations
2022-10-28 17:05:43 +02:00
Jan Bouwhuis f10f74a65a
Add default `source_type` for MQTT device_tracker (#81128)
Make sure the source_type is set - default to gps
2022-10-28 10:49:01 +02:00
Maciej Bieniek 1f0cb73ad0
Add `update` platform to MQTT integration (#80659) 2022-10-24 11:47:45 +02:00
Jan Bouwhuis 5e7f571f01
Move advanced MQTT options to entry (#79351)
* Move advanced broker settings to entry

* Add repair issue for deprecated settings

* Split CONFIG_SCHEMA

* Do not store certificate UI flags in entry

* Keep entered password in next dialog

* Do not process yaml config in flow

* Correct typo
2022-10-24 09:58:23 +02:00
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