Zwift Sensor Component - Feedback and Testers Needed

you can check the “attributes” of the Online sensor to see if it is present. if its not there, then the Zwift API is not exposing it (yet?)

Will check when im gonna try it for the first time tomorrow :slight_smile:

Thank you.
With my Govee LED strip I had to address RGBWW channels (rgbww_color:) and add an extra warm white number (all ‘0’).

Testing it by running each of the six actions within each option, it behaves well. During a test ride on my kickr nothing happens. The colors don’t change. The power sensor does receive my watts though. And I am in CYCLING mode and online.

Hey everyone, could someone type up some actual instructions on how to setup this integration? I appreciate the work that’s been done so far, but all the tasks are over my head on how to get the configuration working. I notice a lot of the nomenclature doesn’t actually align with what is being posted.

  1. I went into HACS, searched for Zwift and “downloaded” (not installed) the add on.
  2. I restarted HA, and am now seeing Zwift in my downloaded HACS store.
  3. I assume I need to enter my username and password, but do I just replace the “!secret my_zwift_username and !secret my_zwift_password”? It looks like it’s greened out.
  4. Once I do this, do the individual Zwift outputs start to show up in the Zwift categories within the HACS section of “devices and services”? or are there other steps?

Thanks, any additional clarity would be much appreciated.

GitHub - snicker/zwift_hass: Zwift Sensor Integration for HomeAssistant Gives more clarity.

You can put the data directly into the configuration.yaml or configure it like described in the doc.

the “!secret” simply creates a like to a file named “secret.yaml” to not store your Zwift Credentials inside the configration.yaml

You do not have to use the players section if you only want to follow your own avatar.

After a restart of HA these sensor will created.

Regarding the update interval i found this issue on github

I just tested it for a few min, but it looks very responsive.

Ok, this works pretty well:

The sensor “sensor.zwift_online_xxxxxxx” also provides an attribute of your current FTP ingame.

i created a template sensor which returns the current Power Zone calculated on this attribute

name: sensor.zwift_power_zone
type: template sensor

{% set power = states('sensor.zwift_power_xxxxx') | float(0) %}
{% set ftp = state_attr('sensor.zwift_online_xxxxx', 'ftp') | float(0) %}
{% set pct = (power / ftp * 100) if ftp > 0 else 0 %}

{% if pct < 60 %}
  1
{% elif pct < 76 %}
  2
{% elif pct < 90 %}
  3
{% elif pct < 105 %}
  4
{% elif pct < 119 %}
  5
{% else %}
  6
{% endif %}

I then used this sensor in an automation to control a Govee LED Strip via the Govee2MQTT Bridge. i just gave it a quick spin, but this works very well.

I have a dumb fan with 3 modes/intensities which desperately wants to get smarter and hooked on Zwift/HA. What exactly, hardware wise, do I need to make that possible? A 3 or 4 channel relay is enough? What would you use if you would build one today?

something similar to this would work:

depending on the fan, it might be possible or not. If the fan has three different conductors going to the motor controlled by a manual switch, you need to interrupt those conductors with the relays on the board linked above.

I used a Sonoff 4ch relay for the added benefit of being powered by 120V AC so I could power that and the fan from a single cord.

I’m not a electrician tech guy, I rather buy something more ‘ready’ (plug & play) for direct implementation via 3, 4 wires. I see Sonoff and Shelly 4 channel relays for sale. Are these modules more or less the same inside as the board you propose?

[edit]
This is a picture of the speed controller on my fan.

if you’re not much of an electrician, you may not necessarily want to embark on this journey, but just consider that a warning.

that looks like a physical switch so likely that fan will work. a sonoff 4CH relay will work. there’s likely another cable/cord that runs from that speed controller to the motor with 4 wires in it.

one wire will always be “hot” and probably passed through directly from the cord that plugs into the wall. the other three will be the wires associated with speeds 1, 2, and 3.

you would want to wire nut the incoming hot wire that currently goes straight to the fan motor, and split the other incoming wire from the plug into the “common” terminal of three relays.

you may want to check with a voltmeter with the old switch still attached, some fan switches apply 120V to all three wires when the speed setting is 3, others will only apply to the wire that is “on”.

mine was only 120V applied to the selected speed. here are my esphome configs:

use and follow these instructions at your own risk, I take no responsibility : )

1 Like

Instead of Sonoff, a Shelly i4 Gen3 device will work too correct?

yes though i would recommend flashing a custom esphome firmware on it to manage relay interlocking and expose it as a fan entity natively rather than a bunch of switches. the thread below has some guidance for pinouts and such

actually upon closer look, im not sure the shelly can actually control four loads, it appears that it just has four inputs, so it would not work.

Yes, that’s the reason I asked, I was in doubt after reading about those four inputs. They mention four scenes.
When asking AI the answer is:
No, the Shelly Plus i4 (and i4 DC) cannot directly drive or power loads (like lights, motors, or relays) on its inputs. The i4 is designed specifically as an input-only controller to monitor switch states or dry contacts and trigger other Shelly devices, scenes, or HTTP/MQTT commands.

So back to Sonoff, what specific Sonoff device do you recommend using for switching a 3 speed AC fan?

this is the one i used
https://www.aliexpress.com/item/4000986016757.html

1 Like

this would also work and can be powered with 120/220V, but lacks a case and input buttons

1 Like

I ordered one of these
Tuya Smart Home Wifi Switch Module

I received my Tuya/eWeLink 4-channel 250V Smart Switch controller. What’s on next? Should I install esphome configuration file? Or first flash with Tasmota? Or just leave it stock? I rather not use any cloud.

I now have ESPHome installed as a docker container next to a separate Home Assistant container and I can browse to ESPHome via a non-secure http on my local lan.
I guess I have to create a new device and paste the correct YAML code inside of that and save or compile that correct? How do I get that data into the device itself? I can connect the Tuya controller to my host machine on which the Dockers run. Is that the way to go?

I came here to sort out some of the numbers I’m seeing. I’m new to this btw, thank you for making it. I’m definitely going to be having fun with this.

Anyway, I think what I was wondering is related to this: `useMetric` field from API may not be interpreted correctly. · Issue #58 · snicker/zwift_hass · GitHub

Any further info on it? I’m trying to figure out what the data I’m seeing actually means. is metric is false for me.

My height is: 1753
Weight is 85700
My recent ride was: 38088 miles

And, as I typed that, I figured it out. millimeters, grams, metres.

I suppose if I want to utilize any of this data in displays, I’d need to convert? I’m guessing that can be done with … templates or something? I’m newer to HA, I’m sure I can search and figure it out - does anyone have any examples of doing such? Thanks!