* Debounce MQTT unsubscribes and merge to one call
* Make _async_unsubscribe a callback
* Make sure unsubscribes are processed
* Move debug log out of lock
* Reduce calls and raise outside lock
* Cancel any unsubscribe when queing
* Copy pending unsubscribes
* Only convert topics to list once
* No copy needed
* Typo in comment
* 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>
* 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>
* 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>
* 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
* 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
* 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>
* 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
* Add `this` object to MQTT templates
* Only set once, remove hass guard
* Set once if there is a state
* Add tests TemplateStateFromEntityId calls once
* 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