leeyuentuen / polestar_api

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

Remove units from (translated) labels #49

Closed m0wlheld closed 6 months ago

m0wlheld commented 6 months ago

To my understanding, units (A, W, km) should not be part of the entity label, but are configured by the entity itself and displayed next to the actual value (250 km).

So, for example polestar_estimate_distance_to_empty_miles and polestar_estimate_distance_to_empty_km should have a label of "Distance remaining" (or "Range"), because the actual unit (km or Miles) is displayed next to the value.

leeyuentuen commented 6 months ago

To my understanding, units (A, W, km) should not be part of the entity label, but are configured by the entity itself and displayed next to the actual value (250 km).

So, for example polestar_estimate_distance_to_empty_miles and polestar_estimate_distance_to_empty_km should have a label of "Distance remaining" (or "Range"), because the actual unit (km or Miles) is displayed next to the value.

but the entity name should be unique otherwise it can show only the first entity

dgomes commented 6 months ago

Well the distance should be the same, so we should be able to use just one of the attributes and leave the conversion to home assistant

m0wlheld commented 6 months ago

I also considered this. Currently the entities are 1:1 mapped from the Polestar API response, but it makes sense to provide an additional entity (like polestar_estimate_distance_to_empty) that is automatically mapped to polestar_estimate_distance_to_empty_miles or polestar_estimate_distance_to_empty_km depending on the configured unit system.

ScooterisT5 commented 6 months ago

Some entities became unknown? e.g. _estimate_distance_to_empty_km, _estimate_full_charge_range (in KM). My HA runs in metric

leeyuentuen commented 6 months ago

which version are you using? @ScooterisT5

ScooterisT5 commented 6 months ago

just updated to 1.2.9

leeyuentuen commented 6 months ago

@ScooterisT5 did you see something in the log?

ScooterisT5 commented 6 months ago

No, since the update nothing in the log.

Before it was like this, but i am sorry, i do not know which version it was before. Logger: homeassistant.components.sensor.recorder Source: components/sensor/recorder.py:204 Integration: Sensor (documentation, issues) First occurred: 15:25:10 (3 occurrences) Last logged: 15:25:10

The unit of sensor.polestar_XXXX_estimate_distance_to_empty_miles is changing, got multiple {'mi', 'miles'}, generation of long term statistics will be suppressed unless the unit is stable and matches the unit of already compiled statistics (miles). Go to https://my.home-assistant.io/redirect/developer_statistics to fix this The unit of sensor.polestar_XXXX_average_energy_consumption_kwh_per_100_km is changing, got multiple {'Kwh/100km', 'kWh/100km'}, generation of long term statistics will be suppressed unless the unit is stable and matches the unit of already compiled statistics (Kwh/100km). Go to https://my.home-assistant.io/redirect/developer_statistics to fix this The unit of sensor.polestar_XXXX_estimate_full_charge_range_miles is changing, got multiple {'mi', 'miles'}, generation of long term statistics will be suppressed unless the unit is stable and matches the unit of already compiled statistics (miles). Go to https://my.home-assistant.io/redirect/developer_statistics to fix this

Am 01.01.2024 um 19:48 schrieb Tuen Lee @.***>:

@ScooterisT5 https://github.com/ScooterisT5 did you see something in the log?

— Reply to this email directly, view it on GitHub https://github.com/leeyuentuen/polestar_api/issues/49#issuecomment-1873436161, or unsubscribe https://github.com/notifications/unsubscribe-auth/AK47FBPG27YVNRDT5B2BOHTYMMAHBAVCNFSM6AAAAABBGW5OX2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNZTGQZTMMJWGE. You are receiving this because you were mentioned.

leeyuentuen commented 6 months ago

No, since the update nothing in the log. Before it was like this, but i am sorry, i do not know which version it was before. Logger: homeassistant.components.sensor.recorder Source: components/sensor/recorder.py:204 Integration: Sensor (documentation, issues) First occurred: 15:25:10 (3 occurrences) Last logged: 15:25:10 The unit of sensor.polestar_XXXX_estimate_distance_to_empty_miles is changing, got multiple {'mi', 'miles'}, generation of long term statistics will be suppressed unless the unit is stable and matches the unit of already compiled statistics (miles). Go to https://my.home-assistant.io/redirect/developer_statistics to fix this The unit of sensor.polestar_XXXX_average_energy_consumption_kwh_per_100_km is changing, got multiple {'Kwh/100km', 'kWh/100km'}, generation of long term statistics will be suppressed unless the unit is stable and matches the unit of already compiled statistics (Kwh/100km). Go to https://my.home-assistant.io/redirect/developer_statistics to fix this The unit of sensor.polestar_XXXX_estimate_full_charge_range_miles is changing, got multiple {'mi', 'miles'}, generation of long term statistics will be suppressed unless the unit is stable and matches the unit of already compiled statistics (miles). Go to https://my.home-assistant.io/redirect/developer_statistics to fix this Am 01.01.2024 um 19:48 schrieb Tuen Lee @.***>: @ScooterisT5 https://github.com/ScooterisT5 did you see something in the log? — Reply to this email directly, view it on GitHub <#49 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AK47FBPG27YVNRDT5B2BOHTYMMAHBAVCNFSM6AAAAABBGW5OX2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNZTGQZTMMJWGE. You are receiving this because you were mentioned.

