Open Panoramiac opened 2 months ago
I had a similar problem where the inverter's time drifted after a few weeks, causing the daily counters from the inverter to only reset at ex 12:02am
My workaround is to use an automation that runs every 6 hours, which sets the time on the inverter using home assistant's time, using python scripts
This works on my deye hybrid, may need to adjust for other inverters.
Python:
def write_values(register, value):
service_data = {
"register": register,
"values": value,
}
hass.services.call("solarman", "write_multiple_holding_registers", service_data, blocking=True)
def int16(high, low):
return (high << 8) + low
now = datetime.datetime.now()
values = [
now.year - 2000,
now.month,
now.day,
now.hour,
now.minute,
now.second,
]
i16 = [
int16(values[0], values[1]),
int16(values[2], values[3]),
int16(values[4], values[5]),
]
write_values(22, i16[0])
write_values(23, i16[1])
write_values(24, i16[2])
automation:
alias: "cron: set inverter time"
description: ""
trigger:
- platform: time_pattern
hours: /6
minutes: "58"
condition: []
action:
- service: python_script.update_solarman_datetime
metadata: {}
data: {}
mode: single
the Python code was reversed from https://github.com/kellerza/sunsynk/blob/main/src/sunsynk/rwsensors.py#L142
The total yield is not reset when blocking the cloud (and we all should block these inverters from reaching the cloud as this is not secure):![image](https://github.com/StephanJoubert/home_assistant_solarman/assets/48438802/4ab6101f-d862-45de-bc03-9972a3dbc606)
I found an interesting hint here:
The question now is how to set these registers and if this could be integrated into this addon?