Skip to content

Commit

Permalink
Merge pull request #56 from lukas-clarke/fix-unknown-side-sensor
Browse files Browse the repository at this point in the history
Adding assignment from eight user object for side sensor.
  • Loading branch information
lukas-clarke authored Oct 2, 2024
2 parents bfa792e + 889549f commit 5bd24d2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion custom_components/eight_sleep/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
"issue_tracker": "https://github.com/lukas-clarke/eight_sleep/issues",
"loggers": ["pyEight"],
"requirements": ["httpx", "aiohttp"],
"version": "1.0.16"
"version": "1.0.17"

}
8 changes: 7 additions & 1 deletion custom_components/eight_sleep/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,11 @@ def __init__(
self._attr_state_class = NAME_MAP[self._sensor].device_class
self._attr_device_class = NAME_MAP[self._sensor].state_class

if self._sensor != "sleep_stage" and self._sensor != "bed_state_type":
if (
self._sensor != "sleep_stage"
and self._sensor != "bed_state_type"
and self._sensor != "side"
):
self._attr_state_class = SensorStateClass.MEASUREMENT

if (
Expand Down Expand Up @@ -321,6 +325,8 @@ def native_value(self) -> str | int | float | None:
return self._user_obj.bed_state_type
if "last" in self._sensor:
return self._user_obj.last_sleep_score
if "side" == self._sensor:
return self._user_obj.side

if self._sensor == "bed_temperature":
return self._user_obj.current_values["bed_temp"]
Expand Down

0 comments on commit 5bd24d2

Please sign in to comment.