Coder Social home page Coder Social logo

codingcyclist / ha_strava Goto Github PK

View Code? Open in Web Editor NEW
75.0 9.0 29.0 41.82 MB

Pipe your Activity Data from Strava directly into Home Assistant

License: MIT License

Python 100.00%
strava strava-data home-assistant hass custom-component fitness fitness-tracker

ha_strava's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ha_strava's Issues

Feature request for YTD and All Time Elevation

Thanks for the sensors! This integration has been working great for me for over a year. I have been using it to set up goal tracking for distance inside my HA instance. However, with the upcoming Zwift Wahoo Climbing Challenge I was thinking about setting up something similar for tracking how much elevation I've tracked since a certain date/starting elevation. Is this something that is accessible and able to be exposed?

I know it's possible to get it for each activity, so I may end up just automating an addition to a text sensor or something if it's not possible to expose.

Error during installation

When I do "Configuration > Integrations and hit the "+"-symbol at the bottom. Search for "Strava Home Assistant" and click on the icon to add the Integration to Home Assistant" I got this error .

"
Aborted
Your Home Assistant Instance does not seem to have a public URL. The Strava Home Assistant integration requires a public URL
"

I have a working public Url , but for sure is missing something . Any suggestion ?

Add date timestamp attribute to sensors

Hi there!

First, thanks for this amazing integration, it works flawlessly! Thanks for spend time here :)

Said that, I'm trying to make some automation when I come home after running or biking but, in order to detect if I'm coming from doing some exercise I'd like to know how much time has passed since the activity 0 finished. I'd just need a timestamp to be able to make some simple date maths. I've seen you already have it but you are just using it as a formatted title so, would be possible to add a new attribute with the raw timestamp?

Thanks in advance!

Problem adding integration

Hi,

I have trouble installing the integration.
I enter my client id / secret, and the correct Strava site shows.
I press: Authorize, and the same website reloads.
I press Authorize again, and now I get 500 Internal Server Error - Server got itself in trouble

