I was browsing the Share your Projects forum yesterday and saw someone had created a Zwift sensor using a separate Python script and MQTT.
Given that I hadn’t tried my hand at creating a custom component yet, I decided to take a whack at it for Zwift!
- Install HACS https://hacs.netlify.com/installation/manual/
- Go to the HACS store, search for “Zwift”, and follow the installation instructions!
- Grab all files from https://github.com/snicker/zwift_hass/blob/master/custom_components/zwift/ and drop into your
- Add a configuration similar to the one below to your HA configuration. Players should be a list of “player_id” numbers that you wish to track. Your own
player_idwill be automatically included unless you specify the
include_selfdirective in your sensor config and set it to
- Restart HomeAssistant
sensor: - platform: zwift username: !secret my_zwift_username password: !secret my_zwift_password players: - !secret my_friends_zwift_player_id
- Not sure how to create “binary” sensors from within a “sensor” platform, so currently the “online” binary sensor shows up as just a regular “sensor” even though I’m inheriting from
- Documentation and direct integration into HA