@@ -110,7 +110,7 @@ def on_message(client, userdata, msg) -> None:
110110 log .warning (" Skipped msg " + msg .topic + " Value " + value )
111111
112112
113- def getdevicevalues (uberschuss : int , uberschussoffset : int , pvwatt : int ) -> None :
113+ def getdevicevalues (uberschuss : int , uberschussoffset : int , pvwatt : int , chargestatus : bool ) -> None :
114114 global mydevices
115115 totalwatt = 0
116116 totalwattot = 0
@@ -122,6 +122,7 @@ def getdevicevalues(uberschuss: int, uberschussoffset: int, pvwatt: int) -> None
122122 mqtt_all = {}
123123 for mydevice in mydevices :
124124 mydevice .pvwatt = pvwatt
125+ mydevice .chargestatus = chargestatus
125126 mydevice .getwatt (uberschuss , uberschussoffset )
126127 watt = mydevice .newwatt
127128 wattk = mydevice .newwattk
@@ -390,7 +391,8 @@ def resetmaxeinschaltdauerfunc() -> None:
390391 resetmaxeinschaltdauer = 0
391392
392393
393- def loadregelvars (wattbezug : int , speicherleistung : int , speichersoc : int , pvwatt : int ) -> Tuple [int , int ]:
394+ def loadregelvars (wattbezug : int , speicherleistung : int , speichersoc : int ,
395+ pvwatt : int , chargestatus : bool ) -> Tuple [int , int ]:
394396 global maxspeicher
395397 global mydevices
396398 uberschuss = wattbezug + speicherleistung
@@ -400,7 +402,7 @@ def loadregelvars(wattbezug: int, speicherleistung: int, speichersoc: int, pvwat
400402 log .info ("Uberschuss: " + str (uberschuss ) +
401403 " Uberschuss mit Offset: " + str (uberschussoffset ) + " Pv: " + str (pvwatt ))
402404 log .info ("Speicher Entladung(-)/Ladung(+): " +
403- str (speicherleistung ) + " SpeicherSoC: " + str (speichersoc ))
405+ str (speicherleistung ) + " SpeicherSoC: " + str (speichersoc ) + " Ladung: " + str ( chargestatus ) )
404406 reread = 0
405407 try :
406408 with open (bp + '/ramdisk/rereadsmarthomedevices' , 'r' ) as value :
@@ -449,16 +451,17 @@ def initparam(inpcg: str, inpcs: str, inpsdevstat: str, inpsglobstat: str, inpto
449451 mqttport = inpport
450452
451453
452- def mainloop (wattbezug : int , speicherleistung : int , speichersoc : int , pvwatt : int = 0 ) -> None :
454+ def mainloop (wattbezug : int , speicherleistung : int , speichersoc : int , pvwatt : int = 0 ,
455+ chargestatus : bool = False ) -> None :
453456 global firststart
454457 if firststart :
455458 readmq ()
456459 firststart = False
457460 mqtt_man = {}
458461 sendmess = 0
459- uberschuss , uberschussoffset = loadregelvars (wattbezug , speicherleistung , speichersoc , pvwatt )
462+ uberschuss , uberschussoffset = loadregelvars (wattbezug , speicherleistung , speichersoc , pvwatt , chargestatus )
460463 resetmaxeinschaltdauerfunc ()
461- getdevicevalues (uberschuss , uberschussoffset , pvwatt )
464+ getdevicevalues (uberschuss , uberschussoffset , pvwatt , chargestatus )
462465 conditions (speichersoc )
463466 # do the manual stuff
464467 for i in range (1 , (numberOfSupportedDevices + 1 )):
0 commit comments