cyberjunky / home-assistant-google_fit

:hearts: This component tracks your Google Fit activities.
MIT License
99 stars 20 forks source link

Unable to make it work #17

Closed alexkutsan closed 2 years ago

alexkutsan commented 2 years ago

Can't get it to work. HASS logs :


home-assistant       | 2021-12-21 00:13:47 ERROR (MainThread) [homeassistant.components.sensor] Error adding entities for domain sensor with platform google_fit
home-assistant       | Traceback (most recent call last):
home-assistant       |   File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 382, in async_add_entities
home-assistant       |     await asyncio.gather(*tasks)
home-assistant       |   File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 613, in _async_add_entity
home-assistant       |     await entity.add_to_platform_finish()
home-assistant       |   File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 748, in add_to_platform_finish
home-assistant       |     self.async_write_ha_state()
home-assistant       |   File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 505, in async_write_ha_state
home-assistant       |     self._async_write_ha_state()
home-assistant       |   File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 545, in _async_write_ha_state
home-assistant       |     self.device_state_attributes is not None
home-assistant       |   File "/config/custom_components/google_fit/sensor.py", line 247, in device_state_attributes
home-assistant       |     return self._attributes
home-assistant       | AttributeError: 'GoogleFitWeightSensor' object has no attribute '_attributes'
home-assistant       | 2021-12-21 00:13:47 ERROR (MainThread) [homeassistant.components.sensor] google_fit: Error on device update!
home-assistant       | Traceback (most recent call last):
home-assistant       |   File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 431, in _async_add_entity
home-assistant       |     await entity.async_device_update(warning=False)
home-assistant       |   File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 684, in async_device_update
home-assistant       |     await task
home-assistant       |   File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run
home-assistant       |     result = self.fn(*self.args, **self.kwargs)
home-assistant       |   File "/usr/src/homeassistant/homeassistant/util/__init__.py", line 195, in wrapper
home-assistant       |     result = method(*args, **kwargs)
home-assistant       |   File "/usr/src/homeassistant/homeassistant/util/__init__.py", line 195, in wrapper
home-assistant       |     result = method(*args, **kwargs)
home-assistant       |   File "/config/custom_components/google_fit/sensor.py", line 428, in update
home-assistant       |     heartrate_datasources = self._get_datasources('com.google.heart_rate.bpm')
home-assistant       |   File "/config/custom_components/google_fit/sensor.py", line 272, in _get_datasources
home-assistant       |     datasources_request = self._client.users().dataSources().list(
home-assistant       | AttributeError: 'NoneType' object has no attribute 'users'
...
![image](https://user-images.githubusercontent.com/860357/146839922-e3d2a207-abbc-4caa-b761-2cb358fa46dc.png)

Credentials seems to be correct.
![image](https://user-images.githubusercontent.com/860357/146840539-caf2b496-ee01-48a1-a10b-61543fc98521.png)
What am I doing wrong ? 
emp-sean commented 2 years ago

See this post perhaps: https://github.com/cyberjunky/home-assistant-google_fit/issues/12#issuecomment-939447451

cyberjunky commented 2 years ago

Stale issue, please update to latest version and (re)open ticket if needed.