Skip to content

Commit 0f712db

Browse files
committed
0.7.18
1 parent 2a014bc commit 0f712db

1 file changed

Lines changed: 12 additions & 17 deletions

File tree

custom_components/hon/sensor.py

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,14 @@
11
import logging
22
from datetime import datetime, timedelta, timezone
3-
from dateutil.tz import gettz
4-
from enum import IntEnum
5-
#from homeassistant.helpers.dispatcher import async_dispatcher_connect
6-
7-
8-
from homeassistant.const import UnitOfTemperature, UnitOfTime
93

4+
from homeassistant.core import callback
105
from homeassistant.components.sensor import (
116
SensorEntity,
127
SensorDeviceClass,
138
SensorStateClass,
149
SensorEntityDescription,
1510
)
1611

17-
from homeassistant.core import callback
18-
19-
from .const import DOMAIN, APPLIANCE_TYPE
20-
2112
from homeassistant.const import (
2213
UnitOfTime,
2314
UnitOfEnergy,
@@ -31,11 +22,12 @@
3122
CONCENTRATION_PARTS_PER_MILLION
3223
)
3324

34-
from .base import HonBaseCoordinator, HonBaseSensorEntity
35-
3625
from homeassistant.config_entries import ConfigEntry
3726

38-
divider = 100.0
27+
from .const import DOMAIN, APPLIANCE_TYPE
28+
from .base import HonBaseCoordinator, HonBaseSensorEntity
29+
30+
divider = 1.0
3931

4032
_LOGGER = logging.getLogger(__name__)
4133

@@ -137,7 +129,7 @@ async def async_setup_entry(hass, entry: ConfigEntry, async_add_entities) -> Non
137129
appliances.extend([HonBaseSpinSpeed(hass, coordinator, entry, appliance)])
138130

139131

140-
# Fridge other values
132+
# Parameters found for some fridges
141133
if device.has("quickModeZ1"):
142134
appliances.extend([HonBaseInt(hass, coordinator, entry, appliance, "quickModeZ1", "Quick mode Zone 1", )])
143135
if device.has("quickModeZ2"):
@@ -572,9 +564,12 @@ class HonBaseCurrentElectricityUsed(HonBaseSensorEntity):
572564
def __init__(self, hass, coordinator, entry, appliance) -> None:
573565
super().__init__(coordinator, appliance, "currentElectricityUsed", "Current electricity used")
574566

575-
self._attr_native_unit_of_measurement = UnitOfPower.KILO_WATT
576-
self._attr_device_class = SensorDeviceClass.POWER
577-
self._attr_state_class = SensorStateClass.MEASUREMENT
567+
#self._attr_native_unit_of_measurement = UnitOfPower.KILO_WATT
568+
#self._attr_device_class = SensorDeviceClass.POWER
569+
#self._attr_state_class = SensorStateClass.MEASUREMENT
570+
self._attr_native_unit_of_measurement = UnitOfEnergy.KILO_WATT_HOUR
571+
self._attr_device_class = SensorDeviceClass.ENERGY
572+
self._attr_state_class = SensorStateClass.TOTAL
578573
self._attr_icon = "mdi:lightning-bolt"
579574

580575
def coordinator_update(self):

0 commit comments

Comments
 (0)