* 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
* 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
* 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>
* 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>
* 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
* 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>
* Add `this` object to MQTT templates
* Only set once, remove hass guard
* Set once if there is a state
* Add tests TemplateStateFromEntityId calls once
* 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
* 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>
* 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>
* Ensure config schema validation
* Use correct schema for device_tracker
* Remove schema validation from the platform setup
* Remove loop to build schema
* 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>
* MQTT climate preset_modes rework
* Set deprection date to 2022.9 (6 months)
* add valid_preset_mode_configuration for discovery
* Update deprecation date
* Create MQTT discovery flow when manual config is present
* Change to integration_discovery flow
* Add test
* Add default handler for integration_discovery
* 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>
* 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>
* 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
* 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>
* 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
* 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
* 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.
* 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