This commit is contained in:
Merlin Raschtuttis 2019-04-08 18:08:13 +00:00
parent 8de302fe8c
commit bb9b2649ec

View File

@ -230,6 +230,12 @@ def msgs(inp, topic):
return return
def send_state():
for i in range(len(state)):
try:
mqtc.publish("foobar/aerie/" + names[i][0] + "/" + services[names[i][1]] + "/status", states[state[i]])
except KeyError:
pass
def init_mqtt(): def init_mqtt():
mqtc.connect("10.42.0.244", 1883, 60) mqtc.connect("10.42.0.244", 1883, 60)
mqtc.subscribe("foobar/aerie/licht", 0) mqtc.subscribe("foobar/aerie/licht", 0)
@ -254,7 +260,8 @@ def init_mqtt():
# mqtc.loop_forever() # mqtc.loop_forever()
#except: #except:
# pass # pass
time.sleep(2) time.sleep(60)
send_state()
init_mqtt() init_mqtt()