Compare commits
3 Commits
class_base
...
0.0.24
Author | SHA1 | Date | |
---|---|---|---|
d314ef37e4
|
|||
edb739764a
|
|||
21f49ae91b
|
10
Dockerfile
10
Dockerfile
@ -4,7 +4,9 @@ WORKDIR /app
|
|||||||
|
|
||||||
COPY src/requirements.txt .
|
COPY src/requirements.txt .
|
||||||
COPY src/main.py .
|
COPY src/main.py .
|
||||||
COPY src/message_processor.py .
|
COPY src/converters.py .
|
||||||
|
COPY src/config.py .
|
||||||
|
COPY src/box.py .
|
||||||
|
|
||||||
RUN \
|
RUN \
|
||||||
addgroup -S appgroup && \
|
addgroup -S appgroup && \
|
||||||
@ -16,9 +18,9 @@ RUN \
|
|||||||
ENV MQTT_BROKER=""
|
ENV MQTT_BROKER=""
|
||||||
ENV MQTT_PORT=""
|
ENV MQTT_PORT=""
|
||||||
ENV MQTT_CLIENT_PREFIX=""
|
ENV MQTT_CLIENT_PREFIX=""
|
||||||
ENV MQTT_BOX_TOPIC_PREFIXES=""
|
ENV BOX_TOPIC_PREFIXES=""
|
||||||
ENV MQTT_CENTRAL_TOPICS=""
|
ENV CENTRAL_TOPICS=""
|
||||||
ENV MQTT_STATUS_TOPIC=""
|
ENV STATUS_TOPIC=""
|
||||||
ENV OFF_TEMPERATURE=""
|
ENV OFF_TEMPERATURE=""
|
||||||
ENV LOW_TEMPERATURE=""
|
ENV LOW_TEMPERATURE=""
|
||||||
ENV DEFAULT_HIGH_TEMPERATURE=""
|
ENV DEFAULT_HIGH_TEMPERATURE=""
|
||||||
|
@ -7,20 +7,20 @@ data:
|
|||||||
MQTT_BROKER: "emqx01-anonymous-cluster-internal.broker.svc.cluster.local"
|
MQTT_BROKER: "emqx01-anonymous-cluster-internal.broker.svc.cluster.local"
|
||||||
MQTT_PORT: "1883"
|
MQTT_PORT: "1883"
|
||||||
MQTT_CLIENT_PREFIX: "HeatingController"
|
MQTT_CLIENT_PREFIX: "HeatingController"
|
||||||
MQTT_BOX_TOPIC_PREFIXES: |
|
BOX_TOPIC_PREFIXES: |
|
||||||
{
|
{
|
||||||
"high_temp": "heating/config/high_temp/",
|
"high_temp": "heating/config/high_temp/",
|
||||||
"overwrite_window": "heating/overwrite_window/",
|
"overwrite_window": "heating/overwrite_window/",
|
||||||
"cmd": "heating/command/"
|
"cmd": "heating/command/"
|
||||||
}
|
}
|
||||||
MQTT_CENTRAL_TOPICS: |
|
CENTRAL_TOPICS: |
|
||||||
{
|
{
|
||||||
"general_off": "heating/system/general_off",
|
"general_off": "heating/system/general_off",
|
||||||
"maintenance_mode": "heating/system/maintenance_mode",
|
"maintenance_mode": "heating/system/maintenance_mode",
|
||||||
"status": "heating/system/status"
|
"status": "heating/system/status"
|
||||||
}
|
}
|
||||||
MQTT_STATUS_TOPIC: "heating/status"
|
STATUS_TOPIC: "heating/status"
|
||||||
MQTT_CONTEXT_TOPIC_PREFIX: "heating/context/"
|
CONTEXT_TOPIC_PREFIX: "heating/context/"
|
||||||
OFF_TEMPERATURE: "5.0"
|
OFF_TEMPERATURE: "5.0"
|
||||||
LOW_TEMPERATURE: "15.0"
|
LOW_TEMPERATURE: "15.0"
|
||||||
DEFAULT_HIGH_TEMPERATURE: "21.0"
|
DEFAULT_HIGH_TEMPERATURE: "21.0"
|
||||||
@ -28,71 +28,63 @@ data:
|
|||||||
BOXES: |
|
BOXES: |
|
||||||
{
|
{
|
||||||
"patty": {
|
"patty": {
|
||||||
"label": "patty",
|
"windows": {
|
||||||
"windows": [
|
"garden_right": { "topic": "homegear/instance1/plain/18/1/STATE", "label": "Garten rechts", "converter": "max" },
|
||||||
{ "topic": "homegear/instance1/plain/18/1/STATE", "label": "Garten rechts", "converter": "max" },
|
"garden_left": { "topic": "homegear/instance1/plain/22/1/STATE", "label": "Garten links", "converter": "max" }
|
||||||
{ "topic": "homegear/instance1/plain/22/1/STATE", "label": "Garten links", "converter": "max" }
|
},
|
||||||
],
|
|
||||||
"output_topic": "heating/homegear/instance1/set/39/1/SET_TEMPERATURE",
|
"output_topic": "heating/homegear/instance1/set/39/1/SET_TEMPERATURE",
|
||||||
"output_converter": "max"
|
"output_converter": "max"
|
||||||
},
|
},
|
||||||
"kueche": {
|
"kueche": {
|
||||||
"label": "kueche",
|
"windows": {
|
||||||
"windows": [
|
"garden_window": { "topic": "homegear/instance1/plain/37/1/STATE", "label": "Garten Fenster", "converter": "max" },
|
||||||
{ "topic": "homegear/instance1/plain/37/1/STATE", "label": "Garten Fenster", "converter": "max" },
|
"garden_door": { "topic": "homegear/instance1/plain/36/1/STATE", "label": "Garten Tuer", "converter": "max" },
|
||||||
{ "topic": "homegear/instance1/plain/36/1/STATE", "label": "Garten Tuer", "converter": "max" },
|
"street_right": { "topic": "homegear/instance1/plain/38/1/STATE", "label": "Strasse rechts", "converter": "max" },
|
||||||
{ "topic": "homegear/instance1/plain/38/1/STATE", "label": "Strasse rechts", "converter": "max" },
|
"street_left": { "topic": "homegear/instance1/plain/13/1/STATE", "label": "Strasse links", "converter": "max" }
|
||||||
{ "topic": "homegear/instance1/plain/13/1/STATE", "label": "Strasse links", "converter": "max" }
|
},
|
||||||
],
|
|
||||||
"output_topic": "heating/homegear/instance1/set/40/1/SET_TEMPERATURE",
|
"output_topic": "heating/homegear/instance1/set/40/1/SET_TEMPERATURE",
|
||||||
"output_converter": "max"
|
"output_converter": "max"
|
||||||
},
|
},
|
||||||
"bad_oben": {
|
"bad_oben": {
|
||||||
"label": "bad_oben",
|
"windows": {
|
||||||
"windows": [
|
},
|
||||||
],
|
|
||||||
"output_topic": "heating/homegear/instance1/set/41/1/SET_TEMPERATURE",
|
"output_topic": "heating/homegear/instance1/set/41/1/SET_TEMPERATURE",
|
||||||
"output_converter": "max"
|
"output_converter": "max"
|
||||||
},
|
},
|
||||||
"schlafzimmer": {
|
"schlafzimmer": {
|
||||||
"label": "schlafzimmer",
|
"windows": {
|
||||||
"windows": [
|
"street": { "topic": "homegear/instance1/plain/52/1/STATE", "label": "Strasse", "converter": "max" }
|
||||||
{ "topic": "homegear/instance1/plain/52/1/STATE", "label": "Strasse", "converter": "max" }
|
},
|
||||||
],
|
|
||||||
"output_topic": "heating/homegear/instance1/set/42/1/SET_TEMPERATURE",
|
"output_topic": "heating/homegear/instance1/set/42/1/SET_TEMPERATURE",
|
||||||
"output_converter": "max"
|
"output_converter": "max"
|
||||||
},
|
},
|
||||||
"wolfgang": {
|
"wolfgang": {
|
||||||
"label": "wolfgang",
|
"windows": {
|
||||||
"windows": [
|
"garden": { "topic": "zigbee2mqtt/0x00158d008b3328da", "label": "Garten", "converter": "aqara" }
|
||||||
{ "topic": "zigbee2mqtt/0x00158d008b3328da", "label": "Garten", "converter": "aqara" }
|
},
|
||||||
],
|
|
||||||
"output_topic": "zigbee2mqtt/0x540f57fffe7e3cfe/set",
|
"output_topic": "zigbee2mqtt/0x540f57fffe7e3cfe/set",
|
||||||
"output_converter": "brennenstuhl"
|
"output_converter": "brennenstuhl"
|
||||||
},
|
},
|
||||||
"esszimmer": {
|
"esszimmer": {
|
||||||
"label": "esszimmer",
|
"windows": {
|
||||||
"windows": [
|
"street_right": { "topic": "homegear/instance1/plain/26/1/STATE", "label": "Strasse rechts", "converter": "max" },
|
||||||
{ "topic": "homegear/instance1/plain/26/1/STATE", "label": "Strasse rechts", "converter": "max" },
|
"street_left": { "topic": "homegear/instance1/plain/27/1/STATE", "label": "Strasse links", "converter": "max" }
|
||||||
{ "topic": "homegear/instance1/plain/27/1/STATE", "label": "Strasse links", "converter": "max" }
|
},
|
||||||
],
|
|
||||||
"output_topic": "heating/homegear/instance1/set/45/1/SET_TEMPERATURE",
|
"output_topic": "heating/homegear/instance1/set/45/1/SET_TEMPERATURE",
|
||||||
"output_converter": "max"
|
"output_converter": "max"
|
||||||
},
|
},
|
||||||
"wohnzimmer": {
|
"wohnzimmer": {
|
||||||
"label": "wohnzimmer",
|
"windows": {
|
||||||
"windows": [
|
"garden_right": { "topic": "homegear/instance1/plain/28/1/STATE", "label": "Garten rechts", "converter": "max" },
|
||||||
{ "topic": "homegear/instance1/plain/28/1/STATE", "label": "Garten rechts", "converter": "max" },
|
"garden_left": { "topic": "homegear/instance1/plain/29/1/STATE", "label": "Garten links", "converter": "max" }
|
||||||
{ "topic": "homegear/instance1/plain/29/1/STATE", "label": "Garten links", "converter": "max" }
|
},
|
||||||
],
|
|
||||||
"output_topic": "heating/homegear/instance1/set/46/1/SET_TEMPERATURE",
|
"output_topic": "heating/homegear/instance1/set/46/1/SET_TEMPERATURE",
|
||||||
"output_converter": "max"
|
"output_converter": "max"
|
||||||
},
|
},
|
||||||
"bad_unten": {
|
"bad_unten": {
|
||||||
"label": "bad_unten",
|
"windows": {
|
||||||
"windows": [
|
"street": { "topic": "homegear/instance1/plain/44/1/STATE", "label": "Strasse", "converter": "max" }
|
||||||
{ "topic": "homegear/instance1/plain/44/1/STATE", "label": "Strasse", "converter": "max" }
|
},
|
||||||
],
|
|
||||||
"output_topic": "heating/homegear/instance1/set/48/1/SET_TEMPERATURE",
|
"output_topic": "heating/homegear/instance1/set/48/1/SET_TEMPERATURE",
|
||||||
"output_converter": "max"
|
"output_converter": "max"
|
||||||
}
|
}
|
||||||
|
6
env
6
env
@ -17,6 +17,12 @@ export LOW_TEMPERATURE="15.0"
|
|||||||
export DEFAULT_HIGH_TEMPERATURE="21.0"
|
export DEFAULT_HIGH_TEMPERATURE="21.0"
|
||||||
export MAINTENANCE_TEMPERATURE="30.0"
|
export MAINTENANCE_TEMPERATURE="30.0"
|
||||||
export BOXES='{
|
export BOXES='{
|
||||||
|
"bla": {
|
||||||
|
"windows": {
|
||||||
|
},
|
||||||
|
"output_converter": "max",
|
||||||
|
"output_topic": "xoutput/bla"
|
||||||
|
},
|
||||||
"living_room": {
|
"living_room": {
|
||||||
"windows": {
|
"windows": {
|
||||||
"street_side": { "topic": "window/living_room/street_side", "converter": "max" },
|
"street_side": { "topic": "window/living_room/street_side", "converter": "max" },
|
||||||
|
81
env-test
Normal file
81
env-test
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
export MQTT_BROKER="172.23.1.102"
|
||||||
|
export MQTT_PORT=1883
|
||||||
|
export MQTT_CLIENT_PREFIX="MyMQTTClient"
|
||||||
|
export BOX_TOPIC_PREFIXES='{
|
||||||
|
"high_temp": "heating/config/high_temp/",
|
||||||
|
"cmd": "heating/command/"
|
||||||
|
}'
|
||||||
|
export CENTRAL_TOPICS='{
|
||||||
|
"general_off": "heating/system/general_off",
|
||||||
|
"maintenance_mode": "heating/system/maintenance_mode",
|
||||||
|
"status": "heating/system/status"
|
||||||
|
}'
|
||||||
|
export CONTEXT_TOPIC_PREFIX='heating/context/'
|
||||||
|
export STATUS_TOPIC="heating/status"
|
||||||
|
export OFF_TEMPERATURE="5.0"
|
||||||
|
export LOW_TEMPERATURE="15.0"
|
||||||
|
export DEFAULT_HIGH_TEMPERATURE="21.0"
|
||||||
|
export MAINTENANCE_TEMPERATURE="30.0"
|
||||||
|
export BOXES='{
|
||||||
|
"patty": {
|
||||||
|
"windows": {
|
||||||
|
"garden_right": { "topic": "homegear/instance1/plain/18/1/STATE", "label": "Garten rechts", "converter": "max" },
|
||||||
|
"garden_left": { "topic": "homegear/instance1/plain/22/1/STATE", "label": "Garten links", "converter": "max" }
|
||||||
|
},
|
||||||
|
"output_topic": "heating/homegear/instance1/set/39/1/SET_TEMPERATURE",
|
||||||
|
"output_converter": "max"
|
||||||
|
},
|
||||||
|
"kueche": {
|
||||||
|
"windows": {
|
||||||
|
"garden_window": { "topic": "homegear/instance1/plain/37/1/STATE", "label": "Garten Fenster", "converter": "max" },
|
||||||
|
"garden_door": { "topic": "homegear/instance1/plain/36/1/STATE", "label": "Garten Tuer", "converter": "max" },
|
||||||
|
"street_right": { "topic": "homegear/instance1/plain/38/1/STATE", "label": "Strasse rechts", "converter": "max" },
|
||||||
|
"street_left": { "topic": "homegear/instance1/plain/13/1/STATE", "label": "Strasse links", "converter": "max" }
|
||||||
|
},
|
||||||
|
"output_topic": "heating/homegear/instance1/set/40/1/SET_TEMPERATURE",
|
||||||
|
"output_converter": "max"
|
||||||
|
},
|
||||||
|
"bad_oben": {
|
||||||
|
"windows": {
|
||||||
|
},
|
||||||
|
"output_topic": "heating/homegear/instance1/set/41/1/SET_TEMPERATURE",
|
||||||
|
"output_converter": "max"
|
||||||
|
},
|
||||||
|
"schlafzimmer": {
|
||||||
|
"windows": {
|
||||||
|
"street": { "topic": "homegear/instance1/plain/52/1/STATE", "label": "Strasse", "converter": "max" }
|
||||||
|
},
|
||||||
|
"output_topic": "heating/homegear/instance1/set/42/1/SET_TEMPERATURE",
|
||||||
|
"output_converter": "max"
|
||||||
|
},
|
||||||
|
"wolfgang": {
|
||||||
|
"windows": {
|
||||||
|
"garden": { "topic": "zigbee2mqtt/0x00158d008b3328da", "label": "Garten", "converter": "aqara" }
|
||||||
|
},
|
||||||
|
"output_topic": "zigbee2mqtt/0x540f57fffe7e3cfe/set",
|
||||||
|
"output_converter": "brennenstuhl"
|
||||||
|
},
|
||||||
|
"esszimmer": {
|
||||||
|
"windows": {
|
||||||
|
"street_right": { "topic": "homegear/instance1/plain/26/1/STATE", "label": "Strasse rechts", "converter": "max" },
|
||||||
|
"street_left": { "topic": "homegear/instance1/plain/27/1/STATE", "label": "Strasse links", "converter": "max" }
|
||||||
|
},
|
||||||
|
"output_topic": "heating/homegear/instance1/set/45/1/SET_TEMPERATURE",
|
||||||
|
"output_converter": "max"
|
||||||
|
},
|
||||||
|
"wohnzimmer": {
|
||||||
|
"windows": {
|
||||||
|
"garden_right": { "topic": "homegear/instance1/plain/28/1/STATE", "label": "Garten rechts", "converter": "max" },
|
||||||
|
"garden_left": { "topic": "homegear/instance1/plain/29/1/STATE", "label": "Garten links", "converter": "max" }
|
||||||
|
},
|
||||||
|
"output_topic": "heating/homegear/instance1/set/46/1/SET_TEMPERATURE",
|
||||||
|
"output_converter": "max"
|
||||||
|
},
|
||||||
|
"bad_unten": {
|
||||||
|
"windows": {
|
||||||
|
"street": { "topic": "homegear/instance1/plain/44/1/STATE", "label": "Strasse", "converter": "max" }
|
||||||
|
},
|
||||||
|
"output_topic": "heating/homegear/instance1/set/48/1/SET_TEMPERATURE",
|
||||||
|
"output_converter": "max"
|
||||||
|
}
|
||||||
|
}'
|
@ -76,8 +76,9 @@ class Box:
|
|||||||
case [ primary_key ] if primary_key == 'high_temp':
|
case [ primary_key ] if primary_key == 'high_temp':
|
||||||
self.context.high_temperature = payload
|
self.context.high_temperature = payload
|
||||||
case [ primary_key ] if primary_key == 'cmd':
|
case [ primary_key ] if primary_key == 'cmd':
|
||||||
if payload in ('high', 'low', 'off'):
|
p = payload.lower()
|
||||||
self.context.mode = payload
|
if p in ('high', 'low', 'off'):
|
||||||
|
self.context.mode = p
|
||||||
else:
|
else:
|
||||||
raise Exception(f"Invalid cmd '{payload}'")
|
raise Exception(f"Invalid cmd '{payload}'")
|
||||||
case [ primary_key ] if primary_key == 'overwrite_window':
|
case [ primary_key ] if primary_key == 'overwrite_window':
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
import json
|
||||||
|
|
||||||
CONVERTERS = {
|
CONVERTERS = {
|
||||||
"target_temperature_output": {
|
"target_temperature_output": {
|
||||||
"max": lambda x: x,
|
"max": lambda x: x,
|
||||||
|
Reference in New Issue
Block a user