It would be useful to have physiological variables triggering things. Fortunately there is already a simple way of communicating with sports devices using the ANT+ protocol, the hardware needed is simply a cheap USB stick and the “thisisant’ website already provides Linux drivers.
The values it gives are simply positive integers. For example it might say your heart rate is 60. Alternative types of data are cycling power, cycling speed, cycling cadence, run pace, run cadence etc. and these are updated every second typically (the allowable range is defined in the ANT profile page). There are other things such as weight etc. They all tend to be fitness related to have an ANT+ Profile. ANT without the plus after can be anything, but the + denotes a profile and there are only some of them.
As well as the major data types there are minor data transmitted less frequently by some devices, such as “ground contact time”, “vertical oscillation” etc. They can be just ignored.
A heart rate chest strap using the ANT+ protocol is cheap. More comfortable wrist based devices are more expensive and have shorter battery lives.
An alternative would be to use Bluetooth, but the connection is encrypted and true pairing occurs. No real pairing happens in ANT+. Each device has a short ID code that things learn and watches etc. call this pairing. Thereafter it basically just sniffs the data and uses data from devices with that code.
It is possible to do what the USB does with a chip I forget the name of. AP something, but the USB things are so cheap and most devices running HA have USB. I doubt the downloadable drivers from the official website would help also, although I haven’t read on it.
Hence, I think ANT+ is better than BT and that USB is better than chip based. I’ve started to learn Python and will then learn HA, but thought I’d just see what other people thought in case there is a better way of doing this. I’m aware of the “Zwift” integration, but it’s locked down to Zwift and not local. I’ve also looked at Zwift alternatives, including the Free Open Source one and not found any public API. They all connect to ANT+ already. Can anyone think of a better way of doing this?
The linux driver is apparently beta and the forum announcing it hasn’t had an update since 2019.
This is what the site says
A Linux SDK for ANTUSB2 and ANTUSB-m sticks is currently in Beta. Please refer to this forum post for more details.
Linux drivers are not currently being planned for the ANTUSB1 stick or ANT-UIF interface board (based on the CP2102 USB to UART chipset). It may be possible to design your own Linux drivers for these devices by utilizing the Virtual Comport drivers from SiLabs. Please visit the SiLabs website for more details.
Now the CP2102 is well supported in linux, so that may indeed be easy, but has anyone done it?
Nice idea, I am sure people will look forward to your implementation.
The Open Source software called “Golden Cheetah” has a live training mode that has been able to display ANT+ data for about a decade. I’m not entirely sure when they included the workout mode but it was already there when I first used it in 2013. You can now connect Bluetooth (at least in development builds) but ANT+ was the original. That software is cross-platform but is developed on Linux. I suspect the driver is one that will never come out of beta and the change from USB1 to USB2 is so old I’ve never even seen a USB1 on EBay.
My fallback if I have problems connecting to the USB is to expose an API myself in Golden Cheetah. It’s graphically very basic. I suspect it’d run on most things running HA these days. I actually suggested to them that they expose the data through a simple API but I did a bad job of making an automation sound interesting. Being able to turn on fans etc. when HR goes above a value etc. would be good but I did really badly at selling the concept & my suggestion was compared to another that involved phoning out to a specific server requesting specific data to a training utility I’ve never heard of.
Edited to add. The ‘real-time’ node was introduced in version 1.3. I think this was released in about 2010. The current version is 3.5 and it began in 2006. Looked through their old change logs.
I haven’t, but not because it is hard. Because I have been doing other stuff, mostly actually training which is what I wanted it for. Also I installed a Zigbee button that sticks on and is battery powered. I’m not training much at the moment though. May reinvigorate this idea.