External URL is filled in correctly in HA as: https://asdfasdf.ui.nabu.casa/
Authorization callback domain in Strava is filled in as: asdfasdf.ui.nabu.casa
(without the https:// part, it does not allow a / )

Log messages are:

2020-11-05 11:38:00 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/aiohttp/web_protocol.py", line 418, in start
    resp = await task
  File "/usr/local/lib/python3.8/site-packages/aiohttp/web_app.py", line 458, in _handle
    resp = await handler(request)
  File "/usr/local/lib/python3.8/site-packages/aiohttp/web_middlewares.py", line 119, in impl
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 18, in request_context_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 72, in ban_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 127, in auth_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 129, in handle
    result = await result
  File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 160, in get
    return await super().get(request, flow_id)
  File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 92, in get
    result = await self._flow_mgr.async_configure(flow_id)
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 153, in async_configure
    result = await self._async_handle_step(flow, cur_step["step_id"], user_input)
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 201, in _async_handle_step
    result: Dict = await getattr(flow, method)(user_input)
  File "/usr/src/homeassistant/homeassistant/helpers/config_entry_oauth2_flow.py", line 270, in async_step_creation
    token = await self.flow_impl.async_resolve_external_data(self.external_data)
  File "/usr/src/homeassistant/homeassistant/helpers/config_entry_oauth2_flow.py", line 149, in async_resolve_external_data
    return await self._token_request(
  File "/usr/src/homeassistant/homeassistant/helpers/config_entry_oauth2_flow.py", line 178, in _token_request
    resp.raise_for_status()
  File "/usr/local/lib/python3.8/site-packages/aiohttp/client_reqrep.py", line 941, in raise_for_status
    raise ClientResponseError(
aiohttp.client_exceptions.ClientResponseError: 401, message='Unauthorized', url=URL('https://www.strava.com/oauth/token')
2020-11-05 11:38:07 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/aiohttp/web_protocol.py", line 418, in start
    resp = await task
  File "/usr/local/lib/python3.8/site-packages/aiohttp/web_app.py", line 458, in _handle
    resp = await handler(request)
  File "/usr/local/lib/python3.8/site-packages/aiohttp/web_middlewares.py", line 119, in impl
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 18, in request_context_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 72, in ban_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 127, in auth_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 129, in handle
    result = await result
  File "/usr/src/homeassistant/homeassistant/helpers/config_entry_oauth2_flow.py", line 406, in get
    await hass.config_entries.flow.async_configure(
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 153, in async_configure
    result = await self._async_handle_step(flow, cur_step["step_id"], user_input)
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 201, in _async_handle_step
    result: Dict = await getattr(flow, method)(user_input)
  File "/usr/src/homeassistant/homeassistant/helpers/config_entry_oauth2_flow.py", line 270, in async_step_creation
    token = await self.flow_impl.async_resolve_external_data(self.external_data)
  File "/usr/src/homeassistant/homeassistant/helpers/config_entry_oauth2_flow.py", line 149, in async_resolve_external_data
    return await self._token_request(
  File "/usr/src/homeassistant/homeassistant/helpers/config_entry_oauth2_flow.py", line 178, in _token_request
    resp.raise_for_status()
  File "/usr/local/lib/python3.8/site-packages/aiohttp/client_reqrep.py", line 941, in raise_for_status
    raise ClientResponseError(
aiohttp.client_exceptions.ClientResponseError: 401, message='Unauthorized', url=URL('https://www.strava.com/oauth/token')

Thank you for making this integration!

`My API Applications` not showing up in my strava profile

First of all thank you very much for all the work you put into this project and for the excellent documenation. The setup was very smooth, except a small issue: when I went to https://www.strava.com/settings/ there was no My API Applications option:

Screen Shot 2021-01-10 at 14 38 37

(Not sure if it affects anything, but I have Strava subscription and I live in Japan.)

Going directly to https://www.strava.com/settings/api worked:

Screen Shot 2021-01-10 at 14 39 03

After I created the application the My API Applications option always shows up.

It might be useful for others in a similar situation, and that's why I created this issue. Also it might be good to make a note in the readme, especially if others report similar behaviour. I don't mind sending a PR for this, if that helps.

Forked and added in fixes

Hi All,

Not sure if this is the right etiquette or not.. I took a look at the 10 forks and none of them seemed to be active so I've forked this here: https://github.com/madmic1314/ha_strava and applied the changes for the manifest and http issues.

I'm not a coder by any means (google, copy & paste is my limit), happy to maintain if people contribute changes. I use this integration for my Wife so have an interest in keeping it going.

If @codingcyclist come back or makes any changes will of course bow to his greater skills

All Sensor Values = -1

Hi there.

Just not able to get this Add-On to return my Strava data. All sensors result in -1:

What could I be doing wrong?

Logger: homeassistant
Source: custom_components/ha_strava/init.py:417
First occurred: 11:29:25 (1 occurrences)
Last logged: 11:29:25

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/aiohttp/connector.py", line 975, in _wrap_create_connection
return await self._loop.create_connection(*args, **kwargs) # type: ignore # noqa
File "/usr/local/lib/python3.8/asyncio/base_events.py", line 1025, in create_connection
raise exceptions[0]
File "/usr/local/lib/python3.8/asyncio/base_events.py", line 1010, in create_connection
sock = await self._connect_sock(
File "/usr/local/lib/python3.8/asyncio/base_events.py", line 924, in _connect_sock
await self.sock_connect(sock, address)
File "/usr/local/lib/python3.8/asyncio/selector_events.py", line 496, in sock_connect
return await fut
File "/usr/local/lib/python3.8/asyncio/selector_events.py", line 528, in _sock_connect_cb
raise OSError(err, f'Connect call failed {address}')
TimeoutError: [Errno 110] Connect call failed ('165.73.102.4', 8123)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/config/custom_components/ha_strava/init.py", line 560, in strava_startup_functions
await renew_webhook_subscription(
File "/config/custom_components/ha_strava/init.py", line 417, in renew_webhook_subscription
callback_response = await websession.get(url=config_data[CONF_CALLBACK_URL])
File "/usr/local/lib/python3.8/site-packages/aiohttp/client.py", line 527, in _request
conn = await self._connector.connect(
File "/usr/local/lib/python3.8/site-packages/aiohttp/connector.py", line 541, in connect
proto = await self._create_connection(req, traces, timeout)
File "/usr/local/lib/python3.8/site-packages/aiohttp/connector.py", line 898, in _create_connection
_, proto = await self._create_direct_connection(req, traces, timeout)
File "/usr/local/lib/python3.8/site-packages/aiohttp/connector.py", line 1057, in _create_direct_connection
raise last_exc
File "/usr/local/lib/python3.8/site-packages/aiohttp/connector.py", line 1026, in _create_direct_connection
transp, proto = await self._wrap_create_connection(
File "/usr/local/lib/python3.8/site-packages/aiohttp/connector.py", line 981, in _wrap_create_connection
raise client_error(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host dieneusels.duckdns.org:8123 ssl:default [Connect call failed ('165.73.102.4', 8123)]

HA Log:
2021-01-09 11:27:14 INFO (MainThread) [custom_components.ha_strava.config_flow] Successfully authenticated
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.setup] Setting up ha_strava
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.setup] Setup of domain ha_strava took 0.0 seconds
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.components.sensor] Setting up sensor.ha_strava
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.components.camera] Setting up camera.ha_strava
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.ha_strava entity: sensor.strava_0_0
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.ha_strava entity: sensor.strava_1_0
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.ha_strava entity: sensor.strava_2_0
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.components.sensor] Not adding entity Title & Date because it's disabled
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.ha_strava entity: sensor.strava_3_0
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.components.sensor] Not adding entity Title & Date because it's disabled
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.ha_strava entity: sensor.strava_4_0
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.components.sensor] Not adding entity Title & Date because it's disabled
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.ha_strava entity: sensor.strava_5_0
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.components.sensor] Not adding entity Title & Date because it's disabled
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.ha_strava entity: sensor.strava_6_0
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.components.sensor] Not adding entity Title & Date because it's disabled
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.ha_strava entity: sensor.strava_7_0
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.components.sensor] Not adding entity Title & Date because it's disabled
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.ha_strava entity: sensor.strava_8_0
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.components.sensor] Not adding entity Title & Date because it's disabled
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.ha_strava entity: sensor.strava_9_0
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.components.sensor] Not adding entity Title & Date because it's disabled
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.ha_strava entity: sensor.strava_0_1
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.ha_strava entity: sensor.strava_1_1
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.ha_strava entity: sensor.strava_2_1
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.components.sensor] Not adding entity Duration because it's disabled
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.ha_strava entity: sensor.strava_3_1
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.components.sensor] Not adding entity Duration because it's disabled
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.ha_strava entity: sensor.strava_4_1
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.components.sensor] Not adding entity Duration because it's disabled
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.ha_strava entity: sensor.strava_5_1
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.components.sensor] Not adding entity Duration because it's disabled
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.ha_strava entity: sensor.strava_6_1
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.components.sensor] Not adding entity Duration because it's disabled
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.ha_strava entity: sensor.strava_7_1
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.components.sensor] Not adding entity Duration because it's disabled
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.ha_strava entity: sensor.strava_8_1
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.components.sensor] Not adding entity Duration because it's disabled
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.ha_strava entity: sensor.strava_9_1
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.components.sensor] Not adding entity Duration because it's disabled
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.ha_strava entity: sensor.strava_0_2
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.ha_strava entity: sensor.strava_1_2
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.ha_strava entity: sensor.strava_2_2
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.components.sensor] Not adding entity Pace because it's disabled
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.ha_strava entity: sensor.strava_3_2
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.components.sensor] Not adding entity Pace because it's disabled
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.ha_strava entity: sensor.strava_4_2
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.components.sensor] Not adding entity Pace because it's disabled
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.ha_strava entity: sensor.strava_5_2
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.components.sensor] Not adding entity Pace because it's disabled
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.ha_strava entity: sensor.strava_6_2
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.components.sensor] Not adding entity Pace because it's disabled
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.ha_strava entity: sensor.strava_7_2
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.components.sensor] Not adding entity Pace because it's disabled
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.ha_strava entity: sensor.strava_8_2
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.components.sensor] Not adding entity Pace because it's disabled
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.ha_strava entity: sensor.strava_9_2
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.components.sensor] Not adding entity Pace because it's disabled
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.ha_strava entity: sensor.strava_0_3
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.ha_strava entity: sensor.strava_1_3
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.ha_strava entity: sensor.strava_2_3
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.components.sensor] Not adding entity Distance because it's disabled
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.ha_strava entity: sensor.strava_3_3
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.components.sensor] Not adding entity Distance because it's disabled
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.ha_strava entity: sensor.strava_4_3
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.components.sensor] Not adding entity Distance because it's disabled
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.ha_strava entity: sensor.strava_5_3
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.components.sensor] Not adding entity Distance because it's disabled
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.ha_strava entity: sensor.strava_6_3
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.components.sensor] Not adding entity Distance because it's disabled
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.ha_strava entity: sensor.strava_7_3
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.components.sensor] Not adding entity Distance because it's disabled
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.ha_strava entity: sensor.strava_8_3
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.components.sensor] Not adding entity Distance because it's disabled
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.ha_strava entity: sensor.strava_9_3
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.components.sensor] Not adding entity Distance because it's disabled
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.ha_strava entity: sensor.strava_0_4
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.ha_strava entity: sensor.strava_1_4
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.ha_strava entity: sensor.strava_2_4
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.components.sensor] Not adding entity Trophies because it's disabled
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.ha_strava entity: sensor.strava_3_4
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.components.sensor] Not adding entity Trophies because it's disabled
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.ha_strava entity: sensor.strava_4_4
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.components.sensor] Not adding entity Trophies because it's disabled
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.ha_strava entity: sensor.strava_5_4
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.components.sensor] Not adding entity Trophies because it's disabled
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.ha_strava entity: sensor.strava_6_4
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.components.sensor] Not adding entity Trophies because it's disabled
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.ha_strava entity: sensor.strava_7_4
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.components.sensor] Not adding entity Trophies because it's disabled
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.ha_strava entity: sensor.strava_8_4
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.components.sensor] Not adding entity Trophies because it's disabled
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.ha_strava entity: sensor.strava_9_4
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.components.sensor] Not adding entity Trophies because it's disabled
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.ha_strava entity: sensor.strava_0_5
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.ha_strava entity: sensor.strava_1_5
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.ha_strava entity: sensor.strava_2_5
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.components.sensor] Not adding entity Kudos because it's disabled
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.ha_strava entity: sensor.strava_3_5
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.components.sensor] Not adding entity Kudos because it's disabled
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.ha_strava entity: sensor.strava_4_5
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.components.sensor] Not adding entity Kudos because it's disabled
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.ha_strava entity: sensor.strava_5_5
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.components.sensor] Not adding entity Kudos because it's disabled
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.ha_strava entity: sensor.strava_6_5
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.components.sensor] Not adding entity Kudos because it's disabled
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.ha_strava entity: sensor.strava_7_5
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.components.sensor] Not adding entity Kudos because it's disabled
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.ha_strava entity: sensor.strava_8_5
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.components.sensor] Not adding entity Kudos because it's disabled
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.ha_strava entity: sensor.strava_9_5
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.components.sensor] Not adding entity Kudos because it's disabled
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.ha_strava entity: sensor.strava_stats_summary_ytd_run_distance
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.ha_strava entity: sensor.strava_stats_summary_all_run_distance
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.ha_strava entity: sensor.strava_stats_summary_ytd_run_moving_time
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.ha_strava entity: sensor.strava_stats_summary_all_run_moving_time
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.ha_strava entity: sensor.strava_stats_summary_ytd_run_activity_count
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.ha_strava entity: sensor.strava_stats_summary_all_run_activity_count
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.ha_strava entity: sensor.strava_stats_summary_ytd_ride_distance
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.ha_strava entity: sensor.strava_stats_summary_all_ride_distance
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.ha_strava entity: sensor.strava_stats_summary_ytd_ride_moving_time
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.ha_strava entity: sensor.strava_stats_summary_all_ride_moving_time
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.ha_strava entity: sensor.strava_stats_summary_ytd_ride_activity_count
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.ha_strava entity: sensor.strava_stats_summary_all_ride_activity_count
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.ha_strava entity: sensor.strava_stats_summary_ytd_swim_distance
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.ha_strava entity: sensor.strava_stats_summary_all_swim_distance
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.ha_strava entity: sensor.strava_stats_summary_ytd_swim_moving_time
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.ha_strava entity: sensor.strava_stats_summary_all_swim_moving_time
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.ha_strava entity: sensor.strava_stats_summary_ytd_swim_activity_count
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.ha_strava entity: sensor.strava_stats_summary_all_swim_activity_count
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new camera.ha_strava entity: camera.strava_cam
2021-01-09 11:27:14 INFO (MainThread) [homeassistant.components.camera] Not adding entity strava_cam because it's disabled

