* 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
* Remove async_setup from mqtt integration
* Final update common tests
* Related tests init
* Related tests diagnostics
* Related tests config_flow
* Cleanup and correct test
* Keep websockets_api commands in async_setup
* Debounce and group mqtt subscriptions
* Cleanup
* Do not cooldown on resubscribe
* Remove lock from task
Co-authored-by: Erik Montnemery <erik@montnemery.com>
* ruff
* Longer initial cool down. Manages unsubscribes
* Own lock for access to self._pending_subscriptions
* adjust
* Subscribe to highest QoS when sharing subscription
* do not block _pending_subscriptions_lock with io
* Test the highest qos is subscribed at
* Cleanup max qos
* Follow up comments part 1
* Make docstr more generic
* Make max qos update thread safe
* Add lock on clearing _max_qos when resubscribing
* Wait for linger task
* User copy
* Check for key before cleaning up
* Fix lingering task
* Do not use a lock
* do not await _async_queue_subscriptions
* Replace copy with assignment
* Update max qos before returning
* Do not iterate if max_qos == 0
* Do not ieterate subs if max qos == 0
* Set initial cooldown correctly
* Ensure discovery cooldown ends after subscribing
* plan last subscribe with debouncer timeout
* cooldown if self._pending_subscriptions is set
* Revert format changes
* Remove stale assingnment self._last_subscribe
* Remove not used property
* Also check while for pending subscriptions
* revert first added sleep()
* Optimize
---------
Co-authored-by: Erik Montnemery <erik@montnemery.com>
Co-authored-by: J. Nick Koston <nick@koston.org>
* Normalize received RGB colors to 100% brightness
* Assert on rgb_color attribute
* Use max for RGB to get brightness
* Avoid division and add clamp
* remove clamp
Co-authored-by: Erik Montnemery <erik@montnemery.com>
---------
Co-authored-by: Erik Montnemery <erik@montnemery.com>
* 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>
* 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
* 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>
* 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
* 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>
* 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
* 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
* 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
* 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`
* 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>
* 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
* 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>
* 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>
* 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
* 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
* 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
* 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
* 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