1
0
mirror of https://github.com/home-assistant/core.git synced 2025-06-14 01:57:09 +00:00

128 Commits

Author SHA1 Message Date
Marc Mueller
b936739917
Update pylint to 3.3.6 () 2025-03-21 00:33:16 +01:00
Jan Bouwhuis
6284a83a34
Fix client_id not generated when connecting to the MQTT broker ()
Fix client_id not generated when connecting to the MQTT broker
2025-03-10 11:04:49 +01:00
skobow
f8ffbf0506
Set clean_start=True on connect to MQTT broker ()
* Addresses : Set  on connect.

* Make clean start implementation compatible with v2 API

* Add tests

* Do not pass default value for `clean_start` on_connect

* Revert "Do not pass default value for `clean_start` on_connect"

This reverts commit 75806736cf511a6d6b6496454843de34f05f7758.

* Use partial top pass kwargs to mqtt client connect

---------

Co-authored-by: Jan Bouwhuis <jbouwh@users.noreply.github.com>
Co-authored-by: jbouwh <jan@jbsoft.nl>
2025-02-18 23:11:21 +01:00
Jan Bouwhuis
d6b7762dd6
Upgrade paho-mqtt API to v2 ()
* Upgrade paho-mqtt API to v2

* Refactor on_connect callback

* Add tests

* Fix Tasmota tests
2025-02-13 22:13:19 +01:00
Jan Bouwhuis
7fa6f7e875
Bump paho-mqtt client to version 2.1.0 ()
* Bump paho-mqtt client to version 2.1.0

* Remove commented code

* Bump pyeconet==0.1.26

* Ensure types-paho-mqtt==1.6.0.20240321 is uninstalled if test requirements are updated

* Update roombapy dependency

* Remove pyeconet from exceptions list

* Revert changes to install test requirements task
2025-02-04 20:59:28 +01:00
epenet
aa741a9207
Combine short strings in components () 2025-01-10 11:07:51 +01:00
J. Nick Koston
4e316429d3
Handle WebsocketConnectionError during mqtt auto reconnect ()
followup to  to handle the exception in the auto reconnect
path as well

fixes 
2024-12-21 11:18:47 +01:00
J. Nick Koston
551a584ca6
Handle mqtt.WebsocketConnectionError when connecting to the MQTT broker ()
fixes 
2024-12-19 21:39:39 +01:00
Marc Mueller
dc8b7cfede
Allow bytearray for mqtt payload type () 2024-12-11 11:51:16 +01:00
Jan Bouwhuis
8f43a71ff6
Ensure MQTT subscriptions can be made when the broker is disconnected () 2024-12-04 15:18:04 +01:00
Jan Bouwhuis
47aebabc51
Add final translations to mqtt exceptions () 2024-12-01 12:20:45 +01:00
Jan Bouwhuis
1773f2aadc
Allow MQTT device based auto discovery ()
* Allow MQTT device based auto discovery

* Fix merge error

* Remove unused import

* Fix discovery device based topics

* Fix cannot delete twice

* Improve cleanup test

* Follow up comment

* Typo

Co-authored-by: Erik Montnemery <erik@montnemery.com>

* Explain more

* Use tuple

* Default a device payload to have priority over a platform based payload

* Add unique_id to sensor test data

* Set migration flag to mark a discovery topic for migration

* Correct type hint

* Make unique_id required for components in device based discovery payload

* Remove CONF_MIGRATE_DISCOVERY from platform schema

* Unload discovered MQTT item to allow migration

* Follow up comments from code review

* ruff

* Subscribe to platform discovery wildcards first

* Use normal dict

* Use dict to persist wildcard subscription order

* Remove missed unused parameter

* Add a comment to explain we use a dict  to preserve the subscription order

* Add wildcard subscription order test

* Remove discovery flag from test

* Improve discovery migration origin logging

* Assert initial  wildcard discovery topics subscription order and after reconnect

* Improve log messages

---------

Co-authored-by: Erik Montnemery <erik@montnemery.com>
2024-10-30 17:10:15 +01:00
Jan Bouwhuis
b74aced6f3
Subscribe per component for MQTT discovery ()
* Subscribe per component for MQTT discovery

* Use single assignment

* Handle wildcard subscriptions first

* Split subsRecription handling, update helper

* Fix help_all_subscribe_calls

* Fix import

* Fix test

* Update import order

* Undo move self._last_subscribe

* Recover removed test

* Revert not needed changes to binary_sensor platform tests

* Revert line removal

* Rework interation of discovery topics

* Reduce

* Add comment

* Move comment

