From 53da0a14164670547bfc54c2465d47674dfd6e4b Mon Sep 17 00:00:00 2001 From: BlueFox Date: Mon, 16 Jun 2025 15:13:08 +0200 Subject: [PATCH] Some small fixes --- .env | 2 +- solarcontrol.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.env b/.env index 75920b9..ee40f9c 100644 --- a/.env +++ b/.env @@ -9,7 +9,7 @@ OPENDTU_ADDR=
# address of opendtu (format: http(s):// # username for opendtu auth OPENDTU_PWD= # password for opendtu auth OPENDTU_INVERTER_SN= # serial number of the inverter to control -LIMIT_CORRECTION_FACTOR=2 # correction factor for limit setting (e.g.: when only 2 strings of 4 are connected, you always need to set 2x the power), default: 2 +LIMIT_CORRECTION_FACTOR=2 # correction factor for limit setting (e.g.: when only 2 strings of 4 are connected, you always need to set 2x the power), default: 1.0 LIMIT_UPDATE_INTERVAL=5 # interval in which the limit shall be updated, default: 5 [sec] DRY_RUN=0 # if the limit shall be set or not; default: 1 (0: False, 1: True) POWER_TARGET=15 # the target power consumption of the house, default: 50 [Watts] diff --git a/solarcontrol.py b/solarcontrol.py index 464aa70..828a091 100755 --- a/solarcontrol.py +++ b/solarcontrol.py @@ -61,7 +61,7 @@ powers = {"total": None, "total_house": None, "total_solar": None, "timestamp": # define mqtt callbacks def on_connect(client, userdata, flags, reason_code, properties): - print(f"{bcolors.OKGREEN}Connected with result code {bcolors.ENDC}{reason_code}") + print(f"{bcolors.OKGREEN}Connected to the MQTT broker ({mq_broker}:{mq_port}) with result code {bcolors.ENDC}{reason_code}{bcolors.OKGREEN}.{bcolors.ENDC}") client.subscribe("lge320/#") client.subscribe("solar/ac/#") def on_message(client, userdata, msg): @@ -83,6 +83,7 @@ mqttc.connect(mq_broker, mq_port, 60) mqttc.loop_start() + def threaded_current_power_calculation(): while True: last_powers = powers_raw.copy()