Skip to content

Commit

Permalink
Fix for alarm pin + Reintroduce MQTT refresh on connect
Browse files Browse the repository at this point in the history
  • Loading branch information
mrwiwi authored May 10, 2021
1 parent d752676 commit 583fc50
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion alarm_control_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ async def setup(self):
self.config['command_topic'] = alarm_command_topic.format(id=self.id)
self.config['state_topic'] = alarm_state_topic.format(id=self.id)
self.config['code'] = self.alarm_pin
if (self.alarm_pin != None):
if (self.alarm_pin == None):
self.config['code_arm_required'] = 'true'
else:
self.config['code_arm_required'] = 'false'
Expand Down
4 changes: 3 additions & 1 deletion mqtt_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ def on_connect(self, client, flags, rc, properties):
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 @@ -93,7 +94,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 583fc50

Please sign in to comment.