Skip to content

Commit

Permalink
Add long-term statistics to sensors.
Browse files Browse the repository at this point in the history
Increased to version 0.4.27
  • Loading branch information
tschamm committed Mar 11, 2022
1 parent e45c653 commit 77f6ac1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion custom_components/bosch_shc/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"config_flow": true,
"documentation": "https://github.com/tschamm/boschshc-hass/blob/master/README.md",
"requirements": ["boschshcpy==0.2.30"],
"version": "0.4.26",
"version": "0.4.27",
"zeroconf": [{ "type": "_http._tcp.local.", "name": "bosch shc*" }],
"iot_class": "local_push",
"issue_tracker": "https://github.com/tschamm/boschshc-hass/issues",
Expand Down
11 changes: 10 additions & 1 deletion custom_components/bosch_shc/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@
from boschshcpy import SHCSession
from boschshcpy.device import SHCDevice

from homeassistant.components.sensor import SensorDeviceClass, SensorEntity
from homeassistant.components.sensor import (
SensorDeviceClass,
SensorEntity,
SensorStateClass,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import (
CONCENTRATION_PARTS_PER_MILLION,
Expand Down Expand Up @@ -162,6 +166,7 @@ class TemperatureSensor(SHCEntity, SensorEntity):

_attr_device_class = SensorDeviceClass.TEMPERATURE
_attr_native_unit_of_measurement = TEMP_CELSIUS
_attr_state_class = SensorStateClass.MEASUREMENT

def __init__(self, device: SHCDevice, parent_id: str, entry_id: str) -> None:
"""Initialize an SHC temperature reporting sensor."""
Expand All @@ -180,6 +185,7 @@ class HumiditySensor(SHCEntity, SensorEntity):

_attr_device_class = SensorDeviceClass.HUMIDITY
_attr_native_unit_of_measurement = PERCENTAGE
_attr_state_class = SensorStateClass.MEASUREMENT

def __init__(self, device: SHCDevice, parent_id: str, entry_id: str) -> None:
"""Initialize an SHC humidity reporting sensor."""
Expand All @@ -198,6 +204,7 @@ class PuritySensor(SHCEntity, SensorEntity):

_attr_icon = "mdi:molecule-co2"
_attr_native_unit_of_measurement = CONCENTRATION_PARTS_PER_MILLION
_attr_state_class = SensorStateClass.MEASUREMENT

def __init__(self, device: SHCDevice, parent_id: str, entry_id: str) -> None:
"""Initialize an SHC purity reporting sensor."""
Expand Down Expand Up @@ -300,6 +307,7 @@ class PowerSensor(SHCEntity, SensorEntity):

_attr_device_class = SensorDeviceClass.POWER
_attr_native_unit_of_measurement = POWER_WATT
_attr_state_class = SensorStateClass.MEASUREMENT

def __init__(self, device: SHCDevice, parent_id: str, entry_id: str) -> None:
"""Initialize an SHC power reporting sensor."""
Expand All @@ -318,6 +326,7 @@ class EnergySensor(SHCEntity, SensorEntity):

_attr_device_class = SensorDeviceClass.ENERGY
_attr_native_unit_of_measurement = ENERGY_KILO_WATT_HOUR
_attr_state_class = SensorStateClass.TOTAL_INCREASING

def __init__(self, device: SHCDevice, parent_id: str, entry_id: str) -> None:
"""Initialize an SHC energy reporting sensor."""
Expand Down

0 comments on commit 77f6ac1

Please sign in to comment.