freakshock88/hass-populartimes

Cannot load sensor

Closed this issue · 8 comments

cflev commented

2019-11-12 23:03:10 ERROR (MainThread) [homeassistant.components.sensor] populartimes: Error on device update!
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 292, in _async_add_entity
await entity.async_device_update(warning=False)
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 450, in async_device_update
await self.hass.async_add_executor_job(self.update)
File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/populartimes/sensor.py", line 80, in update
self._attributes['popularity_monday'] = result["populartimes"][0]["data"]
KeyError: 'populartimes'

cflev commented

image

id: ChIJHZw7P9OYoRQR8MTTg5YZxrg

Thanks for the report. The issue seems to be that the library I'm using does not return popularity data for that place if I call it directly. I'm not sure why, because the data seems to be there when I lookup the place on Google Maps. Because the error is in the external library it's not something I can fix unfortunately.

It seems to be related to this issue in the library:
m-wrzr/populartimes#76

Are you using a VPN by chance?

cflev commented

No, I am using a local provider in Athens without VPN
image

I see. I'm not sure what's wrong then, but when the issue gets resolved in the dependency library, I will update this component.

cflev commented

I propose to create error checking in order to avoid this error in HA. I will uninstall your module until then..

Yes you're right, I need to add error handling. I'll do that when I have some free time.

I added some error handling in a new release.