nitobuendia / oura-custom-component

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

Activity Sensor #38

Closed maco2035 closed 11 months ago

maco2035 commented 11 months ago

I am encountering an issue where the activity sensor doesn't give the day attribute back in the sensor. It looks like either the api changed, and docs didn't or there is an issue with parsing them which causes issue.

nitobuendia commented 11 months ago

@maco2035 Hi, what issue or error are you getting? Can you share the logs for the error?

maco2035 commented 11 months ago

The issue is within the attributes of activity, there is no date that comes back to activity entity. Thus, when using the apex graph shown in the example there isn't anything populating.

maco2035 commented 11 months ago

Here is photo showing what I mean. Screenshot_20231204_073056_Home Assistant

maco2035 commented 11 months ago

I did some scanning on my log files, I can't find anything that shows that there is any error with the oura.

nitobuendia commented 11 months ago

What I can see there is that the data is actually loading. What you're missing is just the date. My guess is that it's not added to your monitored_attributes. Could you kindly share your YAML config for this component?

maco2035 commented 11 months ago
- platform: oura
    scan_interval: 300 # 5mins = 5min * 60 seconds
    access_token: 4HJGC2CGC5TBACBCWDK2PWRP5WTOTNEJ
    sensors:
      sleep_score:
        name: oura_sleep_score
        max_backfill: 10
        monitored_dates:
        - 0d_ago
        - 1d_ago
        - 2d_ago
        - 3d_ago
        - 4d_ago
        - 5d_ago
        - 6d_ago
        - 7d_ago
        - 8d_ago
      sleep:
        name: oura_sleep_metrics
        max_backfill: 10
        monitored_dates:
        - 0d_ago
        - 1d_ago
        - 2d_ago
        - 3d_ago
        - 4d_ago
        - 5d_ago
        - 6d_ago
        - 7d_ago
        - 8d_ago
      activity:
        name: oura_activity
        max_backfill: 10
        monitored_dates:
        - 0d_ago
        - 1d_ago
        - 2d_ago
        - 3d_ago
        - 4d_ago
        - 5d_ago
        - 6d_ago
        - 7d_ago
        - 8d_ago
      readiness:
        name: oura_readiness
        max_backfill: 10
        monitored_dates:
        - 0d_ago
        - 1d_ago
        - 2d_ago
        - 3d_ago
        - 4d_ago
        - 5d_ago
        - 6d_ago
        - 7d_ago
        - 8d_ago

So for this I would need to add monitored_variables: day to the oura_activity? The read me wasn't clear about this in the custom score card config.

nitobuendia commented 11 months ago

So for this I would need to add monitored_variables: day to the oura_activity? The read me wasn't clear about this in the custom score card config.

If your premise that day missing is the main root cause for the issue, yes. More accurately, you would need to add monitored_variables: day, but also all the required monitored attributes (e.g. score).


Unfortunately, I don't use that custom chart. @akeslo is the main source for it. @akeslo , do you know which monitored_attributes are required for the two graphs on the README? The documentation seems to indicate that the default values are enough, but @maco2035 seems to indicate that's not the case. Thanks!

akeslo commented 11 months ago

Hi @maco2035, yes you are right it is using the day variable. Sorry this wasn't clear, the configuration pictured is missing the monitored_variables and needs an update. Good catch, I'll send a PR shortly @nitobuendia

maco2035 commented 11 months ago

@nitobuendia @akeslo Thanks for the updates, I made a pr for this. I just added date as a default monitored_variables, as I think it is more inline with what a sensor should have by default, and other sensors have it on be default too.

nitobuendia commented 11 months ago

@maco2035 Thanks for working on the pr #39 - This can be submitted. I have made a small request to keep the order of the names. I hope that's OK and thanks again.