From 20b7092c3e576bff20f3c9733f16c2312eb4a2c1 Mon Sep 17 00:00:00 2001 From: thomasgermain <12560542+thomasgermain@users.noreply.github.com> Date: Fri, 11 Feb 2022 20:59:03 +0100 Subject: [PATCH] 2022.02 compatibility + att fan speed to attributes --- custom_components/multimatic/fan.py | 14 ++++++++++++-- custom_components/multimatic/manifest.json | 2 +- custom_components/multimatic/sensor.py | 5 ++--- hacs.json | 2 +- 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/custom_components/multimatic/fan.py b/custom_components/multimatic/fan.py index 5d92291..974859e 100644 --- a/custom_components/multimatic/fan.py +++ b/custom_components/multimatic/fan.py @@ -3,11 +3,16 @@ from __future__ import annotations import logging -from typing import Any +from typing import Any, Mapping from pymultimatic.model import OperatingModes, QuickModes -from homeassistant.components.fan import DOMAIN, SUPPORT_PRESET_MODE, FanEntity +from homeassistant.components.fan import ( + DOMAIN, + SUPPORT_PRESET_MODE, + FanEntity, + ATTR_SPEED, +) from homeassistant.helpers import entity_platform from .const import ATTR_LEVEL, VENTILATION @@ -144,3 +149,8 @@ async def set_ventilation_day_level(self, **kwargs): async def set_ventilation_night_level(self, **kwargs): """Service method to set night level.""" await self.coordinator.api.set_fan_night_level(self, kwargs.get(ATTR_LEVEL)) + + @property + def extra_state_attributes(self) -> Mapping[str, Any] | None: + """Return entity specific state attributes.""" + return {ATTR_SPEED: self.active_mode.target} diff --git a/custom_components/multimatic/manifest.json b/custom_components/multimatic/manifest.json index 893e1d1..236b536 100644 --- a/custom_components/multimatic/manifest.json +++ b/custom_components/multimatic/manifest.json @@ -14,6 +14,6 @@ "codeowners": [ "@thomasgermain" ], - "version": "1.12.0", + "version": "1.12.2", "iot_class": "cloud_polling" } diff --git a/custom_components/multimatic/sensor.py b/custom_components/multimatic/sensor.py index a0c289e..273398e 100644 --- a/custom_components/multimatic/sensor.py +++ b/custom_components/multimatic/sensor.py @@ -2,7 +2,6 @@ from __future__ import annotations -import datetime import logging from pymultimatic.model import EmfReport, Report @@ -20,7 +19,6 @@ TEMP_CELSIUS, ) from homeassistant.helpers.typing import StateType -from homeassistant.util.dt import utc_from_timestamp from .const import EMF_REPORTS, OUTDOOR_TEMP, REPORTS from .coordinator import MultimaticCoordinator @@ -31,7 +29,8 @@ UNIT_TO_DEVICE_CLASS = { "bar": SensorDeviceClass.PRESSURE, - "ppm": "", + "ppm": SensorDeviceClass.CO2, + "Wh": SensorDeviceClass.ENERGY, "°C": SensorDeviceClass.TEMPERATURE, } diff --git a/hacs.json b/hacs.json index d2df0c7..ab7e518 100644 --- a/hacs.json +++ b/hacs.json @@ -2,5 +2,5 @@ "name": "multimatic", "domains": ["binary_sensor", "climate", "fan", "sensor", "water_heater"], "render_readme": true, - "homeassistant": "2021.12.0" + "homeassistant": "2022.02.0" }