[Refactoring] Split sleep sensor in two
nitobuendia opened this issue · 2 comments
nitobuendia commented
Currently Sleep sensor relies on Sleep Periods API to retrieve the data. I believe this would break the code if multiple sleep periods happen on the same time. This is because Sleep Periods behave similar to Sessions or Workouts in #21.
The idea for workaround here is to split Sleep sensor into two:
- Sleep: we keep the current sleep sensor as is. In order to avoid the problem above, we will filter only sleep periods which are of type long_sleep. Other sleep periods will be ignored.
- Sleep Periods: we create a new sensor that will contain an array of sleep periods, following the model of #21 sensors.
nitobuendia commented
This is now technically completed and working. Nonetheless, filtering of sleep type has not been done yet.
nitobuendia commented
This is now completed on oura-v2. This will be closed when merged into the main branch.