nitobuendia / oura-custom-component

Oura Custom Component for Home-Assistant. Adds Oura Ring sleep information.
108 stars 25 forks source link

[Bug] Today's data not available on workout sensor #29

Closed akeslo closed 1 year ago

akeslo commented 1 year ago

Hey @nitobuendia - working my way down the list backporting what I use to this component. Looks like I'm hitting a similar issue with the workout sensor that could benefit from the code update here: https://github.com/nitobuendia/oura-custom-component/issues/26

image

Config

     workouts:
       name: oura_workouts
       max_backfill: 0
       monitored_dates:
        - 0d_ago
        - 1d_ago
        - 7d_ago

image

nitobuendia commented 1 year ago

Both sensors will use the same base sensor and should receive the update. In other words, this should be solved with the same fix as #26.

akeslo commented 1 year ago

@nitobuendia didn't seem to fix it for me on my end. Same config as above, the sensor returns "Unknown".

image

nitobuendia commented 1 year ago

What do you see on attributes when the state is unknown?

akeslo commented 1 year ago

What do you see on attributes when the state is unknown?

There are zero attributes

nitobuendia commented 1 year ago

That's not expected. Are you sure that's not an old sensor? Can you see if you can remove it or if there's an oura_workouts_2. Is your config the same shared before?

akeslo commented 1 year ago

Very odd, it doesn't appear to be an old sensor. I even tried swapping the name. Not sure what it could be. I don't see anything useful in the logs.

image

Config is now

  - platform: oura
    access_token: <token>
    scan_interval: 600
    sensors:
     sleep:
       name: oura_sleep_metrics
       max_backfill: 0
       monitored_dates:
        - 0d_ago
        - 1d_ago
        - 2d_ago
        - 3d_ago
        - 4d_ago
        - 5d_ago
        - 6d_ago
        - 7d_ago
        - 8d_ago
     sleep_periods:
       name: oura_sleep_periods
       max_backfill: 0
       monitored_dates:
        - 0d_ago
        - 1d_ago
        - 7d_ago       
     sleep_score:
       name: oura_sleep_score
       max_backfill: 0 
       monitored_dates:
        - 0d_ago
        - 1d_ago
        - 2d_ago
        - 3d_ago
        - 4d_ago
        - 5d_ago
        - 6d_ago
        - 7d_ago
        - 8d_ago
     workouts:
        name: oura_workouts
        max_backfill: 0
        monitored_dates:
        - yesterday
        - 0d_ago
        - 1d_ago
        - 2d_ago
        - 3d_ago
        - 4d_ago
        - 5d_ago
        - 6d_ago
        - 7d_ago
        - 8d_ago
     activity:
       name: oura_activity
       max_backfill: 0
       monitored_dates:
        - 0d_ago
        - 1d_ago
        - 2d_ago
        - 3d_ago
        - 4d_ago
        - 5d_ago
        - 6d_ago
        - 7d_ago
        - 8d_ago
       monitored_variables:
        - day
        - active_calories
        - high_activity_time
        - low_activity_time
        - medium_activity_time
        - non_wear_time
        - resting_time
        - sedentary_time
        - score
        - target_calories
        - total_calories
        - steps
     heart_rate:
       name: oura_heartrate
       max_backfill: 0
       monitored_dates:
        - 0d_ago
     readiness:
       name: oura_readiness
       max_backfill: 0
       monitored_dates:
        - 0d_ago
        - 1d_ago
        - 2d_ago
        - 3d_ago
        - 4d_ago
        - 5d_ago
        - 6d_ago
        - 7d_ago
        - 8d_ago
nitobuendia commented 1 year ago

Your screenshot shows a sensor called oura_recoredworkouts which (has a typo) and doesn't appear on your config.

akeslo commented 1 year ago

I temporarily changed it to that name to prove it wasn't a ghost entity or old entity, sorry if that wasn't clear. typo is irrelevant, no matter what name I use I get unknown and no attributes. Is there any logging I can enable with this integration? I have all logs set to info and I'm not seeing much.

Thanks.

image

akeslo commented 1 year ago

I just temporarily renamed the sensor to oura_workouts2, same thing....

     workouts:
        name: oura_workouts2
        max_backfill: 0
        monitored_dates:
        - yesterday
        - 0d_ago
        - 1d_ago
        - 2d_ago
        - 3d_ago
        - 4d_ago
        - 5d_ago
        - 6d_ago
        - 7d_ago
        - 8d_ago

image

nitobuendia commented 1 year ago

Thanks for posting with matching config and screenshot.

I can reproduce the issue too with the same configuration.

You can enable logs with the logger component, but I do not expect this to return a lot more of what you may be getting already.

A sample config:

default: info
logs:
  homeassistant.custom_components.oura: debug
  custom_components.oura: debug
nitobuendia commented 1 year ago

This looks different than the original issue, so I've opened #31 to track it.