CJNE / ha-porscheconnect

Porsche Connect custom component for Home Assistant
MIT License
31 stars 14 forks source link

Device Tracker does not seem to work #258

Closed barto64 closed 1 day ago

barto64 commented 4 days ago

Version of the custom_component

new_api

Describe the bug

Device Tracker esntity does not seem to work. It appears "Disabled". Probably WIP.

Log on the initial set-up

2024-11-25 14:38:27.313 ERROR (MainThread) [homeassistant.components.device_tracker] Error adding entity device_tracker.cayenne_e_hybrid_barto for domain device_tracker with platform porscheconnect Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 599, in _async_add_entities await coro File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 918, in _async_add_entity await entity.add_to_platform_finish() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1367, in add_to_platform_finish await self.async_added_to_hass() File "/config/custom_components/porscheconnect/init.py", line 185, in async_added_to_hass self._handle_coordinator_update() File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 561, in _handle_coordinator_update self.async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1007, in async_write_ha_state self._async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1132, in _async_write_ha_state self.async_calculate_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1069, in async_calculate_state state = self._stringify_state(available) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1013, in _stringify_state if (state := self.state) is None: ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/device_tracker/config_entry.py", line 265, in state if self.latitude is not None and self.longitude is not None: ^^^^^^^^^^^^^ File "/config/custom_components/porscheconnect/device_tracker.py", line 71, in latitude return float(self.vehicle.location[0])

Log when making updates

File "/usr/src/homeassistant/homeassistant/components/device_tracker/config_entry.py", line 265, in state if self.latitude is not None and self.longitude is not None: ^^^^^^^^^^^^^ File "/config/custom_components/porscheconnect/device_tracker.py", line 71, in latitude

CJNE commented 3 days ago

It might work better with the latest update to new_api, it does for me at least.

barto64 commented 3 days ago

I updated both, custom component code and the API (v2.0) and still see the same issue on every data refresh.

2024-11-26 06:20:22.912 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved (None) Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 266, in _handle_refresh_interval await self._async_refresh(log_failures=True, scheduled=True) File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 481, in _async_refresh self.async_update_listeners() File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 176, in async_update_listeners update_callback() File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 561, in _handle_coordinator_update self.async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1007, in async_write_ha_state self._async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1132, in _async_write_ha_state self.async_calculate_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1069, in async_calculate_state state = self._stringify_state(available) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1013, in _stringify_state if (state := self.state) is None: ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/device_tracker/config_entry.py", line 265, in state if self.latitude is not None and self.longitude is not None: ^^^^^^^^^^^^^ File "/config/custom_components/porscheconnect/device_tracker.py", line 71, in latitude return float(self.vehicle.location[0]) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TypeError: float() argument must be a string or a real number, not 'NoneType'