nordicopen / pyeasee

Easee EV charger API python library
MIT License
39 stars 11 forks source link

Add partial information about ongoing session #63

Closed tobiasbayer closed 2 years ago

tobiasbayer commented 2 years ago

I would like to use this in the Easee Home Assistant Integration to display the duration so far of the ongoing session.

olalid commented 2 years ago

Hi Tobias,

Thank you for your idea, but I am not sure these changes will actually help us to implement this feature in the HA component. The HA component does in fact not poll the APIs more than for initial setup, it instead uses signalr streaming data for all run-time updates. (Schedules is currently an exception to that rule, but that is a workaround due to a bug in signalr stream that was present earlier, and we are actually working on removing that workaround since this has been fixed on server side now).

If I understand you correctly you want to know how long the current charging session has been going on? I think it could be possible to re-create this function by looking at the state of the charger instead. Typically the start of a session would be when the charger first changes state to charging (after being disconnected), and the end of a session would be when it changes state to disconnected. So if we add logic in the HA component that saves the time when the state changes to charging, we could use that to re-create the information you are after. Do you think that would be a reasonable workaround to get what you want?

PS. You are not supposed to edit the HTML files manually, they are automatically generated from the comments in the code, so the changes you have made there will be overwritten as part of the release-process.

tobiasbayer commented 2 years ago

Hi Ola,

I see. I think the suggested workaround would work for me.

Regarding the docs: I ran make doc. Didn't know it is run as part of the release process. No manual edits here ;)

tobiasbayer commented 2 years ago

I think this even could be done without touching the component at all. Thinking of setting the current time to an input as part of an automation when the charger's state changes and calculating the diff to "now" on the fly.

olalid commented 2 years ago

Yes, probably. I like you idea though, the start time could be an attribute to the session energy sensor for instance.