Can't retrieve photos

With "camera.strava_cam", as shown in the example, I couldn't seem to get any pictures back.
Is this sensor still working as expected?

Errors in HA log

Installation went fine. But now I got these errors in my HA log and sensor data does not update.

HA 2020.12.7
Supervisor on Ubuntu 18 / docker

IndexError: list index out of range
2021-01-03 16:23:57 ERROR (MainThread) [homeassistant] Error doing job: Future exception was never retrieved
Traceback (most recent call last):
File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/ha_strava/sensor.py", line 403, in strava_data_update_event_handler
self._data = event.data["activities"][self._activity_index]
IndexError: list index out of range
2021-01-03 16:23:57 ERROR (MainThread) [homeassistant] Error doing job: Future exception was never retrieved
Traceback (most recent call last):
File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/ha_strava/sensor.py", line 403, in strava_data_update_event_handler
self._data = event.data["activities"][self._activity_index]
IndexError: list index out of range
2021-01-03 16:23:57 ERROR (MainThread) [homeassistant] Error doing job: Future exception was never retrieved
Traceback (most recent call last):
File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/ha_strava/sensor.py", line 403, in strava_data_update_event_handler
self._data = event.data["activities"][self._activity_index]
IndexError: list index out of range
2021-01-03 16:23:57 ERROR (MainThread) [homeassistant] Error doing job: Future exception was never retrieved
Traceback (most recent call last):
File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/ha_strava/sensor.py", line 403, in strava_data_update_event_handler
self._data = event.data["activities"][self._activity_index]
IndexError: list index out of range
2021-01-03 16:23:57 ERROR (MainThread) [homeassistant] Error doing job: Future exception was never retrieved
Traceback (most recent call last):
File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/ha_strava/sensor.py", line 403, in strava_data_update_event_handler
self._data = event.data["activities"][self._activity_index]
IndexError: list index out of range
2021-01-03 16:23:57 ERROR (MainThread) [homeassistant] Error doing job: Future exception was never retrieved
Traceback (most recent call last):
File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/ha_strava/sensor.py", line 403, in strava_data_update_event_handler
self._data = event.data["activities"][self._activity_index]
IndexError: list index out of range
2021-01-03 16:23:57 ERROR (MainThread) [homeassistant] Error doing job: Future exception was never retrieved
Traceback (most recent call last):
File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/ha_strava/sensor.py", line 403, in strava_data_update_event_handler
self._data = event.data["activities"][self._activity_index]
IndexError: list index out of range
2021-01-03 16:23:57 ERROR (MainThread) [homeassistant] Error doing job: Future exception was never retrieved
Traceback (most recent call last):
File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/ha_strava/sensor.py", line 403, in strava_data_update_event_handler
self._data = event.data["activities"][self._activity_index]
IndexError: list index out of range

