Fix target humidity
This commit is contained in:
@@ -20,6 +20,8 @@ ATTR_OUTSIDE_TEMPERATURE = "outside_temperature"
|
||||
ATTR_TOTAL_POWER = "total_power"
|
||||
ATTR_COOL_ENERGY = "cool_energy"
|
||||
ATTR_HEAT_ENERGY = "heat_energy"
|
||||
ATTR_HUMIDITY = "hhum"
|
||||
ATTR_TARGET_HUMIDITY = "shum"
|
||||
|
||||
ATTR_STATE_ON = "on"
|
||||
ATTR_STATE_OFF = "off"
|
||||
@@ -42,14 +44,14 @@ SENSOR_TYPES = {
|
||||
CONF_DEVICE_CLASS: DEVICE_CLASS_TEMPERATURE,
|
||||
CONF_UNIT_OF_MEASUREMENT: TEMP_CELSIUS,
|
||||
},
|
||||
"hhum": {
|
||||
ATTR_HUMIDITY: {
|
||||
CONF_NAME: "Humidity",
|
||||
CONF_ICON: "mdi:percent",
|
||||
CONF_TYPE: SENSOR_TYPE_HUMIDITY,
|
||||
CONF_DEVICE_CLASS: DEVICE_CLASS_HUMIDITY,
|
||||
CONF_UNIT_OF_MEASUREMENT: UNIT_PERCENTAGE,
|
||||
},
|
||||
"shum": {
|
||||
ATTR_TARGET_HUMIDITY: {
|
||||
CONF_NAME: "Target Humidity",
|
||||
CONF_ICON: "mdi:percent",
|
||||
CONF_TYPE: SENSOR_TYPE_HUMIDITY,
|
||||
|
||||
@@ -16,6 +16,8 @@ from .const import (
|
||||
ATTR_HEAT_ENERGY,
|
||||
ATTR_INSIDE_TEMPERATURE,
|
||||
ATTR_OUTSIDE_TEMPERATURE,
|
||||
ATTR_HUMIDITY,
|
||||
ATTR_TARGET_HUMIDITY,
|
||||
ATTR_TOTAL_POWER,
|
||||
SENSOR_TYPE_ENERGY,
|
||||
SENSOR_TYPE_POWER,
|
||||
@@ -45,9 +47,9 @@ async def async_setup_entry(hass, entry, async_add_entities):
|
||||
sensors.append(ATTR_TOTAL_POWER)
|
||||
sensors.append(ATTR_COOL_ENERGY)
|
||||
sensors.append(ATTR_HEAT_ENERGY)
|
||||
if daikin_api.device.values.get("hhum").replace("-", ""):
|
||||
sensors.append("hhum")
|
||||
sensors.append("shum")
|
||||
if daikin_api.device.values.get(ATTR_HUMIDITY).replace("-", ""):
|
||||
sensors.append(ATTR_HUMIDITY)
|
||||
sensors.append(ATTR_TARGET_HUMIDITY)
|
||||
async_add_entities([DaikinSensor.factory(daikin_api, sensor) for sensor in sensors])
|
||||
|
||||
|
||||
@@ -123,10 +125,10 @@ class DaikinClimateSensor(DaikinSensor):
|
||||
if self._device_attribute == ATTR_OUTSIDE_TEMPERATURE:
|
||||
return self._api.device.outside_temperature
|
||||
|
||||
if self._device_attribute == "hhum":
|
||||
return int(self._api.device.values.get("hhum").replace("-", "0"))
|
||||
if self._device_attribute == "bhum":
|
||||
return int(self._api.device.values.get("bhum").replace("-", "0"))
|
||||
if self._device_attribute == ATTR_HUMIDITY:
|
||||
return int(self._api.device.values.get(ATTR_HUMIDITY).replace("-", "0"))
|
||||
if self._device_attribute == ATTR_TARGET_HUMIDITY:
|
||||
return int(self._api.device.values.get(ATTR_TARGET_HUMIDITY).replace("-", "0"))
|
||||
return None
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user