Skip to content

Commit

Permalink
Merge pull request #356 from ic-dev21/Isssue355
Browse files Browse the repository at this point in the history
Fix issue #355
valleedelisle authored Jan 14, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
2 parents a1db355 + 32e6dfc commit f155165
Showing 3 changed files with 20 additions and 20 deletions.
4 changes: 2 additions & 2 deletions custom_components/hilo/climate.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@
HVACMode,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import ATTR_TEMPERATURE, PRECISION_TENTHS, TEMP_CELSIUS
from homeassistant.const import ATTR_TEMPERATURE, PRECISION_TENTHS, UnitOfTemperature
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.util import slugify
@@ -50,7 +50,7 @@ async def async_setup_entry(

class HiloClimate(HiloEntity, ClimateEntity):
_attr_hvac_modes = [HVACMode.HEAT]
_attr_temperature_unit: str = TEMP_CELSIUS
_attr_temperature_unit: str = UnitOfTemperature.CELSIUS
_attr_precision: float = PRECISION_TENTHS
_attr_supported_features: int = ClimateEntityFeature.TARGET_TEMPERATURE

2 changes: 1 addition & 1 deletion custom_components/hilo/manifest.json
Original file line number Diff line number Diff line change
@@ -12,5 +12,5 @@
"iot_class": "cloud_push",
"issue_tracker": "https://github.com/dvd-dev/hilo/issues",
"requirements": ["python-hilo>=2024.1.1"],
"version": "2024.1.1"
"version": "2024.2.1"
}
34 changes: 17 additions & 17 deletions custom_components/hilo/sensor.py
Original file line number Diff line number Diff line change
@@ -14,12 +14,12 @@
CONCENTRATION_PARTS_PER_MILLION,
CONF_SCAN_INTERVAL,
CURRENCY_DOLLAR,
ENERGY_KILO_WATT_HOUR,
PERCENTAGE,
POWER_WATT,
SIGNAL_STRENGTH_DECIBELS_MILLIWATT,
SOUND_PRESSURE_DB,
TEMP_CELSIUS,
UnitOfEnergy,
UnitOfPower,
UnitOfSoundPressure,
UnitOfTemperature,
)
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddEntitiesCallback
@@ -239,23 +239,21 @@ class EnergySensor(IntegrationSensor):
"""Define a Hilo energy sensor entity."""

_attr_device_class = SensorDeviceClass.ENERGY
_attr_native_unit_of_measurement = ENERGY_KILO_WATT_HOUR
_attr_native_unit_of_measurement = UnitOfEnergy.KILO_WATT_HOUR
_attr_state_class = SensorStateClass.TOTAL_INCREASING
_attr_icon = "mdi:lightning-bolt"

def __init__(self, device):
self._device = device
self._attr_name = f"Hilo Energy {slugify(device.name)}"
self._attr_unique_id = f"hilo_energy_{slugify(device.name)}"
self._unit_of_measurement = ENERGY_KILO_WATT_HOUR
self._unit_of_measurement = UnitOfEnergy.KILO_WATT_HOUR
self._unit_prefix = None
if device.type == "Meter":
self._attr_name = HILO_ENERGY_TOTAL
self._unit_of_measurement = ENERGY_KILO_WATT_HOUR
self._unit_prefix = "k"
self._unit_of_measurement = UnitOfEnergy.KILO_WATT_HOUR
if device.type == "Thermostat" or device.type == "FloorThermostat":
self._unit_of_measurement = ENERGY_KILO_WATT_HOUR
self._unit_prefix = "k"
self._unit_of_measurement = UnitOfEnergy.KILO_WATT_HOUR
self._source = f"sensor.{slugify(device.name)}_power"

super().__init__(
@@ -264,7 +262,7 @@ def __init__(self, device):
round_digits=2,
source_entity=self._source,
unique_id=self._attr_unique_id,
unit_prefix=self._unit_prefix,
unit_prefix="k",
unit_time="h",
)
self._state = 0
@@ -286,7 +284,7 @@ async def async_added_to_hass(self) -> None:
class NoiseSensor(HiloEntity, SensorEntity):
"""Define a Netatmo noise sensor entity."""

_attr_native_unit_of_measurement = SOUND_PRESSURE_DB
_attr_native_unit_of_measurement = UnitOfSoundPressure.DECIBEL
_attr_state_class = SensorStateClass.MEASUREMENT

def __init__(self, hilo, device):
@@ -312,7 +310,7 @@ class PowerSensor(HiloEntity, SensorEntity):
"""Define a Hilo power sensor entity."""

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

def __init__(self, hilo: Hilo, device: HiloDevice) -> None:
@@ -340,7 +338,7 @@ class TemperatureSensor(HiloEntity, SensorEntity):
"""Define a Hilo temperature sensor entity."""

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

def __init__(self, hilo, device):
@@ -371,7 +369,7 @@ class TargetTemperatureSensor(HiloEntity, SensorEntity):
"""Define a Hilo target temperature sensor entity."""

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

def __init__(self, hilo, device):
@@ -704,7 +702,9 @@ def icon(self):

class HiloCostSensor(HiloEntity, RestoreEntity, SensorEntity):
_attr_device_class = SensorDeviceClass.MONETARY
_attr_native_unit_of_measurement = f"{CURRENCY_DOLLAR}/{ENERGY_KILO_WATT_HOUR}"
_attr_native_unit_of_measurement = (
f"{CURRENCY_DOLLAR}/{UnitOfEnergy.KILO_WATT_HOUR}"
)
_attr_state_class = SensorStateClass.MEASUREMENT
_attr_icon = "mdi:cash"

@@ -714,7 +714,7 @@ def __init__(self, hilo, name, plan_name, amount=0):
device = d
if "low_threshold" in name:
self._attr_device_class = SensorDeviceClass.ENERGY
self._attr_native_unit_of_measurement = ENERGY_KILO_WATT_HOUR
self._attr_native_unit_of_measurement = UnitOfEnergy.KILO_WATT_HOUR
self.data = None
self._attr_name = name
self.plan_name = plan_name

0 comments on commit f155165

Please sign in to comment.