From b046cfecd45f8bbf4e879f0bdf525a24661795ae Mon Sep 17 00:00:00 2001 From: stirante Date: Sat, 10 Jan 2026 09:47:42 +0100 Subject: [PATCH 1/2] Add support for current CO2 from Alpstuga Air Quality Sensor --- .../dirigera_platform/base_classes.py | 16 ++++++++++++++++ .../dirigera_platform/hub_event_listener.py | 1 + custom_components/dirigera_platform/sensor.py | 3 +++ 3 files changed, 20 insertions(+) diff --git a/custom_components/dirigera_platform/base_classes.py b/custom_components/dirigera_platform/base_classes.py index 51d4c4d..801b45d 100644 --- a/custom_components/dirigera_platform/base_classes.py +++ b/custom_components/dirigera_platform/base_classes.py @@ -1,3 +1,4 @@ +from typing import Optional from homeassistant import core from homeassistant.core import HomeAssistantError @@ -20,6 +21,7 @@ UnitOfPower, UnitOfTemperature, CONCENTRATION_MICROGRAMS_PER_CUBIC_METER, + CONCENTRATION_PARTS_PER_MILLION, ) from dirigera import Hub @@ -454,6 +456,20 @@ def __init__(self, device: ikea_vindstyrka_device) -> None: def native_value(self) -> int: return self._device.voc_index +class ikea_alpstuga_co2(ikea_base_device_sensor, SensorEntity): + def __init__(self, device: ikea_vindstyrka_device) -> None: + logger.debug("ikea_alpstuga_co2 ctor...") + super().__init__( + device, + id_suffix="CO2", + name="CO2", + device_class=SensorDeviceClass.CO2, + native_unit_of_measurement=CONCENTRATION_PARTS_PER_MILLION) + + @property + def native_value(self) -> int: + return self._device.current_c_o2 + # SOMRIG Controllers act differently in the gateway Hub # While its one device but two id's are sent back each # representing the two buttons on the controler. The id is diff --git a/custom_components/dirigera_platform/hub_event_listener.py b/custom_components/dirigera_platform/hub_event_listener.py index e5ef40a..61ef3dd 100644 --- a/custom_components/dirigera_platform/hub_event_listener.py +++ b/custom_components/dirigera_platform/hub_event_listener.py @@ -34,6 +34,7 @@ "environmentSensor": [ "currentTemperature", "currentRH", "currentPM25", + "currentCO2", "vocIndex", "batteryPercentage"] } diff --git a/custom_components/dirigera_platform/sensor.py b/custom_components/dirigera_platform/sensor.py index 0adb2ed..68d327d 100644 --- a/custom_components/dirigera_platform/sensor.py +++ b/custom_components/dirigera_platform/sensor.py @@ -4,6 +4,7 @@ from .base_classes import ( battery_percentage_sensor, + ikea_alpstuga_co2, ikea_vindstyrka_temperature, ikea_vindstyrka_humidity, ikea_vindstyrka_pm25, @@ -85,6 +86,8 @@ async def add_environment_sensors(async_add_entities, env_devices): env_sensors.append(ikea_vindstyrka_pm25(env_device, WhichPM25.MIN)) if getattr(env_device,"voc_index") is not None: env_sensors.append(ikea_vindstyrka_voc_index(env_device)) + if getattr(env_device,"current_c_o2") is not None: + env_sensors.append(ikea_alpstuga_co2(env_device)) logger.debug("Found {} env entities to setup...".format(len(env_sensors))) From c5776f0729911ebf93bed48baf785a340f2a3e18 Mon Sep 17 00:00:00 2001 From: stirante Date: Mon, 26 Jan 2026 10:46:48 +0100 Subject: [PATCH 2/2] update required version --- custom_components/dirigera_platform/manifest.json | 2 +- custom_components/dirigera_platform/requirements.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/custom_components/dirigera_platform/manifest.json b/custom_components/dirigera_platform/manifest.json index c70b53f..fb361bc 100755 --- a/custom_components/dirigera_platform/manifest.json +++ b/custom_components/dirigera_platform/manifest.json @@ -8,6 +8,6 @@ "iot_class": "local_polling", "issue_tracker": "https://github.com/sanjoyg/dirigera_platform", "loggers": ["custom_components.dirigera_platform"], - "requirements": ["dirigera==1.2.1"], + "requirements": ["dirigera==1.2.6"], "version": "0.0.1" } diff --git a/custom_components/dirigera_platform/requirements.txt b/custom_components/dirigera_platform/requirements.txt index 35110d1..4e0e58e 100644 --- a/custom_components/dirigera_platform/requirements.txt +++ b/custom_components/dirigera_platform/requirements.txt @@ -1 +1 @@ -dirigera==1.2.1 +dirigera==1.2.6