leeyuentuen / polestar_api

Polestar Api - Home Assistant Component
MIT License
112 stars 18 forks source link

Unable to use all parameters in automation #106

Closed RobDemandt closed 5 months ago

RobDemandt commented 5 months ago

Some of the parameters provided, mainly the ones that do not contain numerical values, can be used in Home Assistant automations.

Example: Would like to build an automation to alert me when the car has been charged. I can create an automation and set an initial variable of battery level (the system gives me an above and below field),

Screenshot 2024-01-23 at 15 00 51

but when I want to set an additional (and) variable for charge cable status (which van be connected or not connected), there is no way to select these options and the system trows an error.

Screenshot 2024-01-23 at 15 01 34 Screenshot 2024-01-23 at 15 01 55
leeyuentuen commented 5 months ago

i'll take a look on it

VdR1960 commented 5 months ago

I just tried this and can confirm the error message. Happens when adding the condition.

However, I believe to achieve what you want to do, you should choose 'Entity' in the condition instead of 'Device'. That seems to work fine.

Screenshot 2024-01-25 143500

And: Why do you add that condition? How could the state of charge go above the 80% when not connected? Regen?

RobDemandt commented 5 months ago

I tested with using the entity instead of device and can confirm this is indeed working, thanks for the hint.

Reasoning for this additional if statement in the automation is to prevent situations when the API times out or is not available whilst the charging happens and then trowing the notification at a random moment whilst driving with a charge of above 80%. Had this already happen a couple of times with the unreliable Polestar backend/connectivity. Now it should at least not do this when there is no cable connected.