Skip to content

Commit

Permalink
Merge pull request #219 from dckiller51/state_class
Browse files Browse the repository at this point in the history
Set state_class as class variable
  • Loading branch information
dckiller51 authored Jan 5, 2024
2 parents 08301d7 + d825220 commit dbdf4be
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion custom_components/bodymiscale/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,8 @@ async def async_setup_entry(
class BodyScaleSensor(BodyScaleBaseEntity, SensorEntity): # type: ignore[misc]
"""Body scale sensor."""

_attr_state_class = SensorStateClass.MEASUREMENT

def __init__(
self,
handler: BodyScaleMetricsHandler,
Expand All @@ -187,7 +189,6 @@ def __init__(
| (Callable[[StateType, Mapping[str, Any]], Mapping[str, Any]]) = None,
):
super().__init__(handler, entity_description)
self.entity_description.state_class = SensorStateClass.MEASUREMENT
self._metric = metric
self._get_attributes = get_attributes

Expand Down

0 comments on commit dbdf4be

Please sign in to comment.