forked from Chaospott/Heizberry
Schleifenproblem mit sleep geloest
This commit is contained in:
parent
a410dc90ef
commit
1834211e89
@ -16,7 +16,7 @@ class Zimmer:
|
||||
thermostat = None
|
||||
|
||||
|
||||
zimmer = [Zimmer, Zimmer]
|
||||
zimmer = [Zimmer(), Zimmer()]
|
||||
zimmerName = ["alexander", "wohnzimmer" ]
|
||||
zimmerThermostat = ["00:1A:22:16:4B:B4", "00:1A:22:16:25:C3"]
|
||||
|
||||
@ -44,17 +44,14 @@ def on_message(client, userdata, message):
|
||||
msg = message.payload.decode("utf-8")
|
||||
log.debug('received message: %s from %s', format(msg), format(message.topic))
|
||||
|
||||
if message.topic.split("/", -1)[2] == "heizung":
|
||||
if message.topic.split("/", -1)[3] == "temperatur":
|
||||
for i in zimmer:
|
||||
tmpThermostat = Thermostat(i.thermostat)
|
||||
|
||||
for i in zimmer:
|
||||
tmpThermostat = Thermostat(i.thermostat)
|
||||
if message.topic.split("/", -1)[2] == "heizung":
|
||||
if message.topic.split("/", -1)[3] == "temperatur":
|
||||
if message.topic.split("/", -1)[1] == i.name:
|
||||
tmpThermostat.mode= 3
|
||||
tmpThermostat.target_temperature = round(float(msg),1)
|
||||
|
||||
time.sleep(10)
|
||||
|
||||
sendReadings()
|
||||
|
||||
|
||||
@ -72,8 +69,6 @@ def sendReadings():
|
||||
else:
|
||||
client.publish("zimmer/" + i.name + "/heizung/status", 0, qos=1, retain=True)
|
||||
|
||||
time.sleep(10)
|
||||
|
||||
log.debug('sent readings')
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user