Skip to content

Commit

Permalink
add more native_unit_of_measurement and state_class
Browse files Browse the repository at this point in the history
  • Loading branch information
jcgoette committed Dec 11, 2021
1 parent e506612 commit 6bbadbe
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions custom_components/babybuddy/const.py
Expand Up @@ -107,6 +107,7 @@ class BabyBuddyEntityDescription(SensorEntityDescription, SwitchEntityDescriptio
icon="mdi:sleep",
key=ATTR_SLEEP,
native_unit_of_measurement=TIME_MINUTES,
state_class=STATE_CLASS_MEASUREMENT,
state_key=lambda value: int(
time_period_str(value[ATTR_DURATION]).total_seconds() / 60
),
Expand All @@ -127,6 +128,8 @@ class BabyBuddyEntityDescription(SensorEntityDescription, SwitchEntityDescriptio
BabyBuddyEntityDescription(
icon="mdi:baby",
key=ATTR_TUMMY_TIMES,
native_unit_of_measurement=TIME_MINUTES,
state_class=STATE_CLASS_MEASUREMENT,
state_key=lambda value: int(
time_period_str(value[ATTR_DURATION]).total_seconds() / 60
),
Expand Down

0 comments on commit 6bbadbe

Please sign in to comment.