Extract date from latest activity

I have been using the Strava integration and love it.

I'm needing a bit of motivation to get up and go in the morning so I have set up an automation for my Google Home to let me know the weather and also the last time I ran and what disance.

I am having a problem with the date element of this.

The sensor that shows the last date and time is sensor.strava_0_0 (friendly name).

So I first added this to TTS:

Your last running day was on the {{ state_attr('sensor.strava_0_0', 'friendly_name'}}

But my Google Home read it out wrong. Ten point zero eight blah blah blah

So I then tried creating a sensor

 strava_last_date:
         friendly_name: strava last activity
         value_template: "{{ state_attr('sensor.strava_0_0', 'friendly_name') }}"

and splitting it:

Your last running day was on the {{states.sensor.strava_last_date.state.split(".")[0] }} of {{states.sensor.strava_last_date.state.split(".")[1] }}  with a distance of {{states.sensor.strava_0_3.state}}

But this also gets read out kind of wrong.

How can I convert my sensor (sensor.strava_last_date) to a date? Once I get it into a date I could then start playing around with TTS saying 'Your last running day was' yesterday, or 2 days ago ect

Much appreciated if someone could give me a hand.

Remove distance unit of measurement from sensors

I live in the UK where we use Miles but Strava provides our distances in KM. The distance sensor 0.3 / 1.3 etc, provided by this integration, adds km to the end of this sensor therefore a templates sensor to convert it to miles is not possible. Looking at your code it will either return Miles or KM depending on if HA is set for metric or Imperial - is there a way to add an option on the integration to set metric or Imperial ?

{{ states.sensor.strava_0_3.state | float * 0.621371 | round(2) }}
{{ states.sensor.strava_1_3.state | float * 0.621371 | round(2) }}

error

Can I suggest that the unit of measurement on this sensor is removed so that its value can be manipulated with a template sensor or a sensor to provide both the distance in Miles & KM or provide a why to set it in the integration ?

distance

ha_strava gives error after upgrade to Home Assistant 2022.3.1

I get the following errors after upgrading to Home Assistant 2022.3.1:
2022-03-06 00:15:25 ERROR (SyncWorker_4) [homeassistant.util.package] Unable to install package aiohttp==3.6.1: ERROR: Cannot install aiohttp==3.6.1 because these package versions have conflicting dependencies. ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/topics/dependency-resolution/#dealing-with-dependency-conflicts 2022-03-06 00:15:33 ERROR (SyncWorker_1) [homeassistant.util.package] Unable to install package aiohttp==3.6.1: ERROR: Cannot install aiohttp==3.6.1 because these package versions have conflicting dependencies. ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/topics/dependency-resolution/#dealing-with-dependency-conflicts 2022-03-06 00:15:42 ERROR (SyncWorker_6) [homeassistant.util.package] Unable to install package aiohttp==3.6.1: ERROR: Cannot install aiohttp==3.6.1 because these package versions have conflicting dependencies. ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/topics/dependency-resolution/#dealing-with-dependency-conflicts 2022-03-06 00:15:42 ERROR (MainThread) [homeassistant.setup] Setup failed for custom integration ha_strava: Requirements for ha_strava not found: ['aiohttp==3.6.1'].
Maybe (prabably) because of this, HA_strava is not working anymore.
Might there be other integrations that require a different version of aiohttp? And haw could I identify them, if that is the problem?

Stats only shows Public entries

Thanks a lot for this Integration! One question, my stats in Strava do not correspond with the stats in this integration. I would think it has to do with some entries which I mark Private in Strava. Is it possible to show the stats in the integration which include the private entries?

Requirements in manifest.json

Would it be possible to change the requirements in the manifest.json file to be:
"requirements": ["aiohttp>=3.6.1", "voluptuous>=0.11.7"],

i.e. >= rather than ==
as Home Assistant core already includes these packages but at a higher version - https://github.com/home-assistant/core/blob/dev/requirements.txt - so it would save having to install the older versions as well. It seems to work fine like this.

And just as a heads up, a version will be required in the manifest.json soon too - https://developers.home-assistant.io/blog/2021/01/29/custom-integration-changes#versions

Integration doesn't show up on list

Running HA version 2020.12.2 and HACS version 1.9.0.

Added the repository for ha_strava, and the directory shows up in custom_components.

For some reason I don't get an option to add the integration in configuration. No errors at all in the log (enabled debug logging on custom_components).

I'm sure I'm doing something wrong here, but I could use ideas on how to troubleshoot.

image

image

sensor.strava_0_0 state / attributes

First of all.

I really like this integration. Great work

This is not an issue more a design question.
My personal option is to have one sensor per activity. fill the state with eg. distance or name and use the attributes for the details.
this way you have less sensors and all info combined per sensor.

0.1.1 is not installable. Corrupts existing installation.

I received notification of the available 0.1.1 update in HACS. However, attempting to update simply throws the following errors, AND the existing ha_strava folder under custom_components is deleted.

Looking at the recent changes, it appears you deleted LICENSE, README.md, hacs.json, info.md, and several image files from the repo. Was that intentional?

Logger: custom_components.hacs.api.repository_data
Source: custom_components/hacs/api/hacs_repository_data.py:116
Integration: HACS (documentation, issues)
No content to download

Logger: custom_components.hacs.repository.integration.codingcyclist.ha_strava
Source: custom_components/hacs/repositories/integration.py:88
Integration: HACS (documentation, issues)
No file found 'custom_components/None/manifest.json'

Dual authorization cycle - second fails

The Oauth workflow for me:

  1. Enter Client Id and Secret

  2. Redirected to Stava Authorization page.

  3. After clicking "Authorize", redirected to HA again - displaying "This step requires you to visit an external website to be completed."

  4. Click "Open Website" in HA, redirected to the Stava Authorization page a second time.

  5. After clicking "Authorize", Stava reports: "500 Internal Server Error - Server got itself in trouble"

BR,

Normann

HA Strava fails to startup with HA 2022.5

HA Strava was all working fine on 2022.4.7....testing on 2022.5 and getting the following error on start

Setup failed for custom integration ha_strava: Unable to import component: cannot import name 'EVENT_TIME_CHANGED' from 'homeassistant.const' (/usr/src/homeassistant/homeassistant/const.py)

Any idea what might be causing the issue...have had a look about and cant see anyone else reporting

Adding the Strava Home Assistant Integration

Unable to add the Strava Home Assistant Integration.

When trying to install, I get the following message:

"Please wait while the integration is being installed"

The message appears for a while and the integration doesn't install.

Cannot add Strava to integrations

I had Strava working before but it stopped working so I deleted it. I then reinstalled it via HACS, restarted but now I cannot see the integration when I select + in integrations and search Strava

HA version: Home Assistant 2021.12.1

Exception in log

Hi, I get an exception in the log recently:

2021-01-25 09:08:52 ERROR (MainThread) [homeassistant] Error doing job: Future exception was never retrieved
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/ha_strava/camera.py", line 168, in img_update_handler
    self._urls = {
TypeError: unhashable type: 'slice'

I see it every time I reboot HA.

Everything seems to work fine, so no need to do anything. I just thought I'd share it.

Thanks!

Integration doesn't show up in Home Assistant

Wow, that's super weird. Removed and readded the repository and it showed up under integrations immediately (I did this before opening the issue). Added clientid/secret and sensors are there and working. Computers are weird, will close this one out.

I have exact the same issue. I also did the same "steps" you did, only unfortunately for me the Strava integration doesn't show up.

Originally posted by @Fleshi1981 in #21 (comment)

0.1.1.

Same here....not working with hacs

ha_strava not running on 2021.12.0b2

I'm running 2021.12.0b2 and am getting the following error:

Logger: homeassistant.setup
Source: setup.py:153
First occurred: 1:41:17 PM (1 occurrences)
Last logged: 1:41:17 PM

Setup failed for ha_strava: Unable to import component: cannot import name 'HTTP_OK' from 'homeassistant.const' 
(/usr/src/homeassistant/homeassistant/const.py)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.