Commit graph

834 commits

Author SHA1 Message Date
Jan Bouwhuis
bedd5c1cef
Cleanup removed MQTT broker settings (#116633) 2024-05-02 20:37:21 +02:00
J. Nick Koston
041456759f
Remove duplicate mid handling in MQTT (#116531) 2024-05-01 15:18:44 -05:00
J. Nick Koston
6cf1c5c1f2
Hold a lock to prevent concurrent setup of config entries (#116482) 2024-04-30 18:47:12 -05:00
Jan Bouwhuis
3c7cbf5794
Add test MQTT subscription is completed when birth message is sent (#116476) 2024-04-30 18:15:46 -05:00
epenet
ad84ff18eb
Use remove_device helper in tests (1/2) (#116240)
* Use remove_device helper in tests

* Update test_tag.py

* Update test_tag.py
2024-04-30 12:52:33 +02:00
Jan Bouwhuis
43dc5415de
Fix no will published when mqtt is down (#116319) 2024-04-27 18:42:38 -05:00
Jan Bouwhuis
372c6c7874
Use existing monotonic timestamp on mqtt messages for debugging (#116196) 2024-04-25 19:09:54 -05:00
Jan Bouwhuis
18132916fa
Mask current password in MQTT option flow (#116098)
* Mask current password in MQTT option flow

* Update docstr

* Typo
2024-04-24 13:29:42 +02:00
Jan Bouwhuis
31d11b2362
Add re-auth flow for MQTT broker username and password (#116011)
Co-authored-by: J. Nick Koston <nick@koston.org>
2024-04-23 22:26:01 +02:00
Marc Mueller
a0314cddd4
Fix invalid tuple annotations (#116035) 2024-04-23 16:02:16 +02:00
J. Nick Koston
0ed56694b0
Migrate MQTT EnsureJobAfterCooldown to use eager start (#115977) 2024-04-22 20:09:45 +02:00
Sid
895f73d8e4
Enable Ruff A001 (#115654) 2024-04-21 23:25:27 +02:00
J. Nick Koston
423544401e
Convert MQTT to use asyncio (#115910) 2024-04-21 22:33:58 +02:00
Jan Bouwhuis
8275512130
Add mqtt notify platform (#115653)
* Add mqtt notify platform

* Stale docstring
2024-04-17 20:07:11 +02:00
Sid
3efee10b95
Enable Ruff RUF013 (#115333) 2024-04-10 08:55:59 +02:00
epenet
0b01326f9f
Use is in ConfigEntryState enum comparison in tests (A-M) (#114925) 2024-04-05 17:16:55 +02:00
Joost Lekkerkerker
b9281327c4
Use FlowResultType enum in config flow tests A-M (#114681) 2024-04-03 09:21:17 +02:00
Joost Lekkerkerker
5d500cb74b
Use is in enum comparison in config flow tests K-O (#114672) 2024-04-02 11:21:42 -10:00
Sid
d5f883fbf0
Unignore Ruff PLR in tests (#114470)
* Unignore Ruff PLR in tests

* Address review comments

* review comments

* fix import

* Update test_api.py

* Update test_api.py

* Update test_api.py
2024-04-01 11:11:59 +02:00
Jan Bouwhuis
5e3ce80488
Remove stale test for mqtt climate (#114443) 2024-03-29 16:01:50 +01:00
Marc Mueller
443bfee16d
Replace partial annotations (#114177) 2024-03-28 18:33:39 +01:00
Jan-Philipp Benecke
22b14d83e8
Use setup_test_component_platform helper for sensor entity component tests instead of hass.components (#114316)
* Use `setup_test_component_platform` helper for sensor entity component tests instead of `hass.components`

* Missing file

* Fix import

* Remove invalid device class
2024-03-28 12:07:55 +01:00
Joost Lekkerkerker
6bb4e7d62c
Bump ruff to 0.3.4 (#112690)
Co-authored-by: Sid <27780930+autinerd@users.noreply.github.com>
Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
Co-authored-by: J. Nick Koston <nick@koston.org>
2024-03-26 00:02:16 +01:00
Jan Bouwhuis
18174ad47d
Improve test coverage mqtt discovery test (#114188) 2024-03-25 22:41:11 +01:00
Marc Mueller
9b7cc088be
Fix spelling [runtime] (#114169) 2024-03-25 11:32:50 +01:00
Erik Montnemery
426f73b1f4
Add State.last_reported (#113511)
* Add State.last_reported

* Update tests

* Update test snapshots

* Call state_reported listeners when firing state_changed event

* Add tests
2024-03-20 21:05:07 +01:00
Jan Bouwhuis
3dc8df2403
Get ServiceValidationError message from translation cache only (#113704)
* Get ServiceValidationError message from translation cache only

* Remove message for NotValidPresetModeError
2024-03-18 14:42:21 +01:00
Sid
d5fd005db8
Add ruff rule PIE808 (#113621) 2024-03-17 09:56:26 +01:00
Sid
b261f124d6
fix mqtt siren test asserts (#113550) 2024-03-15 21:59:30 +01:00
soonsouth
cfc2f17f35
Remove repetitive words in comments and docstrings (#113529)
chore: remove repetitive words

Signed-off-by: soonsouth <cuibuwei@163.com>
2024-03-15 18:11:12 +01:00
J. Nick Koston
c1f5c7c4b7
Remove usage of async_add_job in tests (#113259) 2024-03-13 19:33:33 -10:00
Joost Lekkerkerker
595d07f1c6
Improve lists in integrations [L-M] (#113227)
* Improve lists in integrations [L-M]

* Update homeassistant/components/mailbox/__init__.py

Co-authored-by: Jan Bouwhuis <jbouwh@users.noreply.github.com>

* Fix

---------

Co-authored-by: Jan Bouwhuis <jbouwh@users.noreply.github.com>
2024-03-13 21:28:21 +01:00
Jan Bouwhuis
488dae43d4
Improve lists for MQTT integration (#113184)
* Improve lists for MQTT integration

* Extra diagnostics tests

* Revert changes where the original version was probably faster

* Revert change to gather and await in series
2024-03-13 11:04:59 +01:00
Jan Bouwhuis
e28d4f0eae
Validate state_class with last_reset_value_template for mqtt sensors (#113099) 2024-03-12 09:08:03 +01:00
Joost Lekkerkerker
cddce0ce0d
Enable more SIM ruff rules (#113015)
* SIM101 SIM103

* SIM107 SIM109

* SIM110

* SIM112 SIM113

* SIM115

* SIM116

* Fix

* Fix

* Fix
2024-03-10 23:20:37 -04:00
Jan Bouwhuis
02ef7ba134
Remove not needed hass.async_block_till_done in test (#113002) 2024-03-10 09:46:25 -10:00
Jan Bouwhuis
c608d1cb85
Fix mqtt platform setup race (#112888) 2024-03-10 08:36:17 -10:00
Jan Bouwhuis
caaa03536b
Cleanup mqtt PLATFORMS constant and CI-test platform filters (#112847) 2024-03-09 23:48:54 +01:00
Jan Bouwhuis
3b0ea52167
Allow Just-in-Time platform setup for mqtt (#112720)
* Allow Just-in-Time platform setup for mqtt

* Only forward the setup of new platforms

* Fix new  platforms being setup at reload + test

* Revert not related changes

* Remove unused partial

* Address comments, only import plaforms if needed

* Apply suggestions from code review

* Add multipl platform discovery test

* Improve test

* Use a lock per platform
2024-03-09 21:55:00 +01:00
Jan Bouwhuis
6534943837
Revert "Cleanup mqtt discovery code" (#112818)
Revert "Cleanup mqtt discovery code (#112749)"

This reverts commit 87318c9111.
2024-03-09 12:54:10 +01:00
Jan Bouwhuis
87318c9111
Cleanup mqtt discovery code (#112749)
* Cleanup mqtt discovery code

* Cleanup mqtt discovery code
2024-03-09 11:54:27 +01:00
Marc Mueller
959826c4b4
Update byte string formatting (#112752) 2024-03-08 20:32:40 +01:00
Marc Mueller
32f3f46542
Add empty line after module docstring (2) [tests.components] (#112737) 2024-03-08 19:16:21 +01:00
Marc Mueller
1722e23df8
Add empty line after module docstring [tests l-p] (#112710) 2024-03-08 14:55:15 +01:00
Jan Bouwhuis
0c2cf881ac
Deprecate old config options for MQTT json light (#111676)
* add deprecaction

* Deprecate old config options for mqtt json light

* Do not deprecate brightness flag

* Enable brightness support by default

* Keep `false` as default for brightness flag

* Add warnings and register issue

* log warning and register on use of color_mode flag

* Remove redundant cv.deprecated logging + follow up comments
2024-03-05 08:49:05 +01:00
Jan Bouwhuis
c13231fc00
Improve mqtt value template error logging (#110492)
* Refactor mqtt value template error logging

* Remove import
2024-03-04 08:49:12 +01:00
Jan Bouwhuis
1b2e669302
Improve handling mqtt command template exceptions (#110499)
* Improve handling mqtt command template exceptions

* Fix test

* Cleanup stale exception handler

* Throw on topic template exception
2024-02-26 11:04:55 +01:00
J. Nick Koston
5b8591ec7e
Avoid reschedule churn in Storage.async_delay_save (#111091)
* Avoid circular import in Storage.async_delay_save

We call Storage.async_delay_save for every entity being added or removed
from the registry. The late import took more time than everything else
in the function.

* Avoid reschedule churn in Storage.async_delay_save

When we are adding or removing entities we will call async_delay_save
quite often which has to add and remove a TimerHandle on the event loop
which can add up when there are a lot of registry items changing.

If the timer handle still has 80% of the time remaining on it
we will avoid resceduling and let it fire at the time the
original async_delay_save call was made. This ensures we
do not force the event loop to rebuild its heapq because
too many timer handlers were cancelled at once

* div0

* add coverage for 0 since we had none

* fix bad conflict

* tweaks

* tweaks

* tweaks

* tweaks

* tweaks

* tweaks

* more test fixes

* mqtt tests rely on event loop overhead
2024-02-24 08:46:00 +01:00
Jan Bouwhuis
c048b840fc
Do not directly call async_setup_entry in MQTT tests (#111010) 2024-02-21 07:47:30 +01:00
Jan Bouwhuis
f4fd3633b4
Improve timing mqtt integration discovery test (#110960)
* Improve timing mqtt integration discovery test

* Remove condition
2024-02-19 20:16:06 +01:00