On that note, this is a world I've recently taken a dive in to. I was about to roll a Pi Zero / ESP data logger to track distance travelled on my commuter bike for planning service intervals. Was keen on a solution that didn't involve draining a phone battery and remembering to start trips, a full bike computer, or smartwatch. After a bit of research I picked up a Garmin Speed Sensor 2 - highly recommend as a bit of stupidly effective tech.
The device straps around your hub and is essentially a coin battery and mems rotation sensor. In addition to running as an ANT+ peripheral it will operate standalone and log the last 300 hours of ride time then sync next time you open the app. Speed and distance is then inferred based on wheel circumference.
I wasn’t aware of the more modern ANT+ approach. Looking forward to a V2.