Skip to content

Commit

Permalink
Merge pull request #29 from CyrilP/feature/refresh
Browse files Browse the repository at this point in the history
refresh all data when homeassistant starts
  • Loading branch information
mrwiwi authored Mar 23, 2021
2 parents 4e5c092 + f525eda commit 397b052
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions mqtt_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def on_connect(self, client, flags, rc, properties):
print("##################################")
try:
print("Subscribing to : ", tydom_topic)
# client.subscribe('homeassistant/#', qos=0)
client.subscribe('homeassistant/status', qos=0)
client.subscribe(tydom_topic, qos=0)
except Exception as e:
print("Error on connect : ", e)
Expand All @@ -92,7 +92,8 @@ async def on_message(self, client, topic, payload, qos, properties):
elif (topic == "homeassistant/requests/tydom/scenarii"):
print('Incoming MQTT scenarii request : ', topic, payload)
await self.tydom.get_scenarii()

elif (topic == "homeassistant/status" and payload.decode() == 'online'):
await self.tydom.get_devices_data()
elif (topic == "/tydom/init"):
print('Incoming MQTT init request : ', topic, payload)
await self.tydom.connect()
Expand Down

0 comments on commit 397b052

Please sign in to comment.