Just want to thank Snicker for such an awesome piece of work … so good. Have wired my 2x 3 speed fans and one single fan to esp with a relay…works like the bomb !! keep up the amazing work
One question I see there is no entity value for time riding, have read through the long thread above and didn’t see anything, is this a value the API allows for, would be awesome to have this as an additional control for my fans as HR isn’t always the best basis to trigger them
thanks @milsky99 I am glad it’s working well for you!
one choice I made in the past for this integration is to expose almost everything the API returns on the zwift_online_<ID> sensor as attributes, and users can use these attributes to make template sensors to reference them in markdown cards (as in this example)
to calculate “time riding”, this should work for you:
{% set value = states.sensor.zwift_online_<YOUR PLAYER ID>.attributes.latest_activity.duration %}
{% set parts = value.split(":") %}
{% if parts | length > 1 %}
{{ parts[0]}}h:{{'{:02}'.format(parts[1]| int)}}m
{% endif %}
make sure to edit the ID of the sensor on the first line with your player ID.
I have updated HACS to HACS 2.0 and now the Zwift integration isn’t working anymore. Probably this has something to do because the sensor platform has been removed. Does anyone of you have a solution?
I also don’t get any error reports, and somethings the integration is still reporting like e.g. your level. But when I start Zwifting the integration doesn’t report my heart rate, speed, cadence, etc. anymore. Please let me know if it is still working for you, when you start Zwifting because then it has something to do with my own setup.
Worked fine for me - I have LED lights that change colour based on power that work 100% as expected and all the sensor updated post ride with new data.
wanted to say, what a piece of work. i’ve reactivated my zwift account so that my structured workouts pull to zwift (instead of trainerroad) and now when i’m riding the room lights change colour according to the zone i’m riding in. chapeau to @phillprice for the code to make that work.
What would be the best way to differentiate a ride from a run?
Currently for a ride I check for Zwift online and start a fan based on heart rate and Spotify on Sonos. Can I add an “and if” Zwift Cycling Progress > 0 or something like that? Is there another cycling specific boolean that can be used as a condition?
New KICKR Run is in the house and the bike rig is in the garage, for now I’d just like it to not fire on the garage extras when I’m on the treadmill but eventually I would like to setup a different automation.
Take a look at the attributes for the sensor.zwift_online_(id) entity - you should have latest_activity.sport nested under there with RUNNING or CYCLING set.
Raising the feature request here based on what a feature, that was recently implemented with the Flight Radar 24 Integration.
Adding the ability to switch the integration “on” and “off”, or stopping / pausing the API request to Zwift. This will save bandwidth and reduce load on the Zwift API servers.
Creates the ability to pause the integration, when it is likely not needed, with Flight Radar 24 it is a switch in the integration that can you can toggle either manually or via an automation.
snicker, thanks so much for this integration. It’s fantastic!
I am seeing an issue where the in-ride speed and distance are very high. Has anyone else run into this? I see some screenshots in the thread that show accurate speed and distance, so I suspect this has something to do with my setup in particular. Is there some additional configuration needed for those two sensors to get the correct scale?
I’m going to switch to the zwift_online_<player-id> sensor for the distance and see if that’s more accurate, but I’d also like to be able to report the speed accurately, and I don’t believe that’s exposed in that sensor.
This is an example of what I’m seeing:
At the time, my speed was around 20 mph, and I’d ridden maybe a mile or two. I like Zwift, but I don’t have 270 miles on a stationary bike in me.
Turns out that I’m silly and bad at math. The issue is just that the distance is being reported in meters and the speed in kph. I made a couple of template sensors to convert them, and all is well. I’m not sure if this is a recent change to the API or not, but in case anyone else runs into this, here’s a snippet you can use to do the conversion.
@gsarjeant very odd- there is a field the integration receives from the Zwift API that tells whether the user has their settings in metric or not and then sets the appropriate units within the sensors. For some reason, that flag is likely coming as “useMetric = False” for your account, but still providing metric data (km/kmh)
I also assume useMetric = False if the field is missing from the API. Will you check the attributes on your “Zwift Online” sensor next time you are logged in to see if there is a “useMetric” field present and what the value is?
the short of it is that you shouldn’t need to do this conversion if you have your unit settings on your Zwift profile to use imperial units.