Skip to content

Commit

Permalink
Fix for HA 2022.3.7
Browse files Browse the repository at this point in the history
* New async_subscribe_topics() signature
* mqtt.async_publish() become coroutine
  • Loading branch information
elbowz committed Mar 29, 2022
1 parent 4d101e2 commit e004308
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions homie/homie/component.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,12 @@ async def async_setup(self):
name: {**sub_base, **value} for (name, value) in sub_topics.items()
}

self._sub_state = await subscription.async_subscribe_topics(
self._sub_state = subscription.async_prepare_subscribe_topics(
self._hass, self._sub_state, sub_topics
)

await subscription.async_subscribe_topics(self._hass, self._sub_state)

async def async_unsubscribe_topics(self):
self._sub_state = await subscription.async_unsubscribe_topics(
self._hass, self._sub_state
Expand Down Expand Up @@ -253,7 +255,7 @@ def _call_subscribers(self, *attrs, **kwargs):
async def async_set(self, value: str):
"""Set the state of the Property."""
if self.settable:
mqtt.async_publish(
await mqtt.async_publish(
self._hass, f"{self.base_topic}/set", value, self._qos, retain=True
)

Expand Down

0 comments on commit e004308

Please sign in to comment.