this is just on developer settings -> statistics -> search for polestar entity and fix the miles and km issue

ScooterisT5 commented 6 months ago

All fine in statistics, still „unknown“ after reboot

Am 01.01.2024 um 19:58 schrieb Tuen Lee @.***>:

No, since the update nothing in the log. Before it was like this, but i am sorry, i do not know which version it was before. Logger: homeassistant.components.sensor.recorder Source: components/sensor/recorder.py:204 Integration: Sensor (documentation, issues) First occurred: 15:25:10 (3 occurrences) Last logged: 15:25:10 The unit of sensor.polestar_XXXX_estimate_distance_to_empty_miles is changing, got multiple {'mi', 'miles'}, generation of long term statistics will be suppressed unless the unit is stable and matches the unit of already compiled statistics (miles). Go to https://my.home-assistant.io/redirect/developer_statistics to fix this The unit of sensor.polestar_XXXX_average_energy_consumption_kwh_per_100_km is changing, got multiple {'Kwh/100km', 'kWh/100km'}, generation of long term statistics will be suppressed unless the unit is stable and matches the unit of already compiled statistics (Kwh/100km). Go to https://my.home-assistant.io/redirect/developer_statistics to fix this The unit of sensor.polestar_XXXX_estimate_full_charge_range_miles is changing, got multiple {'mi', 'miles'}, generation of long term statistics will be suppressed unless the unit is stable and matches the unit of already compiled statistics (miles). Go to https://my.home-assistant.io/redirect/developer_statistics to fix this … <x-msg://2/#> Am 01.01.2024 um 19:48 schrieb Tuen Lee @.***>: @ScooterisT5 https://github.com/ScooterisT5 https://github.com/ScooterisT5 did you see something in the log? — Reply to this email directly, view it on GitHub <#49 (comment) https://github.com/leeyuentuen/polestar_api/issues/49#issuecomment-1873436161>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AK47FBPG27YVNRDT5B2BOHTYMMAHBAVCNFSM6AAAAABBGW5OX2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNZTGQZTMMJWGE. You are receiving this because you were mentioned.

this is just on developer settings -> statistics -> search for polestar entity and fix the miles and km issue

— Reply to this email directly, view it on GitHub https://github.com/leeyuentuen/polestar_api/issues/49#issuecomment-1873439360, or unsubscribe https://github.com/notifications/unsubscribe-auth/AK47FBPZX4CADOMAXIPEKS3YMMBMDAVCNFSM6AAAAABBGW5OX2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNZTGQZTSMZWGA. You are receiving this because you were mentioned.

leeyuentuen commented 6 months ago

ok, could you start debugging mode (1min) in the polestar_api, and send me the debug log?

ah wait the value _estimate_full_charge_range, could it be that you have a long range version? i've put something that the value could not be more then 600km or 400miles. could be that issue maybe

ohaue commented 6 months ago

I see the same in version 1.2.9. I have a long range and you may be right about the 600km. If I look at the polestar site it is reporting 1018km remaining: image

image

leeyuentuen commented 6 months ago

i'll update them to 660km instead of 600 because the WLTP is around 655, I think this is more a bug on polestar side, so I'm not planning to fix this I think. I put a maximum on it, to prevent issue that you see on the screenshot where it spike to 2000km: image

you could manual fix them by reset your polestar (tcam reset, reset 3 times, by holding your car console in the middle for 15-30 sec once it shutdown and repeat this 3 times. then the value should go back normally I think)

ScooterisT5 commented 6 months ago

ok, could you start debugging mode (1min) in the polestar_api, and send me the debug log?

ah wait the value _estimate_full_charge_range, could it be that you have a long range version? i've put something that the value could not be more then 600km or 400miles. could be that issue maybe

Ah, sorry just went back to 1.2.1, which is fine. And yes it is a LRDM Ha, but very lovely in 1.2.1 it shows a range in KM by a soc of 51% a remaining range of 1018KM - a dream came true ;-)

leeyuentuen commented 6 months ago

Is it a coincidence? both having 1018km? seems a bug on polestar

ohaue commented 6 months ago

Defently a Polestar bug.

ScooterisT5 commented 6 months ago

I agree, this also happens sometimes in former versions of the app. Just now i opened the app to check what it is showing, and now it is also corrected in the polestar_api. But now VIN, and License plate got unknown, weird

Am 01.01.2024 um 20:25 schrieb Tuen Lee @.***>:

Is it a coincidence? both having 1018km? seems a bug on polestar