* Chain subscriptions
2024-08-20 17:02:48 +02:00
Jan Bouwhuis
87e377cf84
Ensure mqtt subscriptions are in a set () 2024-07-21 12:36:06 +02:00
Marc Mueller
ca55986057
Import Generator from collections.abc (1) () 2024-07-01 11:51:51 +02:00
J. Nick Koston
8f98fb2ec4
Fix publish cancellation handling in MQTT () 2024-06-29 11:06:56 -05:00
Jan Bouwhuis
1d16cbec96
Move mqtt debouncer to mqtt utils () 2024-06-25 10:33:58 +02:00
Marc Mueller
f0452e9ba0
Update mypy dev 1.11.0a8 () 2024-06-21 13:15:18 +02:00
Jan Bouwhuis
60ba80a28d
Only (re)subscribe MQTT topics using the debouncer ()
* 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 () 2024-06-18 09:29:22 +02:00
Jan Bouwhuis
a992654a8b
Fix blocking IO calls in mqtt client setup () 2024-06-13 17:47:38 -05:00
Marc Mueller
fe21e2b8ba
Import Generator from typing_extensions (1) () 2024-06-06 17:02:13 +02:00
J. Nick Koston
67b3be8432
Remove useless threading locks in mqtt () 2024-06-04 14:21:03 -05:00
J. Nick Koston
9cb113e5d4
Convert mqtt to use a timer instead of task sleep loop () 2024-06-03 11:19:19 -05:00
J. Nick Koston
1743d1700d
Ensure paho.mqtt.client is imported in the executor ()
fixes 
2024-05-29 15:55:34 -04:00
Jan Bouwhuis
bfc3194661
Fix mqtt not publishing null payload payload to remove discovery () 2024-05-27 12:53:22 -10:00
J. Nick Koston
6b8223e339
Try to read multiple packets in MQTT () 2024-05-27 11:07:24 +02:00
J. Nick Koston
21b9a4ef2e
Increase MQTT incoming buffer to 8MiB () 2024-05-27 10:07:53 +02:00
J. Nick Koston
3ebcee9bbb
Fix mqtt chunk subscribe logging () 2024-05-26 21:56:09 -10:00
J. Nick Koston
226d010ab2
Simplify mqtt connection state dispatcher () 2024-05-26 10:21:21 -10:00
J. Nick Koston
5d37217d96
Avoid expensive inspection of callbacks to setup mqtt subscriptions () 2024-05-26 01:22:44 -10:00
J. Nick Koston
9be829ba1f
Make mqtt internal subscription a normal function ()
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 ()
* Fix mqtt callback exception logging

* Improve code

* Add test
2024-05-25 22:46:33 +02:00
Marc Mueller
2f16c3aa80
Fix mqtt callback typing () 2024-05-25 18:59:29 +02:00
J. Nick Koston
de275878c4
Small speed up to mqtt _async_queue_subscriptions () 2024-05-25 12:32:15 +02:00
J. Nick Koston
4da125e27b
Simplify mqtt discovery cooldown calculation () 2024-05-24 23:27:22 -10:00
J. Nick Koston
ad638dbcc5
Speed up removing MQTT subscriptions () 2024-05-25 10:28:14 +02:00
J. Nick Koston
90d10dd773
Use defaultdict instead of setdefault in mqtt client () 2024-05-24 14:34:06 -10:00
J. Nick Koston
3031e4733b
Reduce duplicate code to handle mqtt message replies () 2024-05-24 14:33:21 -10:00
J. Nick Koston
c7a1c59215
Avoid catch_log_exception overhead in MQTT for simple callbacks () 2024-05-24 14:32:32 -10:00
J. Nick Koston
65a702761b
Avoid generating matchers that will never be used in MQTT () 2024-05-24 14:04:03 -10:00
Jan Bouwhuis
fa1ef8b0cf
Split mqtt subscribe and unsubscribe calls to smaller chunks () 2024-05-24 13:33:28 -10:00
J. Nick Koston
4e3c4400a7
Refactor MQTT to replace get_mqtt_data with HassKey () 2024-05-21 23:21:51 -10:00
J. Nick Koston
f429bfa903
Fix mqtt timer churn ()
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
J. Nick Koston
fe769c4527
Fix missing type for mqtt websocket wrapper () 2024-05-20 09:32:50 +02:00
J. Nick Koston
ac3321cef1
Fix setting MQTT socket buffer size with WebsocketWrapper () 2024-05-19 14:09:21 -10:00
Marc Mueller
87bb7ced79
Use PEP 695 for simple type aliases () 2024-05-17 14:42:21 +02:00
Jan Bouwhuis
92254772ca
Increase MQTT broker socket buffer size ()
* 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
Jan Bouwhuis
96ccf7f2da
Log some mqtt of the discovery logging at debug level () 2024-05-10 14:49:27 +02:00
J. Nick Koston
649dd55da9
Simplify MQTT subscribe debouncer execution () 2024-05-07 14:41:31 -05:00