Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set time after inverter start to fix total increase when blocking cloud access #567

Open
Panoramiac opened this issue Apr 21, 2024 · 1 comment

Comments

@Panoramiac
Copy link

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

I found an interesting hint here:

Note that with internet access blocked, the inverter never receives any time information. This breaks the Yield today counter as it will never properly reset unless you manually set the time on each boot using modbus register 22, 23 and 24.

The question now is how to set these registers and if this could be integrated into this addon?

@pretorh
Copy link

pretorh commented May 4, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants