Some small fixes

This commit is contained in:
BlueFox 2025-06-16 15:13:08 +02:00
parent eb8c865474
commit 53da0a1416
2 changed files with 3 additions and 2 deletions

2
.env
View File

@ -9,7 +9,7 @@ OPENDTU_ADDR=<ADDRESS OF OPENDTU> # address of opendtu (format: http(s)://<IP-
OPENDTU_USER=<OPENDTU USER> # username for opendtu auth
OPENDTU_PWD=<OPENDTU PWD> # password for opendtu auth
OPENDTU_INVERTER_SN=<SERIAL NR> # 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]

View File

@ -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()