forked from Chaospott/Heizberry
topic adaptation
This commit is contained in:
parent
6f81666386
commit
37c0fc4320
@ -18,8 +18,8 @@ class Zimmer:
|
||||
|
||||
|
||||
|
||||
zimmer = [Zimmer(), Zimmer()]
|
||||
zimmerName =["alexander", "wohnzimmer"]
|
||||
zimmer = [Zimmer(), Zimmer(), Zimmer(), Zimmer(), Zimmer(), Zimmer()]
|
||||
zimmerName =["alexander", "wohnzimmer", "badezimmer", "christina", "kueche", "simon"]
|
||||
|
||||
|
||||
for i in range(len(zimmer)):
|
||||
@ -37,8 +37,8 @@ def on_connect(client, userdata, flags, rc):
|
||||
client.subscribe("zimmer/" + i.name + "/heizung/control/automatic")
|
||||
client.subscribe("zimmer/" + i.name + "/heizung/control/temperatur")
|
||||
client.subscribe("zimmer/" + i.name + "/heizung/control/status")
|
||||
client.subscribe("zimmer/" + i.name + "/heizung/temperatur")
|
||||
client.subscribe("zimmer/" + i.name + "/heizung/status")
|
||||
client.subscribe("zimmer/" + i.name + "/heizung/actor/temperatur")
|
||||
client.subscribe("zimmer/" + i.name + "/heizung/actor/status")
|
||||
# client.subscribe("zimmer/" + i.name + "/sensoren/tuer/status")
|
||||
# client.subscribe("zimmer/" + i.name + "/sensoren/fenster/status")
|
||||
# client.subscribe("zimmer/" + i.name + "/sensoren/temperatur")
|
||||
@ -66,7 +66,8 @@ def on_message(client, userdata, message):
|
||||
for i in zimmer:
|
||||
if message.topic.split("/", -1)[1] == i.name:
|
||||
i.temperaturSet = round(float(msg),1)
|
||||
if message.topic.split("/", -1)[3] == "status":
|
||||
if message.topic.split("/", -1)[3] == "actor":
|
||||
if message.topic.split("/", -1)[4] == "status":
|
||||
for i in zimmer:
|
||||
if message.topic.split("/", -1)[1] == i.name:
|
||||
i.statusActual = bool(msg)
|
||||
@ -79,7 +80,7 @@ def sendReadings():
|
||||
for i in zimmer:
|
||||
|
||||
if i.automatic:
|
||||
client.publish("zimmer/" + i.name + "/heizung/temperatur", i.temperaturSet, qos=1, retain=True)
|
||||
client.publish("zimmer/" + i.name + "/heizung/actor/temperatur", i.temperaturSet, qos=1, retain=True)
|
||||
client.publish("zimmer/" + i.name + "/heizung/control/status", i.statusActual, qos=1, retain=True)
|
||||
|
||||
log.debug('sent readings')
|
||||
|
@ -29,8 +29,8 @@ def on_connect(client, userdata, flags, rc):
|
||||
log.debug("Connected with result code " + str(rc))
|
||||
|
||||
for i in zimmer:
|
||||
client.subscribe("zimmer/" + i.name + "/heizung/temperatur")
|
||||
client.subscribe("zimmer/" + i.name + "/heizung/status")
|
||||
client.subscribe("zimmer/" + i.name + "/heizung/actor/temperatur")
|
||||
client.subscribe("zimmer/" + i.name + "/heizung/actor/status")
|
||||
|
||||
sendReadings()
|
||||
|
||||
@ -47,7 +47,8 @@ def on_message(client, userdata, message):
|
||||
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)[3] == "actor":
|
||||
if message.topic.split("/", -1)[4] == "temperatur":
|
||||
if message.topic.split("/", -1)[1] == i.name:
|
||||
tmpThermostat.mode= 3
|
||||
tmpThermostat.target_temperature = round(float(msg),1)
|
||||
@ -65,9 +66,9 @@ def sendReadings():
|
||||
tmpThermostat.update()
|
||||
|
||||
if tmpThermostat.target_temperature > 17.0:
|
||||
client.publish("zimmer/" + i.name + "/heizung/status", 1, qos=1, retain=True)
|
||||
client.publish("zimmer/" + i.name + "/heizung/actor/status", 1, qos=1, retain=True)
|
||||
else:
|
||||
client.publish("zimmer/" + i.name + "/heizung/status", 0, qos=1, retain=True)
|
||||
client.publish("zimmer/" + i.name + "/heizung/actor/status", 0, qos=1, retain=True)
|
||||
|
||||
log.debug('sent readings')
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user