Skip to content

Commit

Permalink
Merge pull request #28 from lukas-clarke/fix-timestamp-attributes
Browse files Browse the repository at this point in the history
Adding fix for timestamp attribute state & device classes.
  • Loading branch information
lukas-clarke authored Apr 21, 2024
2 parents 3308a64 + fa936ba commit c1eea00
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 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.11"
"version": "1.0.12"

}
12 changes: 7 additions & 5 deletions custom_components/eight_sleep/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,15 +281,17 @@ def __init__(
self._attr_native_unit_of_measurement = NAME_MAP[self._sensor].measurement
self._attr_state_class = NAME_MAP[self._sensor].device_class
self._attr_device_class = NAME_MAP[self._sensor].state_class
elif (

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

if (
self._sensor == "next_alarm"
or self._sensor == "presence_start"
or self._sensor == "presence_end"
):
self._attr_state_class = SensorDeviceClass.TIMESTAMP

if self._sensor != "sleep_stage" and self._sensor != "bed_state_type":
self._attr_state_class = SensorStateClass.MEASUREMENT
self._attr_device_class = SensorDeviceClass.TIMESTAMP
self._attr_state_class = None

_LOGGER.debug(
"User Sensor: %s, Side: %s, User: %s",
Expand Down

0 comments on commit c1eea00

Please sign in to comment.