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!
- Grab https://github.com/snicker/twohunnid_ha/blob/master/custom_components/sensor/zwift.py 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
sensor: - platform: zwift username: !secret my_zwift_username password: !secret my_zwift_password players: - !secret my_friends_zwift_player_id
- Restart HomeAssistant
- I want to include altitude in the sensors, but I cannot figure out what the hell the units are for altitude as reported by the Zwift API.
- 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