Skip to content

Conversation

@nrbrt
Copy link

@nrbrt nrbrt commented Jan 25, 2026

Summary

  • Adds support for IKEA ALPSTUGA air quality monitor CO2 sensor
  • The dirigera library doesn't have the current_c_o2 field in its pydantic model yet, so this creates patched classes to support it
  • Adds ikea_alpstuga_co2 sensor entity class

Changes

  • dirigera_lib_patch.py: Added EnvironmentSensorAttributesX with current_c_o2 field, EnvironmentSensorX class, and hub methods
  • base_classes.py: Added ikea_alpstuga_co2 sensor class, updated imports
  • sensor.py: Added CO2 sensor detection and creation, fixed getattr calls with None default

Test plan

  • Tested with ALPSTUGA device - CO2 sensor entity appears in Home Assistant
  • Verified real-time updates via WebSocket events work correctly

Fixes #178

🤖 Generated with Claude Code

The IKEA ALPSTUGA air quality monitor reports CO2 levels via the
currentCO2 attribute, but the dirigera library doesn't have this
field in its EnvironmentSensorAttributes pydantic model yet.

This commit:
- Creates patched EnvironmentSensorAttributesX with current_c_o2 field
- Creates EnvironmentSensorX class using the patched attributes
- Adds get_environment_sensors/get_environment_sensor_by_id to HubX
- Adds ikea_alpstuga_co2 sensor class for the CO2 entity
- Updates add_environment_sensors to create CO2 entities
- Adds None default to getattr calls for safer attribute checking

Fixes sanjoyg#178

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ALPSTUGA not showing CO2 Entity

1 participant