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.
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: