ThermIQ / thermiq_mqtt-ha

Home Assistant integration of ThermIQ-MQTT, providing control and logging of Thermia heatpumps
https://thermiq.net
MIT License
23 stars 19 forks source link

Adapt to changed mqtt.async_publish in Home Assistant 2021.12 #4

Closed emontnemery closed 2 years ago

emontnemery commented 2 years ago

mqtt.async_publish is a couroutine in HA core 2021.12: home-assistant/core#58441

This is a breaking change, and the custom component will stop working if not adapted. This 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, use hass.async_create_task if it's not practical to convert the caller to a coroutine:

hass.async_create_task(mqtt.async_publish(hass, topic, payload))
ThermIQ commented 2 years ago

Updated using suggested solution: ass.async_create_task(mqtt.async_publish(hass, topic, payload))