edwork / homeassistant-peloton-sensor

A platform which allows you to get current and past ride data from Peloton into HomeAssistant
Apache License 2.0
78 stars 16 forks source link

Peloton website stats vs HA stats #1

Closed mikesalz closed 1 year ago

mikesalz commented 4 years ago

First, a huge THANK YOU for all of your hard work! This is awesome!

I did a comparison of the stats that show up in HA versus what is on the Peloton website. Screenshots and comments/questions/thoughts below. I thought it might be helpful for you to see someone else's account/stats in case it is different from yours. Thanks!

image

image

edwork commented 4 years ago

Great Feedback - I was having trouble deciding whether to show average/max information post-workout. Your annotations make sense and I'll make some slight modifications to the sensor. I agree that making the sensor reflect what you would see on the website makes the most sense.

I'll also work on configuration settings for MPH vs KM/h and units of measurement in general on each state attribute.

mikesalz commented 4 years ago

Hopefully all of my comments came across as constructive. I'm definitely not complaining! Let me know if I can help in any way, or if you'd like me to test anything on my end.

edwork commented 4 years ago

Everything was very constructive and welcome. I've just published release 0.3 which should be available in HACS or Here.

I added a few calculations to transform some of the measurements, added unit labels to the attributes (although they have to appear as part of the attribute's name). I also identified a problem causing the integration to crash while rides are in_progress.

Please let me know how this works!

mikesalz commented 4 years ago

Wow, there are a ton of attributes now! Looks great!

Am I correct that Output Kj is not populated until the end of the ride? I tried to look at it a few times during my ride this morning. Not easy! It showed as 0 well into the ride (even considering the 1 minute polling delay). But after the ride, it does show.

Also, wondering if the ride date is available in the API? I know the date of your last ride can be derived from Recorder, but I only keep a few days worth of data there. If it is available as an attribute, one could create a notification that says "Hey lazy ass, you haven't been on the bike in X days!"

And last question - When writing an automation, will the sensor state show as "Active" or "in_progress" while you are riding?

mikesalz commented 4 years ago

I just realized I didn't give you any feedback on the attribute data. It looks great! Some of the numbers differ from the Peloton website by a point, but that is negligible and I'm sure that's just a difference in rounding that is beyond your control.

edwork commented 4 years ago

Glad it's working better, here are some clarifying details and near future plans:

Hope this helps! Stay tuned for updates!

mikesalz commented 4 years ago

Just curious - Do you think we can poll Peloton's API more than once a minute? Or are you concerned they might blacklist the user's account if it is polled too often?

mikesalz commented 4 years ago

Sorry, ANOTHER question. Sorry to bug you!!

Is there a way to detect if the bike is on and someone is logged in to their profile, but hasn't necessarily started riding yet? Here's why: For myself, I want an automation that turns on a fan x minutes after the class has started or after x amount of output (I have not decided which yet). But my wife doesn't give a crap about automations and wants the fan to turn on as soon as she gets on the bike. I know, shame on her!

Just throwing use cases at you that you might not have thought of yet. Thoughts?

edwork commented 4 years ago

Hello!

Currently there's no way to tell if a user is logged into their profile (selected their bubble from the 'login' screen). I'm also trying to work out the best way to prepare for a ride aside from waiting for the sensor to kick in.

One idea I may play around with is checking out the power draw between the tablet sleeping and tablet with screen on. There should be a measurable increase in power (if only by a few watts), but then you'd still risk the tablet updating, etc. This might work in conjunction with a time range and motion sensor.

As for polling the API more frequently I'll look into the potential limitations that are in place. Since we're unofficially polling the API I do hesitate to poll more frequently. I'm familiar with a few other projects that use the unofficial API, so I'll reach out and see what I can find.

Thanks again for the feedback!

DimitriAyrapetov commented 3 years ago

Great work, Ed, this is fantastic!

As a wish-list item, it would be great if we could somehow trigger more-rapid polling when a motion sensor is triggered.

superm1 commented 3 years ago

Currently there's no way to tell if a user is logged into their profile (selected their bubble from the 'login' screen). I'm also trying to work out the best way to prepare for a ride aside from waiting for the sensor to kick in.

Are you aware of the Android adb integration for HA? It has me wondering if maybe an adb shell would be able to better sniff processes to tell when a stream is active.

ifeign commented 3 years ago

Currently there's no way to tell if a user is logged into their profile (selected their bubble from the 'login' screen). I'm also trying to work out the best way to prepare for a ride aside from waiting for the sensor to kick in.

Are you aware of the Android adb integration for HA? It has me wondering if maybe an adb shell would be able to better sniff processes to tell when a stream is active.

This is a cool idea, since it would work locally

edwork commented 3 years ago

Thanks all for the input - this is still on my radar and after a rough springtime I'm getting back on the bike and will address some of these suggestions in the coming weeks. Stay Tuned!

kylewilliams321 commented 3 years ago

This is great!

edwork commented 2 years ago

Just released Version 0.6.0 that resolves some problems with state attributes updating. Now that things are back to working as intended I'll take a closer look at the online stats vs the api stats.

mikesalz commented 2 years ago

@edwork Just curious - Do you have any plans on adding this as an official HA integration?

edwork commented 2 years ago

I do, in the meantime I'm working on getting it into the default HACS list for more discoverability - see this pr.

If the integration can remain stable (including my response time to resolving bugs) and I can work to make the state attributes a little more streamlined I'll work on getting it into mainline HASS.

Maybe aiming for the first or second release of 2022 would be a good idea 🎉🎉🎉.

Thanks everyone for the collaboration!

edwork commented 1 year ago

Since version 0.8 was released some major changes were made fixing the root cause of this bug. If there are still issues please feel free to reopen this issue or create a new issue.

Thanks!