— Reply to this email directly, view it on GitHub https://github.com/leeyuentuen/polestar_api/issues/49#issuecomment-1873448384, or unsubscribe https://github.com/notifications/unsubscribe-auth/AK47FBNDYL3WF6ZYU2JOCZDYMMESXAVCNFSM6AAAAABBGW5OX2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNZTGQ2DQMZYGQ. You are receiving this because you were mentioned.

leeyuentuen commented 6 months ago

I agree, this also happens sometimes in former versions of the app. Just now i opened the app to check what it is showing, and now it is also corrected in the polestar_api. But now VIN, and License plate got unknown, weird Am 01.01.2024 um 20:25 schrieb Tuen Lee @.***>: Is it a coincidence? both having 1018km? seems a bug on polestar — Reply to this email directly, view it on GitHub <#49 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AK47FBNDYL3WF6ZYU2JOCZDYMMESXAVCNFSM6AAAAABBGW5OX2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNZTGQ2DQMZYGQ. You are receiving this because you were mentioned.

if you are on the old version, that vin license issue is known, should fix in the latest version

ScooterisT5 commented 6 months ago

OK, done - now it shows correctly in 1.2.9 Sorry for the alert So, if the range is not shown as expected, maybe just open the polestar app to trigger update from car, instead of CD reset.

Am 01.01.2024 um 20:31 schrieb Tuen Lee @.***>:

I agree, this also happens sometimes in former versions of the app. Just now i opened the app to check what it is showing, and now it is also corrected in the polestar_api. But now VIN, and License plate got unknown, weird … <x-msg://4/#> Am 01.01.2024 um 20:25 schrieb Tuen Lee @.***>: Is it a coincidence? both having 1018km? seems a bug on polestar — Reply to this email directly, view it on GitHub <#49 (comment) https://github.com/leeyuentuen/polestar_api/issues/49#issuecomment-1873448384>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AK47FBNDYL3WF6ZYU2JOCZDYMMESXAVCNFSM6AAAAABBGW5OX2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNZTGQ2DQMZYGQ. You are receiving this because you were mentioned.

if you are on the old version, that vin license issue is known, should fix in the latest version

— Reply to this email directly, view it on GitHub https://github.com/leeyuentuen/polestar_api/issues/49#issuecomment-1873450311, or unsubscribe https://github.com/notifications/unsubscribe-auth/AK47FBJUFSHT7MU6V27MZBTYMMFJFAVCNFSM6AAAAABBGW5OX2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNZTGQ2TAMZRGE. You are receiving this because you were mentioned.

VdR1960 commented 6 months ago

I updated to 1.2.9. The good news is that the model, registration, and VIN now consistently show. The bad news is that all other values disappear after some time and then only re-appear after a reload of the integration.

leeyuentuen commented 6 months ago

@m0wlheld i think something like this: where all the miles are gone

image

leeyuentuen commented 6 months ago

I updated to 1.2.9. The good news is that the model, registration, and VIN now consistently show. The bad news is that all other values disappear after some time and then only re-appear after a reload of the integration.

did you saw something in the log? there is a version 1.3.1. maybe take a look there? it could something with polestar server issue.

VdR1960 commented 6 months ago

Two related message in the log:

Read Timeout on update data 19:58:57 – (WARNING) Polestar API (custom integration) - message first occurred at 02:29:19 and shows up 3 times

and

522: undefined 17:13:22 – (ERROR) Polestar API (custom integration)

The timing of that first entry 02:29:19 and 19:58:57 is when the values go 'Unknown'. At 17:13:22 all seemed ok.

I will update to 1.3.1. now.

leeyuentuen commented 6 months ago

same issue here: https://github.com/leeyuentuen/polestar_api/issues/43#issuecomment-1874027435

should be the issue of one of the ip that give issue.

m0wlheld commented 6 months ago

The PR went to far and removed units from entity names, where they need to stay, like polestar_6291_average_energy_consumption_kwh_per_100_km changed to polestar_6291_average_energy_consumption_kwh_per_100 . It should to my understanding stay at polestar_6291_average_energy_consumption_kwh_per_100_km or be polestar_6291_average_energy_consumption with a unit of kWh/100km

The Polestar API does AFAIK not report a kWh/100mil equivalent.

leeyuentuen commented 6 months ago

i'm using all of them KM and just convert them to miles. so for the average consuming in miles will it be /100mil. not sure if they want this or not.

m0wlheld commented 6 months ago

i'm using all of them KM and just convert them to miles. so for the average consuming in miles will it be /100mil. not sure if they want this or not.

unterstood. So kwh_per_100 makes sense.

Any change to remove _watts and _amps from charging_power_watts and charging_current_amps? Btw: I did not see any values from these sensors when my car was charging at my AC-wallbox. Are they for DC charging only?

leeyuentuen commented 6 months ago

The watt and amp I'll change later,

but this sensor: image

I've put them as not supported yet, but maybe the feature will contain value.

leeyuentuen commented 6 months ago

take a look at this beta: https://github.com/leeyuentuen/polestar_api/releases/tag/1.3.9

leeyuentuen commented 6 months ago

@m0wlheld can you check if it is now correct before I release?