Yesterday the integration still worked fine for me.
Zwift had the servers down for a big maintenance window on Monday, you might find you just need to restart Home Assistant to get it to reconnect.
Am I right observing that averageWatts
is only populated after the activity has finished? The only field I saw changing was the duration
.
I’m keen on having an avg watts/kg figure visible when riding. Has any body worked out how to do this?
You could rely on states.sensor.zwift_online_XXXXXX.attributes.latest_activity.avgWatts
and divide that by your kg. This seems to update infrequently during a ride but it’s not real time.
Another alternative (also with drawbacks) is using the statistics
integration, but you would only be able to sample the previous X hours of your power and get that average to divide by your mass. it would be real time, but it would also include previous activities that happened within the max_age
timeframe (or exclude data for rides longer than max_age
)… probably not a major issue for most people.
there is a more complicated solution that would require a modification to the Zwift integration itself is to calculate the average for each activity as it is happening and expose that as a sensor. I won’t have an opportunity to do this any time soon so please let me know if one of the solutions above works for you.
Yeah, i did look at the latest activity for the avg. But in my short test, about 4km it didn’t update. Do you know what the update interval is on that?
I thought about the statistics, but it’s a shame that i can’t template max_age. I’ll have a think what’s the best solution. Taking a long time segment might not be the way forward, as I’ll do a warm up ride, before a proper workout, so that would skew the avg. The other option is a shorter rolling avg, but that might defy the objective.
Ok, so it looks updates are every 10mins coinciding with the last saved event. Once saved, the avg Watts g figure appears. Not ideal, but probably the best at the moment.
Hey sorry for the dumb question but I was wondering if someone could post the YAML for an automation that listens out for ride-on events? I want to make the lights flash when it happens but I’m not enormously familiar with HA events or how to access attributes, so it’s all a bit over my head. Cheers!
Is anyone having issues after updating to 2023.4.5?
I had it all working until this morning.
Now I am getting this message in the log:
Could not create Zwift sensor named ‘Zwift’!
Thanks for letting me know, than I will wait with updating
i have installed zwift on home assistant and include the code in configuration.yaml, but only the update sensor turns up; anything that i need to do over at zwift before it works?
i am running on a rpi4
this is the log:
This error originated from a custom integration.
Logger: custom_components.zwift.sensor
Source: custom_components/zwift/sensor.py:341
Integration: zwift (documentation)
First occurred: 15:52:21 (1 occurrences)
Last logged: 15:52:21
Could not create Zwift sensor named ‘Zwift’!
Traceback (most recent call last):
File “/config/custom_components/zwift/sensor.py”, line 124, in async_setup_platform
await zwift_data._connect()
File “/config/custom_components/zwift/sensor.py”, line 341, in _connect
from zwift import Client as ZwiftClient
File “/usr/local/lib/python3.10/site-packages/zwift/init.py”, line 4, in
from .client import Client
File “/usr/local/lib/python3.10/site-packages/zwift/client.py”, line 5, in
from .world import World
File “/usr/local/lib/python3.10/site-packages/zwift/world.py”, line 2, in
from . import zwift_messages_pb2
File “/usr/local/lib/python3.10/site-packages/zwift/zwift_messages_pb2.py”, line 35, in
_descriptor.FieldDescriptor(
File “/usr/local/lib/python3.10/site-packages/google/protobuf/descriptor.py”, line 561, in new
_message.Message._CheckCalledFromGeneratedFile()
TypeError: Descriptors cannot not be created directly.
If this call came from a _pb2.py file, your generated code is out of date and must be regenerated with protoc >= 3.19.0.
If you cannot immediately regenerate your protos, some other possible workarounds are:
- Downgrade the protobuf package to 3.20.x or lower.
- Set PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python (but this will use pure-Python parsing and will be much slower).
More information: Changes made on May 6, 2022 | Protocol Buffers Documentation
hey all, I’ve released an update for this issue:
for the details:
- a newer version of protobuf was released
- the zwift-client library did not pin to a specific version of protobuf
- the compiled data structure for zwift in the library is not compatible with the new version of protobuf
the upstream library will need to be updated eventually but this work around seems functional for now. there may be some concerns with performance, so please keep me updated if the updates seem to lag or be slow from the integration)
Thanks for the great work on fixing the issue and also for this awesome integration!
Ride On!
Running HA on 2023.4.6 and using Release V3.3.1
but still have this error im my logs:
Could not create Zwift sensor named ‘Zwift’!
Traceback (most recent call last):
File “/config/custom_components/zwift/sensor.py”, line 124, in async_setup_platform
await zwift_data._connect()
File “/config/custom_components/zwift/sensor.py”, line 343, in _connect
from zwift import Client as ZwiftClient
File “/usr/local/lib/python3.10/site-packages/zwift/init.py”, line 4, in
from .client import Client
File “/usr/local/lib/python3.10/site-packages/zwift/client.py”, line 5, in
from .world import World
File “/usr/local/lib/python3.10/site-packages/zwift/world.py”, line 2, in
from . import zwift_messages_pb2
File “/usr/local/lib/python3.10/site-packages/zwift/zwift_messages_pb2.py”, line 35, in
_descriptor.FieldDescriptor(
File “/usr/local/lib/python3.10/site-packages/google/protobuf/descriptor.py”, line 561, in new
_message.Message._CheckCalledFromGeneratedFile()
TypeError: Descriptors cannot not be created directly.
If this call came from a _pb2.py file, your generated code is out of date and must be regenerated with protoc >= 3.19.0.
If you cannot immediately regenerate your protos, some other possible workarounds are:
- Downgrade the protobuf package to 3.20.x or lower.
- Set PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python (but this will use pure-Python parsing and will be much slower).
hey @bedee, not sure if you saw this post above:
if you update to 3.3.1 in HACS you should see this error disappear.
Hi @snicker
Thanks for your reply. Yes i’ve seen your note and upgrade to 3.3.1 is done. But unfortunately i still have this error.
Just to check, does anyone else also have this error? Because then I wait with updating
@Fleshi
so far i face still same issue. all updated but not working anymore. Unfortunately, I didn’t get any other feedback so far…
All errors disappeared for me after updating. Everything working as expected.
I also updated and for me everything is also working fine .
Now steering has been made available in Zwift, is there any possibility of this integration adding triggers for Left/Right, which could be linked in HA to say zigbee push buttons or a mini joystick for free turning?