Closed emontnemery closed 2 years ago
Hello @emontnemery , thank you very much for hinting at this. While fixing my code I've also found the '@bind_hass' decorator was removed to both the 'sync' and 'async' publish functions while it reamains on other signatures like async_subscribe for instance. Is this just a temporary inconsistency ? or maybe there's something bigger behind my overall weak knowledge of the core api? I'm asking since I would like to implement a stable (the most) update to my code Thank you
We don't promote the @bind_hass
decorator anymore as calling a function via the hass objects prevents most linters from doing their job. The change to mqtt.async_publish
was anyway a breaking change so I removed the @bind_hass
from the changed functions.
mqtt.async_publish
is a couroutine in HA core 2021.12: home-assistant/core#58441This can be solved as suggested here: https://github.com/blakeblackshear/frigate-hass-integration/pull/166
If
mqtt.async_publish
is called from a non-coroutine, usehass.async_create_task
if it's not practical to convert the caller to a coroutine: