Commit graph

887 commits

Author SHA1 Message Date
Jan Bouwhuis
60ba80a28d
Only (re)subscribe MQTT topics using the debouncer (#119995)
* Only (re)subscribe using the debouncer

* Update test

* Fix test

* Reset mock
2024-06-19 23:57:18 +02:00
Jan Bouwhuis
6eb9d1e01d
Gracefully disconnect MQTT entry if entry is reloaded (#119753) 2024-06-18 09:29:22 +02:00
Paulus Schoutsen
eb89ce47ea
Inline primary integration (#119860) 2024-06-18 08:08:08 +02:00
Jan Bouwhuis
b405e2f03e
Improve logging use of deprecated schema option for mqtt vacuum (#119724) 2024-06-15 16:50:12 +02:00
epenet
27ee204e2f
Fix dangerous-default-value warnings in mqtt tests (#119584) 2024-06-13 16:51:45 +02:00
epenet
0f0c2f0553
Fix redefined-argument-from-local pylint warning in tests (#119475) 2024-06-12 17:58:58 +02:00
epenet
fb1b0058ee
Fix consider-using-tuple pylint warnings in component tests (#119464)
* Fix consider-using-tuple pylint warnings in component tests

* Apply su

Co-authored-by: Michael <35783820+mib1185@users.noreply.github.com>

---------

Co-authored-by: Michael <35783820+mib1185@users.noreply.github.com>
2024-06-12 15:50:27 +02:00
epenet
2c7022950c
Fix import-outside-toplevel pylint warnings in tests (#119389) 2024-06-11 14:57:50 +02:00
Sid
721b2c2ca8
Enable Ruff PT012 (#113957) 2024-06-08 17:59:08 +02:00
Marc Mueller
274cd41d57
Fix Generator annotations in tests (1) (#119018) 2024-06-07 08:43:32 +02:00
Marc Mueller
7195a21126
Fix Generator annotations in tests (2) (#119019) 2024-06-07 08:34:38 +02:00
Marc Mueller
33ed4fd862
Import Generator from typing_extensions (3) (#118990) 2024-06-06 17:28:59 +02:00
J. Nick Koston
67b3be8432
Remove useless threading locks in mqtt (#118737) 2024-06-04 14:21:03 -05:00
epenet
089874f818
Move mock_hass_config fixture to decorator (#118807) 2024-06-04 16:05:56 +02:00
Jan Bouwhuis
e799270578
Recover mqtt abbrevations optimizations (#118762)
Co-authored-by: J. Nick Koston <nick@koston.org>
2024-06-04 06:20:18 +02:00
Jan Bouwhuis
39f5f30ca9
Revert "Allow MQTT device based auto discovery" (#118746)
Revert "Allow MQTT device based auto discovery (#109030)"

This reverts commit 585892f067.
2024-06-03 22:30:37 +02:00
epenet
1db7c7946e
Add type hints for MqttMockHAClient in test fixtures (#118683) 2024-06-03 09:29:15 +02:00
Jan Bouwhuis
375f48142c
Fix handling undecoded mqtt sensor payloads (#118633) 2024-06-02 21:25:05 +02:00
Jan Bouwhuis
585892f067
Allow MQTT device based auto discovery (#109030)
* Add MQTT device based auto discovery

* Respect override of component options over shared ones

* Add state_topic, command_topic, qos and encoding as shared options

* Add shared option test

* Rename device.py to schemas.py

* Remove unused legacy `platform` attribute to avoid confusion

* Split validation device and origin info

* Require `origin` info on device based discovery

* Log origin info for only once for device discovery

* Fix tests and linters

* ruff

* speed up _replace_all_abbreviations

* Fix imports and merging errors - add slots attr

* Fix unrelated const changes

* More unrelated changes

* join string

* fix merge

* Undo move

* Adjust logger statement

* fix task storm to load platforms

* Revert "fix task storm to load platforms"

This reverts commit 8f12a5f251.

* bail if logging is disabled

* Correct mixup object_id and node_id

* Auto migrate entities to device discovery

* Add device discovery test for device_trigger

* Add migration support for non entity platforms

* Use helper to remove discovery payload

* Fix tests after update branch

* Add discovery migration test

* Refactor

* Repair after rebase

* Fix discovery is broken after migration

* Improve comments

* More comment improvements

* Split long lines

* Add comment to indicate payload dict can be empty

* typo

* Add walrus and update comment

* Add tag to migration test

* Join try blocks

* Refactor

* Cleanup not used attribute

* Refactor

* Move _replace_all_abbreviations out of try block

---------

Co-authored-by: J. Nick Koston <nick@koston.org>
2024-05-29 11:12:05 +02:00
G Johansson
6b7ff2bf44
Add default code to alarm_control_panel (#112540) 2024-05-29 10:46:53 +02:00
epenet
98d24dd276
Improve typing for calls fixture in tests (m-z) (#118350)
* Improve typing for `calls` fixture in tests (m-z)

* More

* More
2024-05-29 09:30:41 +02:00
epenet
0f8588a857
Rename calls fixture in mqtt tests (#118354)
Rename calls fixture in mqtt
2024-05-29 09:25:34 +02:00
J. Nick Koston
69353d2719
Speed up mqtt debug info on message callback (#118303) 2024-05-28 11:10:07 -10:00
epenet
ead0e797c1
Use registry fixtures in tests (m-n) (#118291) 2024-05-28 13:40:45 +02:00
Jan Bouwhuis
bfc3194661
Fix mqtt not publishing null payload payload to remove discovery (#118261) 2024-05-27 12:53:22 -10:00
epenet
97f6b578c8
Enforce namespace import in core (#118235) 2024-05-27 14:03:00 +02:00
J. Nick Koston
6b8223e339
Try to read multiple packets in MQTT (#118222) 2024-05-27 11:07:24 +02:00
J. Nick Koston
c15f7f304f
Remove unneeded dispatcher in mqtt discovery (#118205) 2024-05-26 17:07:24 -10:00
J. Nick Koston
226d010ab2
Simplify mqtt connection state dispatcher (#118184) 2024-05-26 10:21:21 -10:00
J. Nick Koston
5d37217d96
Avoid expensive inspection of callbacks to setup mqtt subscriptions (#118161) 2024-05-26 01:22:44 -10:00
J. Nick Koston
9be829ba1f
Make mqtt internal subscription a normal function (#118092)
Co-authored-by: Jan Bouwhuis <jbouwh@users.noreply.github.com>
2024-05-25 11:34:24 -10:00
Jan Bouwhuis
521ed0a220
Fix mqtt callback exception logging (#118138)
* Fix mqtt callback exception logging

* Improve code

* Add test
2024-05-25 22:46:33 +02:00
J. Nick Koston
ad638dbcc5
Speed up removing MQTT subscriptions (#118088) 2024-05-25 10:28:14 +02:00
Jan Bouwhuis
c9a79f6293
Fix lingering mqtt test (#118072) 2024-05-24 14:34:18 -10:00
Jan Bouwhuis
fa1ef8b0cf
Split mqtt subscribe and unsubscribe calls to smaller chunks (#118035) 2024-05-24 13:33:28 -10:00
Jan Bouwhuis
01f3a5a97c
Consequently ignore empty MQTT state payloads and set state to unknown on "None" payload (#117813)
* Consequently ignore empty MQTT state payloads and set state to `unknown` on "None" payload

* Do not change preset mode behavior

* Add device tracker ignoring empty state

* Ignore empty state for lock

* Resolve merge errors
2024-05-25 01:29:43 +02:00
Jan Bouwhuis
f12aee28a8
Improve error logging on invalid MQTT entity state (#118006)
* Improve error logging on invalid MQTT entity state

* Explain not hanlding TpeError and ValueError

* Move length check closer to source

* use _LOGGER.exception
2024-05-24 13:11:52 +02:00
Marc Mueller
dc47792ff2
Update codespell to 2.3.0 (#118001) 2024-05-24 08:22:29 +02:00
Jan Bouwhuis
050fc73056
Refactor shared mqtt schema's to new module (#117944)
* Refactor mqtt schema's to new module

* Remove unrelated change
2024-05-23 01:12:25 +02:00
J. Nick Koston
f429bfa903
Fix mqtt timer churn (#117885)
Borrows the same design from homeassistant.helpers.storage to avoid
rescheduling the timer every time async_schedule is called if a timer
is already running.

Instead of the timer fires too early it gets rescheduled for the time
we wanted it. This avoids 1000s of timer add/cancel during startup
2024-05-21 21:05:33 -04:00
Marc Mueller
1ad8151bd1
Use PEP 695 type alias in tests (#117797) 2024-05-20 19:03:04 +02:00
J. Nick Koston
ac3321cef1
Fix setting MQTT socket buffer size with WebsocketWrapper (#117672) 2024-05-19 14:09:21 -10:00
Jan Bouwhuis
07061b14d0
Fix typo in mqtt test name (#117305) 2024-05-12 16:44:39 +02:00
Jan Bouwhuis
65a4e5a1af
Spelling of controlling in mqtt valve tests (#117301) 2024-05-12 14:06:21 +02:00
Jan Bouwhuis
92254772ca
Increase MQTT broker socket buffer size (#117267)
* Increase MQTT broker socket buffer size

* Revert unrelated change

* Try to increase buffer size

* Set INITIAL_SUBSCRIBE_COOLDOWN back to 0.5 sec

* Sinplify and add test

* comments

* comments

---------

Co-authored-by: J. Nick Koston <nick@koston.org>
2024-05-12 13:13:41 +02:00
J. Nick Koston
481de8cdc9
Ensure config entry operations are always holding the lock (#117214)
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2024-05-12 08:20:08 +09:00
Erik Montnemery
813f97dedc
Rename some MQTT tests (#117246) 2024-05-11 16:57:46 +02:00
Jan Bouwhuis
589104f63d
Export MQTT subscription helpers at integration level (#116150) 2024-05-08 23:46:50 +02:00
Jan Bouwhuis
840d8cb39f
Add open and opening state support to MQTT lock (#117110) 2024-05-08 22:52:57 +02:00
J. Nick Koston
649dd55da9
Simplify MQTT subscribe debouncer execution (#117006) 2024-05-07 14:41:31 -05:00