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

Time synchronization #348

Open
Xnyle opened this issue Dec 26, 2024 · 13 comments
Open

Time synchronization #348

Xnyle opened this issue Dec 26, 2024 · 13 comments
Labels
enhancement New feature or request

Comments

@Xnyle
Copy link

Xnyle commented Dec 26, 2024

Is your feature request related to a problem?

Deye is pushing out updates that are potentially bricking inverters (no relays box despite no need / wrong country detected and so on)
So many people block internet access completely to forbid further updates.

In that case the inverter can not get the network time and so daily production can't reset.

Describe the solution you'd like

But pvsolarman has a way to set the time as well via

"SunXG3RegistersWrite.DeviceTime(inv, datetime.datetime.now())"

Could that be implemented within the addon, maybe with an option switch to enable it?

Describe alternatives you've considered

@Xnyle Xnyle added the enhancement New feature or request label Dec 26, 2024
@davidrapan
Copy link
Owner

davidrapan commented Dec 26, 2024

There is a way you can do it already and it's by using automation and setting Date & Time entity but there are some other ways currently coming (it's already part of latest code in this repo and just not yet released) and it's time synchronization using heartbeat time replies but it won't work for every inverter so you will have to try and see (it's mostly for microinverters)

@davidrapan davidrapan changed the title Set Inverter Time via Addon Time synchronization Dec 26, 2024
@Xnyle
Copy link
Author

Xnyle commented Dec 27, 2024

Thanks, but how? this doesn't seem to do anything, time entity not changing when triggered?

alias: Set Inverter Datetime
description: ""
triggers:
  - hours: "*"
    minutes: /5
    seconds: "5"
    trigger: time_pattern
conditions:
  - condition: and
    conditions:
      - condition: or
        conditions:
          - condition: time
            after: "06:30:00"
            before: "22:30:59"
  - condition: not
    conditions:
      - condition: state
        entity_id: sensor.inverter_device_state
        state: unavailable
actions:
  - data:
      datetime: "{{ now() }}"
    target:
      entity_id: datetime.inverter_date_time
    action: input_datetime.set_datetime
mode: single

@davidrapan
Copy link
Owner

Try to run this during debug logging enabled.

@Xnyle
Copy link
Author

Xnyle commented Dec 28, 2024

Referenced entities datetime.inverter_date_time are missing or not currently available

But thats the entities id name from the details?

@davidrapan
Copy link
Owner

Do you have this entity in the list of entities in device detail page?

@Xnyle
Copy link
Author

Xnyle commented Dec 29, 2024

Yes, in the "Configuration" section

@davidrapan
Copy link
Owner

Ah, it should be proly this action

action: datetime.set_value

@CrazyUs3r
Copy link
Contributor

Is it necessary to change a setting on the inverter for the heartbeat? I just blocked the internet and it had no date or time. Writing about the action worked though

@davidrapan
Copy link
Owner

Is it necessary to change a setting on the inverter for the heartbeat?

Not sure if it's enough honestly. It needs to be tested more and the packets has to be verified in server mode I guess.

@Skarabaen
Copy link

Deye can upgrade your firmware without your knowledge and currently do firmware upgrades which brick some devices. So I blocked the inverters from connecting the internet like @CrazyUs3r
Unfortunately it seems that there are hardcoded ntp servers in the firmware, so without internet they cant update the date and "Today Production" values dont reset every day but sum up. I used the datetime.xxxxxx_date_time function to set the date manually. But it seems that it only triggers if you go to the webinterface of the inverter and press the restart button. After that the values "Today Production" values are set back to 0.

Can we set the somehow the ntp server with your addon?

@Xnyle
Copy link
Author

Xnyle commented Dec 29, 2024

I wouldn't advice to grant those devices any internet access at all now or even locally connect via the app (I guess that's how some got their updates forced)

actions:
  - data:
      datetime: "{{ now() }}"
    target:
      entity_id: datetime.inverter_date_time
    action: datetime.set_value

worked but as mentioned does not reset todays production
But that isn't really a problem as i will reset the next day so in essence it will reset every day except there it some very heavy cloud cover during the day.

@davidrapan
Copy link
Owner

Unfortunately it seems that there are hardcoded ntp servers.
Can we set the somehow the ntp server with your addon?

It doesn't use NTP. And this is an integration not an addon.

So far it seems like devices proly set time during handshake which is done in server mode. This integration doesn't support that, yet. But it's proly not even possible because integration (to my knowledge) can't listen on ports so it would have to be done using an addon.

Integrations and Addons are for HA two different things.

@Skarabaen
Copy link

I wouldn't advice to grant those devices any internet access at all now or even locally connect via the app (I guess that's how some got their updates forced)

actions:
  - data:
      datetime: "{{ now() }}"
    target:
      entity_id: datetime.inverter_date_time
    action: datetime.set_value

worked but as mentioned does not reset todays production But that isn't really a problem as i will reset the next day so in essence it will reset every day except there it some very heavy cloud cover during the day.

with this automation the time will get set. I can´t check if the production will be reset, because we had no sun yesterday. But in case of doubt, it is just another automation that restarts the inverter once in the morning

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

No branches or pull requests

4 participants