I have done as ctowers recommended to install.
I had already done the 1st step when I set up my calender.
In order to generate your client_id and client_secret, see the prerequisites for Google Calender component: https://www.home-assistant.io/components/calendar.google/#prerequisites
I then enabled the Fitness API
To make sensor work you have to enable Fintness API in your project. In oder to enable Fitness API open Google cloud console: https://console.cloud.google.com/apis/library/fitness.googleapis.com and enable API.
I presume I use the same client_id and client_secret as I have with my calender?
I then continued to configure my /config/configuration.yaml
sensor:
- platform: google_fit
name: Mark
client_id: redacted
client_secret: redacted
After restarting HA I did the following
After restarting HomeAssistant, you should se a notification such as:
In order to authorize Home-Assistant to view your Google Fit data you must visit: https://www.google.com/device and enter code: XXXX-XXXX
After following this step and restarting Home Asssistant, I get the following errors in my log.
Log Details (ERROR)
Logger: homeassistant.components.sensor
Source: custom_components/google_fit/sensor.py:253
Integration: Sensor (documentation, issues)
First occurred: 14:21:35 (1 occurrences)
Last logged: 14:21:35
Error while setting up google_fit platform for sensor
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 186, in _async_setup_platform
await asyncio.gather(*pending)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 295, in async_add_entities
await asyncio.gather(*tasks)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 446, in _async_add_entity
entity.async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 297, in async_write_ha_state
self._async_write_ha_state() # type: ignore
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 324, in _async_write_ha_state
attr.update(self.device_state_attributes or {})
File "/config/custom_components/google_fit/sensor.py", line 253, in device_state_attributes
return self._attributes
AttributeError: 'GoogleFitWeightSensor' object has no attribute '_attributes'
What am i missing?