Skip to content

Commit

Permalink
Add state_class to OHM sensors (home-assistant#125567)
Browse files Browse the repository at this point in the history
* Minimum change required to get OHW into statistics

Not sure if there is any reason not to have this, my only idea would be that there would be that there are A LOT of values, but as far as I can see there are already long term data being stored about them anyway

* Update sensor.py

Guess that was an old way of doing it -_-

* Update sensor.py

remove spaces the break ruff -_-

* Update sensor.py

ruff is rough
  • Loading branch information
silentguy256 authored Sep 10, 2024
1 parent d8bb8f1 commit 379a8f2
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions homeassistant/components/openhardwaremonitor/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from homeassistant.components.sensor import (
PLATFORM_SCHEMA as SENSOR_PLATFORM_SCHEMA,
SensorEntity,
SensorStateClass,
)
from homeassistant.const import CONF_HOST, CONF_PORT
from homeassistant.core import HomeAssistant
Expand Down Expand Up @@ -60,6 +61,8 @@ def setup_platform(
class OpenHardwareMonitorDevice(SensorEntity):
"""Device used to display information from OpenHardwareMonitor."""

_attr_state_class = SensorStateClass.MEASUREMENT

def __init__(self, data, name, path, unit_of_measurement):
"""Initialize an OpenHardwareMonitor sensor."""
self._name = name
Expand Down

0 comments on commit 379a8f2

Please sign in to comment.