nitobuendia/oura-custom-component

[Bug] Workouts sensor does not produce any data

nitobuendia opened this issue · 4 comments

          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 #29 (comment)

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.

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.

Looking good now, thanks for this @nitobuendia !

image