itchannel / fordpass-ha

Fordpass integration for Home Assistant
301 stars 53 forks source link

Odometer Entity Not Created #55

Closed pbnj4640 closed 3 years ago

pbnj4640 commented 3 years ago

I have all the expected entities available with the exception of the odometer.

https://imgur.com/a/euFIhmc

itchannel commented 3 years ago

Can you please check your Home Assistant log and let me know if you have any errors from the fordpass Integration

pbnj4640 commented 3 years ago

Yes I am. My car (I guess) doesn't support GPS?

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 316, in async_add_entities await asyncio.gather(*tasks) File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 507, in _async_add_entity await entity.add_to_platform_finish() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 531, in add_to_platform_finish self.async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 296, in async_write_ha_state self._async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 320, in _async_write_ha_state sstate = self.state File "/config/custom_components/fordpass/sensor.py", line 199, in state return self.get_value("state") File "/config/custom_components/fordpass/sensor.py", line 51, in get_value return self.coordinator.data[self.sensor]["gpsState"] TypeError: 'NoneType' object is not subscriptable

pbnj4640 commented 3 years ago

Also device tracker

Error adding entities for domain device_tracker with platform fordpass Error while setting up fordpass platform for device_tracker Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 316, in async_add_entities await asyncio.gather(*tasks) File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 507, in _async_add_entity await entity.add_to_platform_finish() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 531, in add_to_platform_finish self.async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 296, in async_write_ha_state self._async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 320, in _async_write_ha_state sstate = self.state File "/usr/src/homeassistant/homeassistant/components/device_tracker/config_entry.py", line 103, in state if self.latitude is not None: File "/config/custom_components/fordpass/device_tracker.py", line 28, in latitude return float(self.coordinator.data[self.sensor]["latitude"]) TypeError: 'NoneType' object is not subscriptable

itchannel commented 3 years ago

Looks like it. Will add in a check to mark the sensor as unavailable in the next release.

itchannel commented 3 years ago

I have fixed the two above errors so it now checks to see if your car supports GPS before adding the tracker entity. Let me know if this doesn't fix the odometer issue but hoping now the tracker issue is resolved the script should be fine.

pbnj4640 commented 3 years ago

This solved it! Thanks