nitobuendia / oura-custom-component

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

[Bug] Workouts sensor does not produce any data #31

Closed nitobuendia closed 1 year ago

nitobuendia 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

Originally posted by @akeslo in https://github.com/nitobuendia/oura-custom-component/issues/29#issuecomment-1406583778

nitobuendia commented 1 year ago

nitobuendia commented 1 year ago

What seems to be happening is that the WORKOUTS endpoint is returning no data: 2023-01-28 21:35:08.357 ERROR (SyncWorker_2) [root] {'data': [], 'next_token': None}

When that happens, self._update terminates early and does not finish setting up the sensor even with the empty default values.

nitobuendia commented 1 year ago

This should be fixed now. You will probably get a sensor with "unknown" as the state. However, the attributes should be present for the monitored days. If all the days and values are null, that means that you do not have workouts data for those specific days - which I think it's what was triggering this error.

akeslo commented 1 year ago

Looking good now, thanks for this @nitobuendia !

image