Commit Graph

753 Commits (f45d373e1727ab01dc6106687a0279c641d37239)

Author SHA1 Message Date
Jan Bouwhuis a9becd8e0e
Raise ValueError on date parsing of MQTT sensor with invalid date format (#89036)
* Suppress ValueError on date parsing of MQTT sensor

* Simplify, but not update state on invalid payload

* Still raise an an invalid date

* Make datetime state unknown on invalid format

* remove unrelated added new line
2023-03-05 17:06:48 +01:00
Jan Bouwhuis ae04c5d773
Clean up unused and deprecated TLS version setting on MQTT client (#88674)
* Cleanup CONF_TLS_VERSION remains

* Fix diagnostics tests
2023-03-01 18:42:34 +01:00
Jan Bouwhuis 3f79155df6
Remove deprecated callback support for MQTT subscribe (#88543)
* Remove deprecated callback support and fix tests

* Add note with removal instruction
2023-02-21 22:21:00 +01:00
Jan Bouwhuis 57738fbb8c
Replace deprecated SSLContext constant PROTOCOL_TLS in mqtt (#88214)
Replace deprecated SSLContext constants
2023-02-16 13:01:28 -05:00
J. Nick Koston d2277fa6db
Fix restore of MQTT subscriptions from reload (#88220) 2023-02-16 11:14:26 -06: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 03e9dff327
Allow resetting MQTT climate attributes and ignore empty values (#87936)
Allow reseting MQTT climate attributes
2023-02-15 16:31:49 +01:00
Franck Nijhof ed79265843
Enable Ruff PT006 (#88165)
* Enable Ruff PT006

* Adjust existing cases

* Fix tests

* Remove unneeded parentheses
2023-02-15 14:09:50 +01:00
Franck Nijhof 9030ca05b1
Enable Ruff SIM118 (#87772) 2023-02-15 12:39:12 +01:00
epenet 50cbabb2d8
Add type hints to integration tests (part 15) (#88006) 2023-02-15 10:00:49 +01:00
Jan Bouwhuis 6c23d6abfe
Fix doc string in mqtt test (#88138)
Fix docstr
2023-02-15 05:56:03 +01:00
J. Nick Koston c54500cb1f
Fix invalid spec in mqtt tests for py3.11 (#88092)
Fix invalid spec in mqtt tests

unittest.mock.InvalidSpecError: Cannot spec a Mock object.
2023-02-14 11:28:46 -05:00
Jan Bouwhuis 950ee34514
Correct typing on hass_storage fixure (#87986)
Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>
2023-02-13 12:12:34 +01:00
Jan Bouwhuis 41a92a872f
Add missed type hint on MQTT device tracker test (#87847) 2023-02-10 22:42:56 +01:00
Jan Bouwhuis 0bf4896c7f
Add type hints to MQTT init tests (#87402)
* Add hass type hint and `None` return type

* Add type hints on tmp_path

* Add registry hints

* Add caplog and hass_ws_client type hints

* Add type hints for MqttMockHAClientGenerator

* Add type hints MqttMockPahoClient

* Hints on fixtures `calls` and `record_calls`

* Other fixture type hints tweaks

* Add hints for mock_usename_password_set

* Update tests/components/mqtt/test_init.py

Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>

* correct domain

---------

Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>
2023-02-10 18:38:37 +01:00
Jan Bouwhuis 1a38b9f665
Improve coverage MQTT device_trigger (#87408)
* Improve coverage MQTT device_trigger

* Use assert
2023-02-09 17:42:32 +01:00
Jan Bouwhuis a244f9b202
Add type hints tests MQTT config_flow (#87783) 2023-02-09 16:47:28 +01:00
Jan Bouwhuis dc5f35a85e
Add missed type hints on MQTT platform tests (#87781) 2023-02-09 15:22:30 +01:00
epenet bb174780b9
Apply registry type hints on mqtt platform tests (#87758)
Apply registry fixture types on platform tests
2023-02-09 11:53:56 +01:00
Franck Nijhof 330e1c6cbb
Clean up unnecessary registry mocks from integration tests (#87763) 2023-02-09 10:43:45 +01:00
Jan Bouwhuis df76e31cdf
Apply MQTT fixture types on platform tests (#87722)
* Apply MQTT fixture types on platform tests

* Add caplog type hint

* Add hass_ws_client type hint

* Add tmp_path type hint

* Add hass_client_no_auth type hint
2023-02-09 09:48:22 +01:00
Franck Nijhof 76bf6f164f
Clean up unnecessary registry mocks from mqtt tests (#87728)
* Clean up unnecessary registry mocks from mqtt tests

* Fix helper methods
2023-02-09 08:19:06 +01:00
Jan Bouwhuis b93c135c8d
Add type hints for MQTT discovery tests (#87425)
* Add type hints for MQTT discovery tests

* Remove more unused caplog instances

* rebase commit

* Small corrections

* Add event tye hint and correct string assignment

* Another Event type hint

Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>

* Correct test_complex_discovery_topic_prefix

* Import individual items from homeassistant.core

---------

Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>
2023-02-08 20:56:27 +01:00
Jan Bouwhuis 1a414f1433
Add hass and `None` return type on MQTT platform tests (#87713)
Add hass and `None` return type on MQTT tests
2023-02-08 18:08:03 +01:00
Jan Bouwhuis fc7e4b7664
Add type hints on common MQTT tests (#87299)
* Add hints for hass and return type

* Fix MqttMockType add apply hints to test_common

* Add type hints for other arguments

* Merge changes

* Add missed annotation

* Make tests types private and move to top
2023-02-08 11:20:27 +01:00
epenet 59ca7780fa
Add typing to tests with single hass argument (#87631) 2023-02-07 15:01:16 +01:00
epenet 4142f0d15d
Add return type to tests without arguments (#87613)
* Add return type to tests without arguments

* Black

* Cancel fixture amends
2023-02-07 14:20:06 +01:00
Jan Bouwhuis c78cae4483
Fix handling `None` or empty value for numeric MQTT sensor (#87004)
* Allow `None` for numeric sensor, ignore empty val

* Add test case with omitting a value

* Use _numeric_state_expected property

* Only respect None if numeric state is expected
2023-02-07 11:23:23 +01:00
epenet aa00114c2f
Add return type to async tests without arguments (#87612) 2023-02-07 10:26:56 +01:00
Jan Bouwhuis 73e3b30906
Add `suggested_display_precision` config option for MQTT sensor (#87129)
* Add precision for MQTT sensor

* Correct tests

* Use _attr_suggested_display_precision

* Rename option and add abbreviation

* Make abbr more compact
2023-02-07 08:55:35 +01:00
Franck Nijhof ca1a12898c
Enable Ruff D212 (#87347) 2023-02-03 23:08:48 +01:00
Franck Nijhof 5e81d28116
Update black to 23.1.0 (#87188) 2023-02-02 18:35:24 +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
Franck Nijhof 57cf11f067
Enable Ruff PT015 (#86775) 2023-01-27 11:10:29 +01:00
Franck Nijhof e50a531cd9
Code styling tweaks to the tests - Part 2 (#86662)
Co-authored-by: jjlawren <jjlawren@users.noreply.github.com>
2023-01-26 01:23:53 +01:00
Jan Bouwhuis f719ecf086
Add command template and code_format support for MQTT lock (#85830)
* Add command template for MQTT lock

* Fix tests
2023-01-23 14:48:07 +01:00
Jan Bouwhuis 92742ae423
Add jammed state support for MQTT lock (#86010)
* Add jammed state support for MQTT lock

* Correct payload jammed key

* Add tests - rename solved to ok

* Rename jammed state and template topics to motor

* Use state topic for handling motor state

* Follow up comments

* Change default behaviour `state_unjammed`

* Skip `state_unjammed`
2023-01-20 12:19:26 +01:00
epenet bcef0d66ac
Remove invalid uom from mqtt tests (#86004) 2023-01-16 14:51:35 +01:00
Patrick ZAJDA 0b02abf708
Add locking and unlocking to MQTT lock (#85779)
* Implement locking, unlocking and jammed on MQTT lock

Signed-off-by: Patrick ZAJDA <patrick@zajda.fr>

* Add tests

Signed-off-by: Patrick ZAJDA <patrick@zajda.fr>

* Refactor condition

Signed-off-by: Patrick ZAJDA <patrick@zajda.fr>

* Parametrize tests

Signed-off-by: Patrick ZAJDA <patrick@zajda.fr>

* Manage only locking and unlocking

Signed-off-by: Patrick ZAJDA <patrick@zajda.fr>

* Remove jammed from abbreviations

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

* set valid states in self._valid_states

Signed-off-by: Patrick ZAJDA <patrick@zajda.fr>

Signed-off-by: Patrick ZAJDA <patrick@zajda.fr>
Co-authored-by: Jan Bouwhuis <jbouwh@users.noreply.github.com>
2023-01-16 08:42:43 +01:00
Jan Bouwhuis 01e1e254e2
Use value of enum (#85944) 2023-01-15 19:30:29 +01:00
Michael 104f74054b
Replace the usage of unit constants by enumerations in Tests [m-n] (#85935)
* replace unit conts by enums m-n

* fix mqtt
2023-01-15 15:45:00 +01:00
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
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
Jan Bouwhuis d0556e6dd1
Move manual configuration of MQTT sensor to the integration key (#72276)
Add sensor
2022-05-23 16:29:45 +02:00
Jan Bouwhuis bc6451bd64
Move manual configuration of MQTT select to the integration key (#72274)
Add select

Co-authored-by: Erik Montnemery <erik@montnemery.com>
2022-05-23 10:08:44 +02:00
Jan Bouwhuis 673f43fbec
Move manual configuration of MQTT scene to the integration key (#72273)
Add scene

Co-authored-by: Erik Montnemery <erik@montnemery.com>
2022-05-23 09:04:03 +02:00
Jan Bouwhuis c4893f96f6
Move manual configuration of MQTT siren to the integration key (#72278)
Add siren
2022-05-23 08:08:08 +02:00
Jan Bouwhuis 623abb1147
Move manual configuration of MQTT number to the integration key (#72272)
Add number
2022-05-23 08:03:09 +02:00
Jan Bouwhuis 4153edbcdd
Move manual configuration of MQTT humidifier to the integration key (#72270)
Add humidifier
2022-05-22 13:07:49 +02:00
Jan Bouwhuis 3c3e394972
Move manual configuration of MQTT cover to the integration key (#72268)
Add cover

Co-authored-by: Erik Montnemery <erik@montnemery.com>
2022-05-22 13:07:14 +02:00
Jan Bouwhuis 87d895929f
Move manual configuration of MQTT switch to the integration key (#72279)
Add switch

Co-authored-by: Erik Montnemery <erik@montnemery.com>
2022-05-22 13:06:49 +02:00
Jan Bouwhuis e8664ce1ae
Move manual configuration of MQTT climate to the integration key (#72251)
Add climate

Co-authored-by: Erik Montnemery <erik@montnemery.com>
2022-05-22 11:28:10 +02:00
Jan Bouwhuis d1afbbfb09
Move manual configuration of MQTT vacuum to the integration key (#72281)
Add vacuum

Co-authored-by: Erik Montnemery <erik@montnemery.com>
2022-05-22 11:27:25 +02:00
Jan Bouwhuis 17669a728c
Move manual configuration of MQTT lock to the integration key (#72271)
Add lock
2022-05-21 19:07:26 +02:00
Jan Bouwhuis 809808dd80
Move manual configuration of MQTT camera to the integration key (#72249)
Add camera

Co-authored-by: Erik Montnemery <erik@montnemery.com>
2022-05-21 19:04:36 +02:00
Jan Bouwhuis 17588c39a4
Move manual configuration of MQTT binary_sensor to the integration key (#72183)
Add binary_sensor

Co-authored-by: Erik Montnemery <erik@montnemery.com>
2022-05-21 16:14:24 +02:00
Jan Bouwhuis 3918059033
Move manual configuration of MQTT button to the integration key (#72167)
Add button

Co-authored-by: Erik Montnemery <erik@montnemery.com>
2022-05-21 09:54:51 +02:00
Jan Bouwhuis 654b095498
Move manual configuration of MQTT alarm control panel to the integration key (#72165)
Add alarm_control_panel
2022-05-20 08:37:53 +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
TheHolyRoger 0fcdca2d71
Add optional base64 decoding of mqtt camera image (#71223)
Add unittest for b64 decoding of camera, fix linting
2022-05-09 21:40:15 +02:00
epenet 141688e210
Cleanup ServiceInfo compatibility (#60540)
Co-authored-by: epenet <epenet@users.noreply.github.com>
Co-authored-by: J. Nick Koston <nick@koston.org>
2022-05-09 14:17:48 +02:00
Jan Bouwhuis 5d9dc8252b
Use helper for testing an event change (#71579) 2022-05-09 11:52:08 +02:00
epenet 1be2438ef6
Use climate enums in mqtt (#70696) 2022-05-09 08:15:11 +02:00
Erik Montnemery e9abfad361
Reject MQTT topics which include control- or non-characters (#71263) 2022-05-03 12:19:43 -07:00
epenet a8a7359c6f
Use VacuumEntityFeature in mqtt (#70570)
* Use VacuumEntityFeature in mqtt

* Fix tests
2022-04-25 11:34:06 +02:00
Erik Montnemery 5e50a8abd5
Mark device triggers from hidden or auxiliary entities as secondary (#70335)
* Mark device triggers from hidden or auxiliary entities as secondary

* Update tests
2022-04-21 08:01:32 +02:00
Franck Nijhof bfc82b030f
Replace Climate CURRENT_HVAC_* constants with HVACAction enum (#70319) 2022-04-20 13:41:05 -07:00
Franck Nijhof a22f36178f
Replace Climate HVAC_MODE_* constants with HVACMode enum (#70286)
Co-authored-by: J. Nick Koston <nick@koston.org>
2022-04-20 13:20:53 +02:00
Franck Nijhof 1e4aacaeb1
Replace Alarm Control Panel FORMAT_ constants with CodeFormat enum (#69861) 2022-04-18 19:37:32 +02:00
Erik Montnemery 9b21a48048
Mend incorrectly imported MQTT config entries (#68987)
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2022-04-01 08:11:31 -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
Paulus Schoutsen 69fcce3b2c
Remove energy usage from the switch base class (#68821)
* Remove energy usage from the switch base class

* Remove unused attributes from integrations
2022-03-28 18:56:04 -10:00
Jan Bouwhuis 5afe8fd2db
Revert "Add MQTT notify platform (#64728)" (#68505)
This reverts commit e574a3ef1d.
2022-03-22 12:51:24 +01:00
J. Nick Koston 723dcbafca
Complete fan speed transition from #59781 (#67743) 2022-03-09 10:38:12 +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
Jan Bouwhuis 98adeb6070
Fix false positive MQTT climate deprecation warnings for defaults (#67661)
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2022-03-07 15:38:33 +01:00
Jan Bouwhuis 5ab4b5d15a
MQTT Improve warning override deprecated settings (#67609) 2022-03-04 12:39:29 +01:00
Jan Bouwhuis 9356bf1a8e
Fix MQTT config flow with advanced parameters (#67556)
* Fix MQTT config flow with advanced parameters

* Add test
2022-03-03 21:40:15 +01:00
Jan Bouwhuis a97fe7aae0
Mqtt fix issue with displaying non UTF-8 payload (#67471)
* Mqtt fix issue with displaying non UTF-8 payload

* None or binary

* Casting and additional test

* casting
2022-03-02 17:01:47 +01:00
Erik Montnemery 5e4b16c69a
Remove custom WS command for removing MQTT devices (#67381)
* Remove custom WS command for removing MQTT devices

* Re-add removed test
2022-02-28 15:50:49 +01:00
Erik Montnemery c7d59bb272
Fix race when unsubscribing from MQTT topics (#67376)
* Fix race when unsubscribing from MQTT topics

* Improve test
2022-02-28 14:19:50 +01:00
Jan Bouwhuis 8dbb184ed5
Add MQTT publish ACK timeout test (#67062) 2022-02-23 12:30:13 +01:00
Jan Bouwhuis 845bf80e72
Mqtt improve test coverage (#66279)
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2022-02-23 12:29:32 +01:00
Mike Degatano a51d9012ad
Fix MQTT lights tests using `STATE_OFF` (#67011) 2022-02-21 22:52:31 -08:00
rubenverhoef 95de1dd446
Additional MQTT light command templates (#63361)
Co-authored-by: jbouwh <jan@jbsoft.nl>
2022-02-22 00:00:49 +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 2abcd7cd94
Correct state restoring for MQTT temperature sensors (#66741)
* Correct state restoring for MQTT temperature sensors

* Adjust test

* Adjust test
2022-02-18 11:35:44 +01:00
Erik Montnemery 98982c86e4
Add MQTT diagnostics (#66730)
* Add MQTT diagnostics

* Redact device tracker location

* Adjust tests

* Address comments from code review
2022-02-18 09:28:49 +01:00
Jan Bouwhuis 83846bb5cc
MQTT climate preset_modes rework (#66062)
* MQTT climate preset_modes rework

* Set deprection date to 2022.9 (6 months)

* add valid_preset_mode_configuration for discovery

* Update deprecation date
2022-02-17 13:51:35 +01:00
Erik Montnemery f89de613d9
Improve MQTT binary_sensor test (#66688) 2022-02-17 00:06:42 +01:00
Erik Montnemery 335a918118
Create MQTT discovery flow when manual config is present (#66248)
* Create MQTT discovery flow when manual config is present

* Change to integration_discovery flow

* Add test

* Add default handler for integration_discovery
2022-02-11 10:31:51 +01: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 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
Jan Bouwhuis 2f0d0998a2
Add Mqtt vacuum `unknown` state (#65311)
* Add Mqtt vacuum `unknown` status

* Update tests/components/mqtt/test_state_vacuum.py

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

Co-authored-by: Erik Montnemery <erik@montnemery.com>
2022-02-03 16:50:39 +01:00
Jan Bouwhuis cf52357229
Add MQTT light unknown state support (#65308)
* Add MQTT light unknown sate support

* Update homeassistant/components/mqtt/light/schema_basic.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 tests for default unknown state

Co-authored-by: Erik Montnemery <erik@montnemery.com>
2022-02-03 16:49:57 +01:00
Jan Bouwhuis 2d011821ea
Add MQTT humidifier unknown state support (#65302)
* Add MQTT humidifier unknown state support

* Update homeassistant/components/mqtt/humidifier.py

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

* Fix tests for changed default optimistic state

Co-authored-by: Erik Montnemery <erik@montnemery.com>
2022-02-03 16:49:09 +01:00
Jan Bouwhuis 711bd7169e
Add Mqtt Fan unknown state support (#65301)
* Add Mqtt Fan unknown state support

* Update homeassistant/components/mqtt/fan.py

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

* Adjust default state in tests

Co-authored-by: Erik Montnemery <erik@montnemery.com>
2022-02-03 16:48:03 +01:00
Jan Bouwhuis 3d434dffc7
Add support Mqtt switch for unkown state (#65294)
* Mqtt switch allow unkown state

* correct type

* Update discovery tests

* Optimistic mode if not state_topic is configured.

* Default state UNKNOWN in optimistic mode

* fix discovery test
2022-02-03 16:47:24 +01:00
Jan Bouwhuis 63459feede
Return current state if template throws (#65534) 2022-02-03 16:46:36 +01:00
Erik Montnemery f3a89de71f
Fix race when handling updated MQTT discovery data (#65415) 2022-02-02 17:12:22 -08:00
Erik Montnemery fda0fbd115
Stringify MQTT payload in mqtt/debug/info WS response (#65429) 2022-02-02 18:08:48 +01:00
Jan Bouwhuis 2c07330794
Fix MQTT expire_after effects after reloading (#65359)
* Cleanup sensor expire triggers after reload

* fix test binary_sensor

* Also trigger cleanup parent classes

* Restore an expiring state after a reload

* correct discovery_update

* restore expiring state with remaining time

* Update homeassistant/components/mqtt/binary_sensor.py

description

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

* Log remaining time

* Move check

* check and tests reload

* remove self.async_write_ha_state()

Co-authored-by: Erik Montnemery <erik@montnemery.com>
2022-02-02 16:14:52 +01:00
Jan Bouwhuis 6fdaec0847
Add MQTT siren platform (#64440)
* Add mqtt siren draft

* fix tests

* Intergrate notify platform

* tests and fixes siren platform

* Add tests notify platform

* config parameters and abbreviations

* remove duplicate key

* undo move topic abbreviation

* Move const CONF_MESSAGE_COMMAND_TEMPLATE

* Remove notify service integration

* Rework

* Update homeassistant/components/mqtt/siren.py

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

* Publish JSON by default

* Allow unknown state - rename value_template

Co-authored-by: Erik Montnemery <erik@montnemery.com>
2022-01-31 10:31:57 +01:00
Jan Bouwhuis bfaada34e2
Allow `unknown` state to be set (#65183) 2022-01-31 10:25:08 +01:00
Erik Montnemery dccc4eba76
Remove artifacts from black formatting (#65113)
* Remove artifacts from black formatting

* Tweak
2022-01-28 17:00:01 +02:00
Jan Bouwhuis 0cabf3e577
Fix MQTT climate action null warnings (#64658) 2022-01-27 08:41:27 +01:00
Jan Bouwhuis efe5b0ca81
Add command template for MQTT button (#63838)
* Add command template for MQTT button

* Move CONF_COMMAND_TEMPLATE
2022-01-23 12:48:41 +01:00
Jan Bouwhuis 31a9d64572
Improve code coverage MQTT integration (#64546) 2022-01-20 13:51:19 +01:00
Jan Bouwhuis aa73e5bd72
Fix MQTT climate optimistic preset modes (#63463)
* Always publish when preset_mode is set

* Revert "Fixed isort error"

This reverts commit 1a3c5e6460.

* isort
2022-01-11 17:08:26 +01:00
Erik Montnemery 3083f059cc
Drop last_reset attribute for non 'total' sensors (#63880)
* Drop last_reset attribute for non 'total' sensors

* Adjust MQTT tests

* Add exception for utility_meter

* Rewrite exception for utility_meter

* Add comment in utility_meter

* Tweak comment
2022-01-11 13:58:35 +01:00
Orce MARINKOVSKI b78e22e012
Update MQTT light schema template (#62759)
* shema template update

* tests to cover the additional template variables

* fix flake8: too many blank lines

* Update schema_template.py

Co-authored-by: Erik Montnemery <erik@montnemery.com>
2022-01-10 09:57:56 +01:00
Franck Nijhof 3f7275a9c7
Give scenes last activated state (#62673) 2022-01-07 19:02:32 +01:00
Erik Montnemery 1995a825f3
Reject MQTT light discovery using unsupported value_template (#62682)
* Reject MQTT light discovery using unsupported value_template

* Tweak
2022-01-03 17:16:26 +01:00
Jan Bouwhuis 86ed091dbf
Skip raw encoding test for cover (#63322) 2022-01-03 17:08:28 +01:00
Jan Bouwhuis dd0193052c
Add MQTT encoding parameter for all subscribed topics (#62263)
* Add encoding parameter for all subscribable topics

* test setup encoding incoming payload

* remove support for device_tracker and tag+tests
2022-01-03 16:08:07 +01:00
Jan Bouwhuis 3ca18922e6
Mqtt rework on value templates (#62105)
* add MqttValueTemplate class

* support variables at initiation

* pass MqttEntity instead of hass

* Use MqttValueTemplace class for value templates

* make hass en enitity parameters conditional

* remove unused property and remove None assignment

* rename self._attr_value_template
2022-01-03 16:07:40 +01:00
Jan Bouwhuis 061ce0c187
Fix mqtt reloading and rework tests (#62950)
* Improve mqtt reloading/tests and fix issues

* Cleanup fixture for reloading test

* isort and black remove replaced test_reloadable
2022-01-03 15:14:50 +01:00
Jan Bouwhuis 0dab5e69db
Fix MQTT cover not using tilt_command_template (#63080) 2022-01-03 15:13:30 +01:00
Jan Bouwhuis 457ce195dd
Add mqtt entity attributes command templates (#61937)
* Add entity variables to MqttCommandTemplate

* missing command template update

* make hass and entity conditional parameters

* Add encoding support for publishing

* Revert "Add encoding support for publishing"

This reverts commit b69b9c60ec.
2022-01-03 15:10:15 +01:00
Jan Bouwhuis d0c4f0fec4
Add mqtt encoding support for publishing (#62739)
* encoding support for mqtt publishing - todo tests

* signature allows None values for qos and retain

* common test for mqtt publishing encoding

* better test with command templates

* more tests

* fix tests alarm control panel+tests light basic

* tests light json and template

* add tests vacuum and fix tests light_template
2022-01-03 09:03:47 +01:00