set retain flag to true

This commit is contained in:
Christian 2017-10-20 18:18:01 +02:00
parent 43315a1d88
commit d349e9a317

View File

@ -19,10 +19,10 @@ def on_connect(client, userdata, flags, rc):
log.debug("Connected with result code " + str(rc))
beamer_state = readBeamerState()
client.publish("foobar/oben/lounge/beamer/status", beamer_state, qos=1)
client.publish("foobar/oben/lounge/beamer/status", beamer_state, qos=1, retain=True)
input_source = readInputSource()
client.publish("foobar/oben/lounge/beamer/source", input_source, qos=1)
client.publish("foobar/oben/lounge/beamer/source", input_source, qos=1, retain=True)
client.subscribe("foobar/oben/lounge/beamer/action")
@ -117,8 +117,8 @@ def getArgs():
def periodicUpdate():
log.debug('run scheduled statusupdates')
client.publish("foobar/oben/lounge/beamer/status", readBeamerState(), qos=1)
client.publish("foobar/oben/lounge/beamer/source", readInputSource(), qos=1)
client.publish("foobar/oben/lounge/beamer/status", readBeamerState(), qos=1, retain=True)
client.publish("foobar/oben/lounge/beamer/source", readInputSource(), qos=1, retain=True)
if __name__ == '__main__':
@ -161,9 +161,9 @@ if __name__ == '__main__':
if (inputSourceChanged()):
client.publish("foobar/oben/lounge/beamer/source",
input_source, qos=1)
input_source, qos=1, retain=True)
if (beamerStatusChanged()):
client.publish("foobar/oben/lounge/beamer/status",
beamer_state, qos=1)
beamer_state, qos=1, retain=True)
time.sleep(1)