1
0
mirror of https://github.com/home-assistant/core.git synced 2025-06-23 14:37:07 +00:00

106 Commits

Author SHA1 Message Date
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
Jan Bouwhuis
a3248ccff9
Log an exception mqtt client call back throws ()
* Log an exception mqtt client call back throws

* Supress exceptions and add test
2024-05-07 21:19:46 +02:00
Jan Bouwhuis
7148c849d6
Only log loop client subscription log if log level is DEBUG ()
Co-authored-by: J. Nick Koston <nick@koston.org>
2024-05-07 18:38:59 +02:00
Sid
2cc916db6d
Replace pylint broad-except with Ruff BLE001 () 2024-05-07 14:00:27 +02:00
Jan Bouwhuis
4b8b9ce92d
Fix initial mqtt subcribe cooldown timeout () 2024-05-06 14:32:37 +02:00
J. Nick Koston
041456759f
Remove duplicate mid handling in MQTT () 2024-05-01 15:18:44 -05:00
Jan Bouwhuis
7fd60ddba4
Fix MQTT discovery cooldown too short with large setup ()
* Fix MQTT discovery cooldown too short with large setup

* Set to 5 sec

* Only change the discovery cooldown

* Fire immediatly when teh debouncing period is over
2024-05-01 21:19:55 +02:00
J. Nick Koston
25df41475a
Simplify MQTT mid handling ()
* Simplify MQTT mid handling

switch from asyncio.Event to asyncio.Future

* preen

* preen

* preen
2024-05-01 11:03:10 -05:00
J. Nick Koston
2ad6353bf8
Fix stop event cleanup when reloading MQTT () 2024-05-01 10:22:50 -05:00
J. Nick Koston
2e9b1916c0
Ensure MQTT resubscribes happen before birth message () 2024-04-30 22:31:40 +02:00
Jan Bouwhuis
43dc5415de
Fix no will published when mqtt is down () 2024-04-27 18:42:38 -05:00
Jan Bouwhuis
372c6c7874
Use existing monotonic timestamp on mqtt messages for debugging () 2024-04-25 19:09:54 -05:00
Jan Bouwhuis
31d11b2362
Add re-auth flow for MQTT broker username and password ()
Co-authored-by: J. Nick Koston <nick@koston.org>
2024-04-23 22:26:01 +02:00
J. Nick Koston
0ed56694b0
Migrate MQTT EnsureJobAfterCooldown to use eager start () 2024-04-22 20:09:45 +02:00
J. Nick Koston
423544401e
Convert MQTT to use asyncio () 2024-04-21 22:33:58 +02:00
Sid
0d66d298ec
Enable Ruff RET504 ()
* Enable Ruff RET504

* fix test

* Use noqa instead of cast

* fix sonos RET504

---------

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2024-04-06 11:07:37 +02:00
J. Nick Koston
3d8a110908
Dispatch the same ReceiveMessage object if the subscription topic is the same () 2024-04-03 09:36:57 -10:00
Jan Bouwhuis
488dae43d4
Improve lists for MQTT integration ()
* 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
Marc Mueller
59a6035d3f
Add empty line after module docstring [j-m] () 2024-03-08 09:01:29 -05:00
Marc Mueller
a9147cf3dd
Use builtin TimeoutError [k-n] () 2024-02-05 12:08:18 +01:00
J. Nick Koston
5c3bf13ca4
Only decode msg topic once when handling mqtt payloads () 2024-02-01 03:42:58 +01:00
Jan Bouwhuis
677b06f502
Add comment to explain not using the core API in MQTT client () 2024-01-27 02:05:31 -10:00
J. Nick Koston
4b7a313ece
Use identity checks for CoreState ()
Some of the checks used ==, and some used is. Switch
everything to is as its faster
2024-01-12 10:21:26 +01:00