Skip to content

Commit

Permalink
MQTT breaking changes fix
Browse files Browse the repository at this point in the history
According to the docs firs we have to use `async_prepare_subscribe_topics` in the same way as `async_prepare_subscribe_topics` before, then we have to call `async_prepare_subscribe_topics` in order to perform the subscription.
  • Loading branch information
hristo-atanasov authored Mar 4, 2022
1 parent 4ade285 commit 246fa9b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion custom_components/tasmota_irhvac/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -652,7 +652,7 @@ async def state_message_received(msg):
state = self.hass.states.get(self._power_sensor)
await self._async_power_sensor_changed(self._power_sensor, None, state)

self._sub_state = await mqtt.subscription.async_subscribe_topics(
self._sub_state = mqtt.subscription.async_prepare_subscribe_topics(
self.hass,
self._sub_state,
{
Expand All @@ -664,6 +664,11 @@ async def state_message_received(msg):
},
)

self._sub_state = await mqtt.subscription.async_subscribe_topics(
self.hass,
self._sub_state
)

async def async_will_remove_from_hass(self):
"""Unsubscribe when removed."""
self._sub_state = await mqtt.subscription.async_unsubscribe_topics(
Expand Down

0 comments on commit 246fa9b

Please sign in to comment.