Skip to content

Commit

Permalink
0.6.9
Browse files Browse the repository at this point in the history
  • Loading branch information
gvigroux committed Jan 22, 2024
1 parent 72054b5 commit 7b84881
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
7 changes: 2 additions & 5 deletions custom_components/hon/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@
SensorStateClass,
SensorEntityDescription,
)
from homeassistant.const import (
DATA_RATE_MEGABITS_PER_SECOND,
)


from homeassistant.components.climate.const import (
Expand Down Expand Up @@ -57,7 +54,7 @@
SERVICE_TURN_ON,
STATE_OFF,
STATE_ON,
TEMP_CELSIUS,
UnitOfTemperature,
)
from homeassistant.core import callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect
Expand Down Expand Up @@ -188,7 +185,7 @@ def __init__(self,hass, coordinator, entry, appliance) -> None:
self._device = coordinator.device

#Not working for Farenheit
self._attr_temperature_unit = TEMP_CELSIUS # 'tempUnit': '0'
self._attr_temperature_unit = UnitOfTemperature.CELSIUS # 'tempUnit': '0'
self._attr_target_temperature_step = PRECISION_WHOLE

self._attr_fan_modes = [] #[FAN_OFF, FAN_LOW, FAN_MEDIUM, FAN_HIGH, FAN_AUTO]
Expand Down
2 changes: 1 addition & 1 deletion custom_components/hon/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
"documentation": "https://github.com/gvigroux/hon",
"iot_class": "cloud_polling",
"issue_tracker": "https://github.com/gvigroux/hon/issues",
"version": "0.6.8"
"version": "0.6.9"
}
21 changes: 12 additions & 9 deletions custom_components/hon/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#from homeassistant.helpers.dispatcher import async_dispatcher_connect


from homeassistant.const import TEMP_CELSIUS, TIME_MINUTES
from homeassistant.const import UnitOfTemperature, UnitOfTime

from homeassistant.components.sensor import (
SensorEntity,
Expand Down Expand Up @@ -45,6 +45,7 @@

from homeassistant.config_entries import ConfigEntry

divider = 100.0

_LOGGER = logging.getLogger(__name__)

Expand Down Expand Up @@ -189,7 +190,7 @@ class HonBaseTemperature(HonBaseSensorEntity):
def __init__(self, hass, coordinator, entry, appliance, key, name) -> None:
super().__init__(coordinator, appliance, key, name)

self._attr_native_unit_of_measurement = TEMP_CELSIUS
self._attr_native_unit_of_measurement = UnitOfTemperature.CELSIUS
self._attr_device_class = SensorDeviceClass.TEMPERATURE


Expand All @@ -214,7 +215,7 @@ class HonBaseRemainingTime(HonBaseSensorEntity):
def __init__(self, hass, coordinator, entry, appliance) -> None:
super().__init__(coordinator, appliance, "remainingTimeMM", "Remaining Time")

self._attr_native_unit_of_measurement = TIME_MINUTES
self._attr_native_unit_of_measurement = UnitOfTime.MINUTES
self._attr_device_class = SensorDeviceClass.DURATION
self._attr_icon = "mdi:progress-clock"

Expand Down Expand Up @@ -373,7 +374,7 @@ class HonBaseProgramDuration(HonBaseSensorEntity):
def __init__(self, hass, coordinator, entry, appliance) -> None:
super().__init__(coordinator, appliance, "prTime", "Program duration")

self._attr_native_unit_of_measurement = TIME_MINUTES
self._attr_native_unit_of_measurement = UnitOfTime.MINUTES
self._attr_device_class = SensorDeviceClass.DURATION
self._attr_icon = "mdi:timelapse"

Expand Down Expand Up @@ -482,7 +483,7 @@ def coordinator_update(self):
if self._device.getInt("totalWashCycle")-1 <= 0:
self._attr_native_value = None
else:
self._attr_native_value = round(self._device.getFloat("totalWaterUsed")/(self._device.getFloat("totalWashCycle")-1),2)
self._attr_native_value = round((self._device.getFloat("totalWaterUsed") / divider ) /(self._device.getFloat("totalWashCycle")-1),2)


class HonBaseTotalElectricityUsed(HonBaseSensorEntity):
Expand All @@ -495,7 +496,7 @@ def __init__(self, hass, coordinator, entry, appliance) -> None:
self._attr_icon = "mdi:connection"

def coordinator_update(self):
self._attr_native_value =self._device.getFloat("totalElectricityUsed")
self._attr_native_value = self._device.getFloat("totalElectricityUsed") / divider


class HonBaseTotalWashCycle(HonBaseSensorEntity):
Expand All @@ -519,7 +520,7 @@ def __init__(self, hass, coordinator, entry, appliance) -> None:
self._attr_icon = "mdi:water-pump"

def coordinator_update(self):
self._attr_native_value = self._device.getFloat("totalWaterUsed")
self._attr_native_value = self._device.getFloat("totalWaterUsed") / divider


class HonBaseWeight(HonBaseSensorEntity):
Expand All @@ -544,7 +545,8 @@ def __init__(self, hass, coordinator, entry, appliance) -> None:
self._attr_icon = "mdi:water"

def coordinator_update(self):
self._attr_native_value = self._device.get("currentWaterUsed")
#self._attr_native_value = self._device.get("currentWaterUsed")
self._attr_native_value = self._device.getFloat("currentWaterUsed") / divider


class HonBaseError(HonBaseSensorEntity):
Expand All @@ -571,7 +573,8 @@ def __init__(self, hass, coordinator, entry, appliance) -> None:
self._attr_icon = "mdi:lightning-bolt"

def coordinator_update(self):
self._attr_native_value = self._device.get("currentElectricityUsed")
#self._attr_native_value = self._device.get("currentElectricityUsed")
self._attr_native_value = self._device.getFloat("currentElectricityUsed") / divider


class HonBaseSpinSpeed(HonBaseSensorEntity):
Expand Down

0 comments on commit 7b84881

Please sign in to comment.