itchannel / fordpass-ha

Fordpass integration for Home Assistant
313 stars 58 forks source link

integration seems broken on "remoteStartCountdownTimer" #401

Closed janssenk23 closed 12 months ago

janssenk23 commented 1 year ago

Hi,

owner of a Ford Tourneo, fuel, since the beginning of this year. In the beginning, fordpass integration didn't work, due to the api not allowing to log in. Since a few weeks, it worked, after major change on ford's api I assume. Since a few days, the interesting values like odometer are unavailable again. Today, updated everything (HA, fordpass integration, ...) But it still doesn't work.

`2023-10-22 14:21:31.940 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up fordpass platform for sensor Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 359, in _async_setup_platform await asyncio.shield(task) File "/config/custom_components/fordpass/sensor.py", line 32, in async_setup_entry sensor = CarSensor(entry, key, config_entry.options) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/fordpass/sensor.py", line 67, in init self.events = coordinator.data["events"]


KeyError: 'events'
`
and
`2023-10-22 14:21:31.944 ERROR (MainThread) [homeassistant.components.switch] Error adding entities for domain switch with platform fordpass
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 507, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 752, in _async_add_entity
    await entity.add_to_platform_finish()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1057, in add_to_platform_finish
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 779, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 879, in _async_write_ha_state
    state, attr = self._async_generate_attributes()
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 820, in _async_generate_attributes
    state = self._stringify_state(available)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 785, in _stringify_state
    if (state := self.state) is None:
                 ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1307, in state
    if (is_on := self.is_on) is None:
                 ^^^^^^^^^^
  File "/config/custom_components/fordpass/switch.py", line 101, in is_on
    if self.coordinator.data["metrics"]["remoteStartCountdownTimer"] is not None:
       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
KeyError: 'remoteStartCountdownTimer'
`

There is a huge json format after "Getting Vehicles" but remoteStartCountdownTimer ain't one of them.
Odometer is in there, but due to some other error or missing data, I guess it stops mapping the json to HA entities.

Anything more I can provide in order to get this solved ?
snippet HA log attached.

[HA-fordpass-snippet.txt](https://github.com/itchannel/fordpass-ha/files/13063341/HA-fordpass-snippet.txt)
itchannel commented 1 year ago

@janssenk23 Can you please give 1.61 Beta a go.

janssenk23 commented 1 year ago

Thanks itchannel 1.61 beta3 seems to have solved this ! redownload via HACS, show beta,chose latest beta removed integration & added again now 12 entities detected again ! Thanks !

janssenk23 commented 1 year ago

Damn, values don't update anymore...

2023-10-27 12:40:47.500 ERROR Platform fordpass does not generate unique IDs. ID <>-fordpass_fuel already exists - ignoring sensor.fordpass_fuel 2023-10-27 12:40:47.500 ERROR Platform fordpass does not generate unique IDs. ID <>-fordpass_oil already exists - ignoring sensor.fordpass_oil 2023-10-27 12:40:47.500 ERROR Platform fordpass does not generate unique IDs. ID <>-fordpass_ignitionStatus already exists - ignoring sensor.fordpass_ignitionstatus 2023-10-27 12:40:47.500 ERROR Platform fordpass does not generate unique IDs. ID <>-fordpass_doorStatus already exists - ignoring sensor.fordpass_doorstatus 2023-10-27 12:40:47.500 ERROR Platform fordpass does not generate unique IDs. ID <>-fordpass_windowPosition already exists - ignoring sensor.fordpass_windowposition 2023-10-27 12:40:47.500 ERROR Platform fordpass does not generate unique IDs. ID <>-fordpass_lastRefresh already exists - ignoring sensor.fordpass_lastrefresh 2023-10-27 12:40:47.500 ERROR Platform fordpass does not generate unique IDs. ID <>-fordpass_indicators already exists - ignoring sensor.fordpass_indicators 2023-10-27 12:40:47.500 ERROR Platform fordpass does not generate unique IDs. ID <>-fordpass_messages already exists - ignoring sensor.fordpass_messages 2023-10-27 12:40:47.500 ERROR Platform fordpass does not generate unique IDs. ID <>-fordpass_ignition already exists - ignoring switch.fordpass_ignition_switch

janssenk23 commented 1 year ago

I'll be damned, I redownloaded the same beta version, and now all is (currently) fine. Entities in HA get updated!! Looking forward for the next release which contains this fix !

Thanks guys !!

itchannel commented 12 months ago

Closing as fixed for user :)