hemantkamalakar / haconfigs

My Home-Assistant configuration files
60 stars 20 forks source link

Google Fit not working from today #5

Closed advokatb closed 5 years ago

advokatb commented 5 years ago

I see Object unawailable: sensor.google_fit_sleep in HA frontend and

2019-04-02 15:08:47 ERROR (MainThread) [homeassistant.components.sensor] google_fit: Error on device update!
Traceback (most recent call last):
  File "d:\program\python\python36\lib\site-packages\homeassistant\helpers\entity_platform.py", line 248, in _async_add_entity
    await entity.async_device_update(warning=False)
  File "d:\program\python\python36\lib\site-packages\homeassistant\helpers\entity.py", line 379, in async_device_update
    await self.hass.async_add_executor_job(self.update)
  File "d:\program\python\python36\lib\asyncio\futures.py", line 331, in __iter__
    yield self  # This tells Task to wait for completion.
  File "d:\program\python\python36\lib\asyncio\tasks.py", line 244, in _wakeup
    future.result()
  File "d:\program\python\python36\lib\asyncio\futures.py", line 244, in result
    raise self._exception
  File "d:\program\python\python36\lib\concurrent\futures\thread.py", line 55, in run
    result = self.fn(*self.args, **self.kwargs)
  File "d:\program\python\python36\lib\site-packages\homeassistant\util\__init__.py", line 224, in wrapper
    result = method(*args, **kwargs)
  File "d:\program\python\python36\lib\site-packages\homeassistant\util\__init__.py", line 224, in wrapper
    result = method(*args, **kwargs)
  File "d:\User\.homeassistant\custom_components\google_fit\sensor.py", line 630, in update
    bed_time = datetime.fromtimestamp(round(min(starts) / 1000))
ValueError: min() arg is an empty sequence

in my logs

emouawad commented 5 years ago

I am having the same error.

2019-04-17 07:52:44 ERROR (MainThread) [homeassistant.components.sensor] google_fit: Error on device update! Traceback (most recent call last): File "/usr/local/lib/python3.7/site-packages/homeassistant/helpers/entity_platform.py", line 261, in _async_add_entity await entity.async_device_update(warning=False) File "/usr/local/lib/python3.7/site-packages/homeassistant/helpers/entity.py", line 379, 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 "/usr/local/lib/python3.7/site-packages/homeassistant/util/__init__.py", line 224, in wrapper result = method(*args, **kwargs) File "/usr/local/lib/python3.7/site-packages/homeassistant/util/__init__.py", line 224, in wrapper result = method(*args, **kwargs) File "/config/custom_components/google_fit/sensor.py", line 630, in update bed_time = datetime.fromtimestamp(round(min(starts) / 1000)) ValueError: min() arg is an empty sequence

alexandre-leites commented 5 years ago

I have the same error. I think it is when we don't record sleep the component throws an error. Any fix?

hemantkamalakar commented 5 years ago

Regret the delay in reply. I have now updated the custom component with the fix.