Skip to content

feat(light): add dimmer brightness support for circuits with type 'dimmer'#67

Open
rversaw wants to merge 1 commit into
Crewski:mainfrom
rversaw:dimmer-support
Open

feat(light): add dimmer brightness support for circuits with type 'dimmer'#67
rversaw wants to merge 1 commit into
Crewski:mainfrom
rversaw:dimmer-support

Conversation

@rversaw

@rversaw rversaw commented Jun 14, 2026

Copy link
Copy Markdown

Summary

  • Exposes dimmer circuits as brightness-capable lights in Home Assistant. Circuits reported with type.name == "dimmer" (circuit type 8 in nodejs-poolController) now use ColorMode.BRIGHTNESS instead of ColorMode.ONOFF.
  • Unified on/off+brightness control via setDimmerLevel: turning on sends a setDimmerLevel command with the last-known level (or 100% if no prior level), and turning off sends level 0. This matches the RS-485 behavior of the controller, where brightness and power state are controlled together via the dimmer level command.
  • Brightness state tracked from circuit events: the level field from njsPC circuit state events is tracked and converted to the 0–255 scale HA expects. This means physical panel changes to dimmer level (broadcast by IntelliTouch via RS-485 action 171) are reflected in HA in real time.

Dependency

This PR depends on tagyoureit/nodejs-poolController#1203, which adds circuit type 8 (Dimmer) and the RS-485 action 171 inbound/outbound handling to njsPC. Without that change, dimmer circuits are not recognized by njsPC and the setDimmerLevel endpoint is a no-op.

Changes

  • const.py: adds API_CIRCUIT_SETDIMMERLEVEL = "state/circuit/setDimmerLevel" constant
  • light.py:
    • Detects dimmer circuits via circuit.get("type", {}).get("name") == "dimmer"
    • Tracks level from coordinator data updates
    • async_turn_on: routes dimmer circuits to setDimmerLevel with HA brightness converted to nearest 10% step in 30–100% range
    • async_turn_off: routes dimmer circuits to setDimmerLevel with level 0
    • brightness property: returns level / 100 * 255 for dimmer circuits
    • color_mode / supported_color_modes: returns ColorMode.BRIGHTNESS for dimmer circuits

Test plan

  • Dimmer circuit appears as a brightness-capable light in HA
  • Turning on from HA sets brightness and powers on the circuit
  • Setting brightness from HA slider adjusts dimmer level in 10% steps (30–100%)
  • Turning off from HA sends level 0 and powers off the circuit
  • Changing dimmer level from the physical IntelliTouch panel updates brightness in HA
  • Non-dimmer light circuits unaffected (color effects, on/off behavior unchanged)

🤖 Generated with Claude Code

Circuits reported as type 'dimmer' (circuit type 8 in nodejs-poolController)
now expose ColorMode.BRIGHTNESS in Home Assistant instead of ONOFF. Turning
on sends a setDimmerLevel command (30-100 in steps of 10); turning off sends
level 0. Brightness state is tracked from the 'level' field in circuit events.

Co-Authored-By: Claude Sonnet 4.6 <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.

1 participant