forked from Chaospott/Heizberry
translate from Denglish to only english
This commit is contained in:
parent
37c0fc4320
commit
afae8b4016
@ -10,38 +10,38 @@ import schedule
|
|||||||
import paho.mqtt.client as mqtt
|
import paho.mqtt.client as mqtt
|
||||||
|
|
||||||
|
|
||||||
class Zimmer:
|
class Room:
|
||||||
name = None
|
name = None
|
||||||
automatic = None
|
automatic = None
|
||||||
temperaturSet = None
|
temperatureSet = None
|
||||||
statusActual = None
|
statusActual = None
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
zimmer = [Zimmer(), Zimmer(), Zimmer(), Zimmer(), Zimmer(), Zimmer()]
|
rooms = [Room(), Room(), Room(), Room(), Room(), Room()]
|
||||||
zimmerName =["alexander", "wohnzimmer", "badezimmer", "christina", "kueche", "simon"]
|
roomName =["alexander", "livingroom", "bathroom", "christina", "kitchen", "simon"]
|
||||||
|
|
||||||
|
|
||||||
for i in range(len(zimmer)):
|
for i in range(len(rooms)):
|
||||||
zimmer[i].name = zimmerName[i]
|
rooms[i].name = roomName[i]
|
||||||
zimmer[i].automatic = 0
|
rooms[i].automatic = 0
|
||||||
zimmer[i].temperaturSet = 0.0
|
rooms[i].temperatureSet = 0.0
|
||||||
zimmer[i].statusActual = 0
|
rooms[i].statusActual = 0
|
||||||
|
|
||||||
|
|
||||||
def on_connect(client, userdata, flags, rc):
|
def on_connect(client, userdata, flags, rc):
|
||||||
log.debug("Connected with result code " + str(rc))
|
log.debug("Connected with result code " + str(rc))
|
||||||
|
|
||||||
for i in zimmer:
|
for i in rooms:
|
||||||
|
|
||||||
client.subscribe("zimmer/" + i.name + "/heizung/control/automatic")
|
client.subscribe("room/" + i.name + "/heating/control/automatic")
|
||||||
client.subscribe("zimmer/" + i.name + "/heizung/control/temperatur")
|
client.subscribe("room/" + i.name + "/heating/control/temperature")
|
||||||
client.subscribe("zimmer/" + i.name + "/heizung/control/status")
|
client.subscribe("room/" + i.name + "/heating/control/status")
|
||||||
client.subscribe("zimmer/" + i.name + "/heizung/actor/temperatur")
|
client.subscribe("room/" + i.name + "/heating/actor/temperature")
|
||||||
client.subscribe("zimmer/" + i.name + "/heizung/actor/status")
|
client.subscribe("room/" + i.name + "/heating/actor/status")
|
||||||
# client.subscribe("zimmer/" + i.name + "/sensoren/tuer/status")
|
# client.subscribe("room/" + i.name + "/sensoren/tuer/status")
|
||||||
# client.subscribe("zimmer/" + i.name + "/sensoren/fenster/status")
|
# client.subscribe("room/" + i.name + "/sensoren/fenster/status")
|
||||||
# client.subscribe("zimmer/" + i.name + "/sensoren/temperatur")
|
# client.subscribe("room/" + i.name + "/sensoren/temperature")
|
||||||
|
|
||||||
sendReadings()
|
sendReadings()
|
||||||
|
|
||||||
@ -56,19 +56,19 @@ def on_message(client, userdata, message):
|
|||||||
msg = message.payload.decode("utf-8")
|
msg = message.payload.decode("utf-8")
|
||||||
log.debug('received message: %s from %s', format(msg), format(message.topic))
|
log.debug('received message: %s from %s', format(msg), format(message.topic))
|
||||||
|
|
||||||
if message.topic.split("/", -1)[2] == "heizung":
|
if message.topic.split("/", -1)[2] == "heating":
|
||||||
if message.topic.split("/", -1)[3] == "control":
|
if message.topic.split("/", -1)[3] == "control":
|
||||||
if message.topic.split("/", -1)[4] == "automatic":
|
if message.topic.split("/", -1)[4] == "automatic":
|
||||||
for i in zimmer:
|
for i in rooms:
|
||||||
if message.topic.split("/", -1)[1] == i.name:
|
if message.topic.split("/", -1)[1] == i.name:
|
||||||
i.automatic = bool(msg)
|
i.automatic = bool(msg)
|
||||||
if message.topic.split("/", -1)[4] == "temperatur":
|
if message.topic.split("/", -1)[4] == "temperature":
|
||||||
for i in zimmer:
|
for i in rooms:
|
||||||
if message.topic.split("/", -1)[1] == i.name:
|
if message.topic.split("/", -1)[1] == i.name:
|
||||||
i.temperaturSet = round(float(msg),1)
|
i.temperatureSet = round(float(msg),1)
|
||||||
if message.topic.split("/", -1)[3] == "actor":
|
if message.topic.split("/", -1)[3] == "actor":
|
||||||
if message.topic.split("/", -1)[4] == "status":
|
if message.topic.split("/", -1)[4] == "status":
|
||||||
for i in zimmer:
|
for i in rooms:
|
||||||
if message.topic.split("/", -1)[1] == i.name:
|
if message.topic.split("/", -1)[1] == i.name:
|
||||||
i.statusActual = bool(msg)
|
i.statusActual = bool(msg)
|
||||||
|
|
||||||
@ -77,11 +77,11 @@ def on_message(client, userdata, message):
|
|||||||
|
|
||||||
def sendReadings():
|
def sendReadings():
|
||||||
|
|
||||||
for i in zimmer:
|
for i in rooms:
|
||||||
|
|
||||||
if i.automatic:
|
if i.automatic:
|
||||||
client.publish("zimmer/" + i.name + "/heizung/actor/temperatur", i.temperaturSet, qos=1, retain=True)
|
client.publish("room/" + i.name + "/heating/actor/temperature", i.temperatureSet, qos=1, retain=True)
|
||||||
client.publish("zimmer/" + i.name + "/heizung/control/status", i.statusActual, qos=1, retain=True)
|
client.publish("room/" + i.name + "/heating/control/status", i.statusActual, qos=1, retain=True)
|
||||||
|
|
||||||
log.debug('sent readings')
|
log.debug('sent readings')
|
||||||
|
|
||||||
|
@ -11,26 +11,26 @@ import paho.mqtt.client as mqtt
|
|||||||
from eq3bt import Thermostat
|
from eq3bt import Thermostat
|
||||||
|
|
||||||
|
|
||||||
class Zimmer:
|
class Room:
|
||||||
name = None
|
name = None
|
||||||
thermostat = None
|
thermostat = None
|
||||||
|
|
||||||
|
|
||||||
zimmer = [Zimmer(), Zimmer(), Zimmer(), Zimmer(), Zimmer()]
|
rooms = [Room(), Room(), Room(), Room(), Room()]
|
||||||
zimmerName = ["alexander", "wohnzimmer", "badezimmer", "küche", "christina"]
|
roomName = ["alexander", "livingroom", "bathroom", "kitchen", "christina"]
|
||||||
zimmerThermostat = ["00:1A:22:16:4B:B4", "00:1A:22:16:25:C3", "00:1A:22:16:2C:20", "00:1A:22:16:26:06", "00:1A:22:16:26:75"]
|
roomThermostat = ["00:1A:22:16:4B:B4", "00:1A:22:16:25:C3", "00:1A:22:16:2C:20", "00:1A:22:16:26:06", "00:1A:22:16:26:75"]
|
||||||
|
|
||||||
for i in range(len(zimmer)):
|
for i in range(len(rooms)):
|
||||||
zimmer[i].name = zimmerName[i]
|
rooms[i].name = roomName[i]
|
||||||
zimmer[i].thermostat = zimmerThermostat[i]
|
rooms[i].thermostat = roomThermostat[i]
|
||||||
|
|
||||||
|
|
||||||
def on_connect(client, userdata, flags, rc):
|
def on_connect(client, userdata, flags, rc):
|
||||||
log.debug("Connected with result code " + str(rc))
|
log.debug("Connected with result code " + str(rc))
|
||||||
|
|
||||||
for i in zimmer:
|
for i in rooms:
|
||||||
client.subscribe("zimmer/" + i.name + "/heizung/actor/temperatur")
|
client.subscribe("room/" + i.name + "/heating/actor/temperature")
|
||||||
client.subscribe("zimmer/" + i.name + "/heizung/actor/status")
|
client.subscribe("room/" + i.name + "/heating/actor/status")
|
||||||
|
|
||||||
sendReadings()
|
sendReadings()
|
||||||
|
|
||||||
@ -44,11 +44,11 @@ def on_message(client, userdata, message):
|
|||||||
msg = message.payload.decode("utf-8")
|
msg = message.payload.decode("utf-8")
|
||||||
log.debug('received message: %s from %s', format(msg), format(message.topic))
|
log.debug('received message: %s from %s', format(msg), format(message.topic))
|
||||||
|
|
||||||
for i in zimmer:
|
for i in rooms:
|
||||||
tmpThermostat = Thermostat(i.thermostat)
|
tmpThermostat = Thermostat(i.thermostat)
|
||||||
if message.topic.split("/", -1)[2] == "heizung":
|
if message.topic.split("/", -1)[2] == "heating":
|
||||||
if message.topic.split("/", -1)[3] == "actor":
|
if message.topic.split("/", -1)[3] == "actor":
|
||||||
if message.topic.split("/", -1)[4] == "temperatur":
|
if message.topic.split("/", -1)[4] == "temperature":
|
||||||
if message.topic.split("/", -1)[1] == i.name:
|
if message.topic.split("/", -1)[1] == i.name:
|
||||||
tmpThermostat.mode= 3
|
tmpThermostat.mode= 3
|
||||||
tmpThermostat.target_temperature = round(float(msg),1)
|
tmpThermostat.target_temperature = round(float(msg),1)
|
||||||
@ -58,17 +58,17 @@ def on_message(client, userdata, message):
|
|||||||
|
|
||||||
|
|
||||||
def sendReadings():
|
def sendReadings():
|
||||||
log.debug('read target temperature from thermostats')
|
log.debug('read target temperature from thermostat')
|
||||||
|
|
||||||
for i in zimmer:
|
for i in rooms:
|
||||||
tmpThermostat = Thermostat(i.thermostat)
|
tmpThermostat = Thermostat(i.thermostat)
|
||||||
|
|
||||||
tmpThermostat.update()
|
tmpThermostat.update()
|
||||||
|
|
||||||
if tmpThermostat.target_temperature > 17.0:
|
if tmpThermostat.target_temperature > 17.0:
|
||||||
client.publish("zimmer/" + i.name + "/heizung/actor/status", 1, qos=1, retain=True)
|
client.publish("room/" + i.name + "/heating/actor/status", 1, qos=1, retain=True)
|
||||||
else:
|
else:
|
||||||
client.publish("zimmer/" + i.name + "/heizung/actor/status", 0, qos=1, retain=True)
|
client.publish("room/" + i.name + "/heating/actor/status", 0, qos=1, retain=True)
|
||||||
|
|
||||||
log.debug('sent readings')
|
log.debug('sent readings')
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user