core/tests/components/mqtt
Jan Bouwhuis ec1b8b616f
Debounce and group MQTT subscriptions (#88862)
* 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>
2023-03-14 11:13:55 +01:00
..
__init__.py
conftest.py Do not depend MQTT CI tests on debug logs (#84783) 2022-12-29 18:29:28 +01:00
test_alarm_control_panel.py Enable Ruff PT006 (#88165) 2023-02-15 14:09:50 +01:00
test_binary_sensor.py Enable Ruff PT006 (#88165) 2023-02-15 14:09:50 +01:00
test_button.py Enable Ruff PT006 (#88165) 2023-02-15 14:09:50 +01:00
test_camera.py Apply registry type hints on mqtt platform tests (#87758) 2023-02-09 11:53:56 +01:00
test_climate.py Allow resetting MQTT climate attributes and ignore empty values (#87936) 2023-02-15 16:31:49 +01:00
test_common.py Clean up unnecessary registry mocks from mqtt tests (#87728) 2023-02-09 08:19:06 +01:00
test_config_flow.py Enable Ruff PT006 (#88165) 2023-02-15 14:09:50 +01:00
test_cover.py Enable Ruff PT006 (#88165) 2023-02-15 14:09:50 +01:00
test_device_tracker.py Add type hints to integration tests (part 15) (#88006) 2023-02-15 10:00:49 +01:00
test_device_trigger.py Improve coverage MQTT device_trigger (#87408) 2023-02-09 17:42:32 +01:00
test_diagnostics.py Clean up unused and deprecated TLS version setting on MQTT client (#88674) 2023-03-01 18:42:34 +01:00
test_discovery.py Debounce and group MQTT subscriptions (#88862) 2023-03-14 11:13:55 +01:00
test_fan.py Enable Ruff PT006 (#88165) 2023-02-15 14:09:50 +01:00
test_humidifier.py Enable Ruff PT006 (#88165) 2023-02-15 14:09:50 +01:00
test_init.py Debounce and group MQTT subscriptions (#88862) 2023-03-14 11:13:55 +01:00
test_legacy_vacuum.py Enable Ruff PT006 (#88165) 2023-02-15 14:09:50 +01:00
test_light.py Fix MQTT rgb light brightness scaling (#89264) 2023-03-09 08:02:59 +01:00
test_light_json.py Improve warnings in mqtt light messages (#89552) 2023-03-13 14:46:16 +01:00
test_light_template.py Enable Ruff PT006 (#88165) 2023-02-15 14:09:50 +01:00
test_lock.py Enable Ruff PT006 (#88165) 2023-02-15 14:09:50 +01:00
test_mixins.py Add missed type hints on MQTT platform tests (#87781) 2023-02-09 15:22:30 +01:00
test_number.py Enable Ruff PT006 (#88165) 2023-02-15 14:09:50 +01:00
test_scene.py Apply registry type hints on mqtt platform tests (#87758) 2023-02-09 11:53:56 +01:00
test_select.py Enable Ruff PT006 (#88165) 2023-02-15 14:09:50 +01:00
test_sensor.py Allow enum as MQTT sensor device_class (#89391) 2023-03-08 22:35:06 +01:00
test_siren.py Enable Ruff PT006 (#88165) 2023-02-15 14:09:50 +01:00
test_state_vacuum.py Enable Ruff PT006 (#88165) 2023-02-15 14:09:50 +01:00
test_subscription.py Apply MQTT fixture types on platform tests (#87722) 2023-02-09 09:48:22 +01:00
test_switch.py Enable Ruff PT006 (#88165) 2023-02-15 14:09:50 +01:00
test_tag.py Apply registry type hints on mqtt platform tests (#87758) 2023-02-09 11:53:56 +01:00
test_text.py Catch exceptions and add logging when writing states on MQTT entities (#89091) 2023-03-06 15:34:47 +01:00
test_trigger.py Apply registry type hints on mqtt platform tests (#87758) 2023-02-09 11:53:56 +01:00
test_update.py Apply registry type hints on mqtt platform tests (#87758) 2023-02-09 11:53:56 +01:00
test_util.py Enable Ruff PT006 (#88165) 2023-02-15 14:09:50 +01:00