Skip to content

Conversation

@nrbrt
Copy link

@nrbrt nrbrt commented Jan 25, 2026

Summary

This PR fixes the color temperature handling for bulbs like KAJPLATS (E1603).

Problems Fixed

  1. Property mismatch: The min_color_temp_kelvin, max_color_temp_kelvin, and color_temp_kelvin properties were returning raw mired values from Dirigera instead of converting them to Kelvin as Home Assistant expects.

  2. Validation bypass: The async_turn_on method now uses direct API patch for setting color temperature, bypassing the dirigera library's validation that incorrectly rejects valid Kelvin values.

Technical Details

Dirigera stores color temperature internally in mired (micro reciprocal degrees), but the IKEA Home Smart app and the hub API both work with Kelvin values. The conversion formula is:

Kelvin = 1,000,000 / mired

For example:

  • 454 mired → ~2203 Kelvin (warm white)
  • 153 mired → ~6536 Kelvin (cool white)

Fixes #181

🤖 Generated with Claude Code

nrbrt and others added 10 commits January 13, 2026 11:33
IKEA MYGGSPRAY motion sensors (E2494) report as deviceType
'occupancySensor' instead of 'motionSensor'. They also lack the
'is_on' attribute that regular motion sensors have.

This PR fixes both issues by:
- Including 'occupancySensor' in motion sensor queries
- Creating MotionSensorX with optional is_on attribute
- Overriding get_motion_sensors() and get_motion_sensor_by_id()

Tested with IKEA MYGGSPRAY E2494 sensors on Home Assistant 2026.1.1.
MYGGSPRAY motion sensors send events as occupancySensor device type.
Without this, the hub_event_listener ignores real-time state changes
from these sensors.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
STYRBAR has 4 buttons but was treated as 1-button controller.
This enables button1_*, button2_*, button3_*, button4_* triggers.
Adds English translations for button3_* and button4_* triggers
to support 4-button controllers like STYRBAR.
STYRBAR, RODRET and similar lightController-type remotes send
remotePressEvent messages via WebSocket instead of sceneUpdated.
Previously these were discarded as "non state message".

This commit adds a new handler (parse_remote_press_event) that:
- Parses remotePressEvent messages from lightController devices
- Converts clickPattern to trigger types (single_click, long_press, etc)
- Handles multi-button controllers using the _N suffix
- Debounces duplicate events within 1 second (IKEA bug workaround)
- Fires dirigera_platform_event for Home Assistant automations

Enables use of STYRBAR 4-button and RODRET 2-button remotes in
Home Assistant automations without requiring scene configuration.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The min_color_temp_kelvin, max_color_temp_kelvin, and color_temp_kelvin
properties were returning raw mired values from Dirigera instead of
converting them to Kelvin as Home Assistant expects.

Also fixed async_turn_on to use direct API patch for setting color
temperature, bypassing the dirigera library's broken validation that
rejects valid Kelvin values.

Fixes sanjoyg#181

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@nrbrt
Copy link
Author

nrbrt commented Jan 26, 2026

Closing in favor of PR #186 which combines all fixes

@nrbrt nrbrt closed this Jan 26, 2026
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.

Color temperature broken for bulbs - mired/Kelvin unit mismatch

1 participant