* 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 JSON type definitions
* Sample use
* Keep mutable for a follo-up PR (avoid dead code)
* Use list/dict
* Remove JsonObjectType
* Remove reference to Union
* Cleanup
* Improve rest
* Rename json_dict => json_data
* Add docstring
* Add type hint to json_loads
* Add cast
* Move type alias to json helpers
* Cleanup
* Create and use json_loads_object
* Make error more explicit and add tests
* Use JsonObjectType in conversation
* Remove quotes
* 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