Giter Site home page Giter Site logo

Comments (7)

edwork avatar edwork commented on June 7, 2024 1

Please see release 0.7.0 - all problems discussed in this thread should be taken care of.

https://github.com/edwork/homeassistant-peloton-sensor/releases/tag/0.7.0

Thanks!

from homeassistant-peloton-sensor.

edwork avatar edwork commented on June 7, 2024

Yes - these Logger statements are too aggressive. I'll work on a hotfix, feel free to submit a PR in the meantime if you want to enhance logging in other areas too.

I do think there's an additional error that in already aware of. Since I've only really run this for bike sessions I've only looked at attributes for bike sessions. When meditating, boxing, walking, etc the attributes I'm explicitly asking for are missing causing the exception to be raised. When the exception is called it also stops looking for more attributes.

To fix this the attribute section needs rebased to tolerate failed attribute lookups and lookup different attributes for different types of workouts.

from homeassistant-peloton-sensor.

mdegat01 avatar mdegat01 commented on June 7, 2024

Ah yea ok I see how this works. My sensor is breaking at L115 because my last workout was a stretch and those don't have a distance summary. My wife's is breaking at L117 because although here last workout was cycling we don't have a heart monitor so those metrics are missing.

I can probably put in a quick fix for this in a bit. Although I think long-term as #25 progresses you might want to think about bumping these attributes out into their own sensors. That would give a few benefits:

  1. Users can individually disable sensors they don't need or can't use (like the heart beat one for me)
  2. More of this data can be easily exposed to users. I had no idea how much data was in this API until I started poking around for this bug. If each field was its own sensor its easier to expose far more of it since each user can just disable the sensors they don't care about. Can't really do that when the data becomes attributes on one sensor.
  3. Fits better with the new features around long-term statistics HA has been pushing, could be handy to see those kind of metrics for your peloton data over time.

from homeassistant-peloton-sensor.

mdegat01 avatar mdegat01 commented on June 7, 2024

lookup different attributes for different types of workouts

Actually FYI, this isn't safe. You can have a peloton membership without owning any of their equipment if you just like the classes. We did that for a while before we decided to get a bike, just did the classes using the app while on some random bike we got off facebook marketplace. When you do a class using the app like that it can't track most of the metrics like "Resistance", "Calories", "Speed", etc. even though we did a cycling class.

The simplest thing is obviously just to make it very fault-tolerant but then you won't get warnings when the API changes like you want. Alternatively you'd have to consider not just the type of exercise but probably also add some new config options like:

  1. Do you have a heart rate monitor connected?
  2. What peloton-connected equipment do you have? Bike, treadmill, etc.

It would be pretty tough honestly. There's lot of variations to consider if trying for true completeness. What if they have a bike and a treadmill but only one has a heart rate monitor? What are the API differences between V1 and V2 bike, enough that you have to separately prompt for version? etc.

from homeassistant-peloton-sensor.

tony1661 avatar tony1661 commented on June 7, 2024

Hi @mdegat01 I've issued a PR to fix the logs when you do not have a heart rate monitor. If @edwork accepts them then you can use the following in your config:

sensor:
  - platform: peloton
    username: tony1661
    password: ********
    hr_monitor: false

Let me know if that helps with your wife's issue on Line 117.

If you'd like to test before my PR before it gets merged (if it does), you can change your sensor.py file to have my changes: sensor.py

Also, my update also fixed the speed for people using KPH

from homeassistant-peloton-sensor.

edwork avatar edwork commented on June 7, 2024

Thanks all,

Regarding the speed logic, thanks for pointing this out. I'll make sure the changes are released soon.

Regarding the sensors crashing extra measurements I am working on a larger fix for this because it's not just limited to the heart rate sensor. For example when doing a stretch exercise on your phone, tablet, or TV there are a bunch of objects that don't populate causing further sensors to crash.

I am planning on putting each statement in a separate try-except where the except will throw a logger.debug message for those who have debugging enabled.

I'll try to have these changes finished soon, in the meantime look out for updates via HACS (shameless plug for this integration being in the default HACS repo now!).

from homeassistant-peloton-sensor.

edwork avatar edwork commented on June 7, 2024

@tony1661 I'm going to merge the PR for both the heart rate monitor setting + speed fix, but I may end up deprecating the setting in favor of the fault tolerant logic.

I won't push out a release yet but will continue testing with these changes. Keep an eye on the devel branch for additional updates.

Thanks!

from homeassistant-peloton-sensor.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.