fsaris / home-assistant-zonneplan-one

Unofficial Zonneplan integration for Home Assistant
https://github.com/fsaris/home-assistant-zonneplan-one
MIT License
104 stars 17 forks source link

Try to get update for Charge point data after button press #82

Closed fsaris closed 9 months ago

fsaris commented 9 months ago

Charge points update on a fixed 5 minute schedule, however, they may also send updates every time something changes. What we do in the app is poll for updates after we request a change for a fixed period until we see the change has happened. This will require some sort of keeping state to know when the change has happened otherwise it will be just asking for data continuously.

So basically what you could do:

  1. Send instruction (like boost, stop charging)
  2. Poll every 10 seconds to see if the change has happened. (started or stopped charging with a maximum of a minute, so 6 times)
  3. If the change has not happened after this minute, assume the instruction has failed.

It would be great however if you would not implement this in a naive way where the plugin just keeps trying to send instructions and spam our API anyway, instructions may fail for any number of reasons like:

If you could make sure instructions are sent only when the car is connected AND not in an error state, that would probably resolve most issues that could arise otherwise.

Originally posted by @rdgout in https://github.com/fsaris/home-assistant-zonneplan-one/issues/49#issuecomment-1818638004

fsaris commented 9 months ago

Fixed in 272491ac6648e21dbd3d85f5a4275d3a5928770f