G-Two / homeassistant-subaru

Subaru STARLINK custom component for Home Assistant.
Apache License 2.0
54 stars 7 forks source link

Tire pressure entities unavailable even though they are provided in diagnostics #83

Closed DerekF35 closed 1 year ago

DerekF35 commented 1 year ago

Tire pressure entities are unavailable in Home Assistant. I'm also seeing the following errors in the logs that may point to a script failure during tire processing.

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 455, in async_add_entities await asyncio.gather(*tasks) File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 731, in _async_add_entity await entity.add_to_platform_finish() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 823, in add_to_platform_finish self.async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 568, in async_write_ha_state self._async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 635, in _async_write_ha_state attr.update(self.extra_state_attributes or {}) File "/config/custom_components/subaru/sensor.py", line 284, in extra_state_attributes "Recommended pressure": info[ KeyError: 'FRONT_TIRES'

config_entry-subaru-1e404d34d787bf760c63ae31d7204b7a.json.txt

G-Two commented 1 year ago

hmm..weird. Did these work for you before? I don't see TIF_## and TIR_## items in vehicle_features, which is how the recommended pressures are provided by the Subaru API. I do see the bug in this integration that breaks tire pressures altogether if the recommended attribute is missing, so that's an easy fix. I'm just curious if it ever worked for you in the past.

DerekF35 commented 1 year ago

Nope, never worked. I am new to the integration (and Subaru). First week or so I used the HA integration but that lacked all of the functionality I was looking for. Switched to HACS version last night and tire pressure never worked.

Battery voltage and external temperature are also not working, but likely Subaru issue from what I can tell?

G-Two commented 1 year ago

Gotcha. Yeah the Subaru HA Core integration is lagging behind. I keep putting PRs in to add more features, but there's a huge backlog I guess.

It looks like for your year/model they just don't provide recommended tire pressures for some reason. I'll push a fix soon to make it not break for you (i.e. you'll get last measured tire pressures for all 4 tires, but no additional attribute for the recommended tire pressures).

12V battery voltage and ext temp were unfortunately removed from the data set that the Subaru API returns. Hopefully it'll come back in the future.

DerekF35 commented 1 year ago

Great. Thanks for the quick fix. Much appreciated.

G-Two commented 1 year ago

v0.7.7 is released and should fix the issue for you.

DerekF35 commented 1 year ago

It is working now. Thanks