translate from Denglish to only english

This commit is contained in:
lukario 2021-04-18 15:30:31 +02:00
parent 37c0fc4320
commit afae8b4016
2 changed files with 44 additions and 44 deletions

View File

@ -10,38 +10,38 @@ import schedule
import paho.mqtt.client as mqtt
class Zimmer:
class Room:
name = None
automatic = None
temperaturSet = None
temperatureSet = None
statusActual = None
zimmer = [Zimmer(), Zimmer(), Zimmer(), Zimmer(), Zimmer(), Zimmer()]
zimmerName =["alexander", "wohnzimmer", "badezimmer", "christina", "kueche", "simon"]
rooms = [Room(), Room(), Room(), Room(), Room(), Room()]
roomName =["alexander", "livingroom", "bathroom", "christina", "kitchen", "simon"]
for i in range(len(zimmer)):
zimmer[i].name = zimmerName[i]
zimmer[i].automatic = 0
zimmer[i].temperaturSet = 0.0
zimmer[i].statusActual = 0
for i in range(len(rooms)):
rooms[i].name = roomName[i]
rooms[i].automatic = 0
rooms[i].temperatureSet = 0.0
rooms[i].statusActual = 0
def on_connect(client, userdata, flags, 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("zimmer/" + i.name + "/heizung/control/temperatur")
client.subscribe("zimmer/" + i.name + "/heizung/control/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")
client.subscribe("room/" + i.name + "/heating/control/automatic")
client.subscribe("room/" + i.name + "/heating/control/temperature")
client.subscribe("room/" + i.name + "/heating/control/status")
client.subscribe("room/" + i.name + "/heating/actor/temperature")
client.subscribe("room/" + i.name + "/heating/actor/status")
# client.subscribe("room/" + i.name + "/sensoren/tuer/status")
# client.subscribe("room/" + i.name + "/sensoren/fenster/status")
# client.subscribe("room/" + i.name + "/sensoren/temperature")
sendReadings()
@ -56,19 +56,19 @@ 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)[2] == "heating":
if message.topic.split("/", -1)[3] == "control":
if message.topic.split("/", -1)[4] == "automatic":
for i in zimmer:
for i in rooms:
if message.topic.split("/", -1)[1] == i.name:
i.automatic = bool(msg)
if message.topic.split("/", -1)[4] == "temperatur":
for i in zimmer:
if message.topic.split("/", -1)[4] == "temperature":
for i in rooms:
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)[4] == "status":
for i in zimmer:
for i in rooms:
if message.topic.split("/", -1)[1] == i.name:
i.statusActual = bool(msg)
@ -77,11 +77,11 @@ def on_message(client, userdata, message):
def sendReadings():
for i in zimmer:
for i in rooms:
if i.automatic:
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)
client.publish("room/" + i.name + "/heating/actor/temperature", i.temperatureSet, qos=1, retain=True)
client.publish("room/" + i.name + "/heating/control/status", i.statusActual, qos=1, retain=True)
log.debug('sent readings')

View File

@ -11,26 +11,26 @@ import paho.mqtt.client as mqtt
from eq3bt import Thermostat
class Zimmer:
class Room:
name = None
thermostat = None
zimmer = [Zimmer(), Zimmer(), Zimmer(), Zimmer(), Zimmer()]
zimmerName = ["alexander", "wohnzimmer", "badezimmer", "küche", "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"]
rooms = [Room(), Room(), Room(), Room(), Room()]
roomName = ["alexander", "livingroom", "bathroom", "kitchen", "christina"]
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)):
zimmer[i].name = zimmerName[i]
zimmer[i].thermostat = zimmerThermostat[i]
for i in range(len(rooms)):
rooms[i].name = roomName[i]
rooms[i].thermostat = roomThermostat[i]
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/actor/temperatur")
client.subscribe("zimmer/" + i.name + "/heizung/actor/status")
for i in rooms:
client.subscribe("room/" + i.name + "/heating/actor/temperature")
client.subscribe("room/" + i.name + "/heating/actor/status")
sendReadings()
@ -44,11 +44,11 @@ def on_message(client, userdata, message):
msg = message.payload.decode("utf-8")
log.debug('received message: %s from %s', format(msg), format(message.topic))
for i in zimmer:
for i in rooms:
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)[4] == "temperatur":
if message.topic.split("/", -1)[4] == "temperature":
if message.topic.split("/", -1)[1] == i.name:
tmpThermostat.mode= 3
tmpThermostat.target_temperature = round(float(msg),1)
@ -58,17 +58,17 @@ def on_message(client, userdata, message):
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.update()
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:
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')