Skip to content

Commit

Permalink
Merge pull request #77 from explosivo22/dev
Browse files Browse the repository at this point in the history
changes for 2025.1 deprecations
  • Loading branch information
explosivo22 authored Mar 19, 2024
2 parents 0022dba + 96225b2 commit da39874
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 13 deletions.
2 changes: 1 addition & 1 deletion custom_components/rinnaicontrolr-ha/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
"documentation": "https://github.com/explosivo22/rinnaicontrolr-ha/",
"codeowners": [ "@explosivo22" ],
"requirements": [ "aiorinnai==0.3.1" ],
"version": "1.4.1",
"version": "1.4.2",
"iot_class": "cloud_polling"
}
33 changes: 21 additions & 12 deletions custom_components/rinnaicontrolr-ha/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@
from __future__ import annotations

from homeassistant.const import (
DEVICE_CLASS_TEMPERATURE,
ELECTRIC_CURRENT_MILLIAMPERE,
FREQUENCY_HERTZ,
UnitOfTemperature,
UnitOfTime
UnitOfElectricCurrent,
UnitOfFrequency,
)

from homeassistant.components.sensor import (
Expand Down Expand Up @@ -52,8 +50,6 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
class RinnaiOutletTemperatureSensor(RinnaiEntity, SensorEntity):
"""Monitors the temperature."""

_attr_device_class = DEVICE_CLASS_TEMPERATURE

def __init__(self, device):
"""Initialize the temperature sensor."""
super().__init__("outlet_temperature", f"{device.device_name} Outlet Temperature", device)
Expand Down Expand Up @@ -83,8 +79,6 @@ def native_value(self):
class RinnaiInletTemperatureSensor(RinnaiEntity, SensorEntity):
"""Monitors the temperature."""

_attr_device_class = DEVICE_CLASS_TEMPERATURE

def __init__(self, device):
"""Initialize the temperature sensor."""
super().__init__("inlet_temperature", f"{device.device_name} Inlet Temperature", device)
Expand Down Expand Up @@ -216,14 +210,22 @@ class RinnaiFanCurrentSensor(RinnaiEntity, SensorEntity):
"""Monitors the fan current."""

_attr_icon = FAN_CURRENT_ICON
_attr_native_unit_of_measurement = ELECTRIC_CURRENT_MILLIAMPERE
_attr_state_class: SensorStateClass = SensorStateClass.MEASUREMENT

def __init__(self, device):
"""Initialize the temperature sensor."""
super().__init__("fan_current", f"{device.device_name} Fan Current x10", device)
self._state: float = None

@property
def state_class(self):
"""Return the state class of the sensor."""
return SensorStateClass.MEASUREMENT

@property
def native_unit_of_measurement(self) -> str | None:
return UnitOfElectricCurrent.MILLIAMPERE


@property
def native_value(self):
"""Return the current temperature."""
Expand All @@ -235,14 +237,21 @@ class RinnaiFanFrequencySensor(RinnaiEntity, SensorEntity):
"""Monitors the fan frequency"""

_attr_icon = FAN_FREQUENCY_ICON
_attr_native_unit_of_measurement = FREQUENCY_HERTZ
_attr_state_class: SensorStateClass = SensorStateClass.MEASUREMENT

def __init__(self, device):
"""Initialize the temperature sensor."""
super().__init__("fan_frequency", f"{device.device_name} Fan Frequency", device)
self._state: float = None

@property
def state_class(self):
"""Return the state class of the sensor."""
return SensorStateClass.MEASUREMENT

@property
def native_unit_of_measurement(self) -> str | None:
return UnitOfFrequency.HERTZ

@property
def native_value(self):
"""Return the current temperature."""
Expand Down

0 comments on commit da39874

Please sign in to comment.