Add daily energy usage sensor to daikin (#61617)

This commit is contained in:
Tobias Perschon 2022-01-07 14:58:21 +01:00 committed by GitHub
parent 95f8c26e23
commit beed861a19
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 15 additions and 4 deletions

View file

@ -10,6 +10,7 @@ ATTR_HEAT_ENERGY = "heat_energy"
ATTR_HUMIDITY = "humidity"
ATTR_TARGET_HUMIDITY = "target_humidity"
ATTR_COMPRESSOR_FREQUENCY = "compressor_frequency"
ATTR_TOTAL_ENERGY_TODAY = "total_energy_today"
ATTR_STATE_ON = "on"
ATTR_STATE_OFF = "off"

View file

@ -3,7 +3,7 @@
"name": "Daikin AC",
"config_flow": true,
"documentation": "https://www.home-assistant.io/integrations/daikin",
"requirements": ["pydaikin==2.6.0"],
"requirements": ["pydaikin==2.7.0"],
"codeowners": ["@fredrike"],
"zeroconf": ["_dkapi._tcp.local."],
"quality_scale": "platinum",

View file

@ -33,6 +33,7 @@ from .const import (
ATTR_INSIDE_TEMPERATURE,
ATTR_OUTSIDE_TEMPERATURE,
ATTR_TARGET_HUMIDITY,
ATTR_TOTAL_ENERGY_TODAY,
ATTR_TOTAL_POWER,
)
@ -84,7 +85,7 @@ SENSOR_TYPES: tuple[DaikinSensorEntityDescription, ...] = (
),
DaikinSensorEntityDescription(
key=ATTR_TOTAL_POWER,
name="Total Power Consumption",
name="Estimated Power Consumption",
device_class=SensorDeviceClass.POWER,
native_unit_of_measurement=POWER_KILO_WATT,
value_func=lambda device: round(device.current_total_power_consumption, 2),
@ -112,6 +113,14 @@ SENSOR_TYPES: tuple[DaikinSensorEntityDescription, ...] = (
native_unit_of_measurement=FREQUENCY_HERTZ,
value_func=lambda device: device.compressor_frequency,
),
DaikinSensorEntityDescription(
key=ATTR_TOTAL_ENERGY_TODAY,
name="Today's Total Energy Consumption",
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.TOTAL_INCREASING,
native_unit_of_measurement=ENERGY_KILO_WATT_HOUR,
value_func=lambda device: round(device.today_total_energy_consumption, 2),
),
)
@ -140,6 +149,7 @@ async def async_setup_entry(
sensors.append(ATTR_TOTAL_POWER)
sensors.append(ATTR_COOL_ENERGY)
sensors.append(ATTR_HEAT_ENERGY)
sensors.append(ATTR_TOTAL_ENERGY_TODAY)
if daikin_api.device.support_humidity:
sensors.append(ATTR_HUMIDITY)
sensors.append(ATTR_TARGET_HUMIDITY)

View file

@ -1443,7 +1443,7 @@ pycsspeechtts==1.0.4
# pycups==1.9.73
# homeassistant.components.daikin
pydaikin==2.6.0
pydaikin==2.7.0
# homeassistant.components.danfoss_air
pydanfossair==0.1.0

View file

@ -887,7 +887,7 @@ pycomfoconnect==0.4
pycoolmasternet-async==0.1.2
# homeassistant.components.daikin
pydaikin==2.6.0
pydaikin==2.7.0
# homeassistant.components.deconz
pydeconz==85