skodaconnect / homeassistant-skodaconnect

Skoda Connect - A home assistant plugin to add integration with your car
Apache License 2.0
224 stars 28 forks source link

Assume entity state after triggering a call #248

Open LucasHokerberg opened 9 months ago

LucasHokerberg commented 9 months ago

Is your feature request related to a problem? Please describe. No

Describe the solution you'd like When for instance triggering the "unlock" call, the state of the entity is still "locked" until the next polling interval (e.g., minutes later). Instead, it would be nice if the integration would assume that the state is "unlocked". If the call fails for whatever reason, the state would correct it-self after the next polling interval.

Preferably, we get a configuration option to turn "Assume state" on or off.

Describe alternatives you've considered None

Additional context n/a

dvx76 commented 9 months ago

Seems reasonable. Would use the assumed_state entity attribute (https://developers.home-assistant.io/docs/core/entity?_highlight=assumed_state#generic-properties).

Might be complicated by the API still returning the "old" value on the next poll, while the change is still "in progress". What should happen then?

LucasHokerberg commented 9 months ago

I would assume that if the call is not done by the next poll, the call failed and it make sense to see that e.g., the door is still locked.

Or is it a possibility that a poll runs in parallel with a not finished call? In that case, maybe polls need to be deferred until any running call is done, or the assumed state should not be changed unless there are no running calls.