Skip to content

Commit

Permalink
Update HoymilesZeroExport.py
Browse files Browse the repository at this point in the history
second try to fix json-bool value
  • Loading branch information
reserve85 committed Oct 7, 2024
1 parent 42961a6 commit e57876c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion HoymilesZeroExport.py
Original file line number Diff line number Diff line change
Expand Up @@ -1085,7 +1085,7 @@ def SetPowerStatus(self, pInverterId: int, pActive: bool):
logger.info('OpenDTU: Inverter "%s": Turn on',NAME[pInverterId])
else:
logger.info('OpenDTU: Inverter "%s": Turn off',NAME[pInverterId])
mySendStr = f'''data={{"serial":"{SERIAL_NUMBER[pInverterId]}", "power":{pActive}}}'''
mySendStr = f'''data="serial":"{SERIAL_NUMBER[pInverterId]}", "power":{json.dumps(pActive)}'''
response = self.GetResponseJson('/api/power/config', mySendStr)
if response['type'] != 'success':
raise Exception(f"Error: SetPowerStatus error: {response['message']}")
Expand Down Expand Up @@ -1555,6 +1555,8 @@ def emit(self, record):
try:
logger.info("---Init---")
newLimitSetpoint = 0

DTU.SetPowerStatus(1, True)
DTU.CheckMinVersion()
if GetHoymilesAvailable():
for i in range(INVERTER_COUNT):
Expand Down

0 comments on commit e57876c

Please sign in to comment.