Skip to content

About

Hold-to-dim for Home Assistant, using the command your light already speaks. Native ZHA, Z-Wave JS, Matter, Zigbee2MQTT, Tasmota and WiZ backends.

Topics

Resources

Stars

4 stars

Watchers

0 watching

Forks

Repository files navigation

Dynamic Dimming

Dynamic Dimming

Hold-to-dim for Home Assistant, using the command your light already speaks.

HACS Custom Home Assistant 2026.2+ v0.8.0


Most lighting protocols have had a hold-to-dim primitive for years: Zigbee's Level Control Move/Stop, Z-Wave's StartLevelChange/StopLevelChange, the same pair inherited by Matter. Home Assistant has no way to ask for it — light.turn_on sets a target brightness and that is the whole vocabulary — so the capability sits unused in hardware you already own.

Dynamic Dimming adds the missing verbs: move / stop / step / fade. On Zigbee2MQTT, Tasmota, Matter, ZHA, Z-Wave JS, Shelly (Gen2+), Hue and deCONZ it sends the protocol's own command — one message starts the ramp, one stops it, and the device does the dimming itself, with no stream of brightness writes crossing your mesh. LIFX has no stop verb but does interpolate every command over a duration, so a hold is one datagram aimed at the rail and a release estimates the current level and writes it back. This is not a device-side stop, and packet loss or stale state can produce a visible adjustment. WiZ has neither, so it gets a native transport instead: still stepped, but over direct fire-and-forget UDP rather than through light.turn_on. Everything else falls back to stepped simulation on a perceptual curve. Other dimmable entities use the HA light service fallback; actual behavior depends on the light integration and hardware.

Current scope: the native backends listed below, with stepped simulation as the fallback everywhere else. Most of them have not yet been run on real hardware in this project. The table that follows says which.

What has actually been tested

A backend's unit tests show that it sends the command the protocol documents. Only a real device shows what the firmware, bridge or mesh does with it.

Backend Evidence so far
ZHA Hardware results recorded for one bulb (TESTING.md); some checks still unrun
Matter Hardware results recorded for one bulb; some checks still unrun
Zigbee2MQTT, Tasmota, WiZ In the author's own fleet; no recorded results yet
Z-Wave JS, Shelly, Hue, deCONZ, LIFX Unit tests only. Never run on a device in this project.
Simulation Logic unit-tested; traffic on a real mesh not yet measured

If you own one of the untested platforms, a ten-minute pass through TESTING.md and a device report is the most useful contribution this project can receive. backend: simulated on any call bypasses a native backend that misbehaves.

Traffic

What each path puts on your network, per light:

Path On press While held On release
Zigbee2MQTT, ZHA, Matter, Z-Wave JS, Tasmota, Shelly, Hue, deCONZ (individual lights) 1 command nothing 1 command
LIFX 1–2 datagrams nothing 1 datagram plus a resync
WiZ 20 datagrams a second, direct to the bulb over Wi-Fi same 1 resync
Simulation on a Zigbee, Thread or Hue light 1 write at most 5 writes a second, shared by every simulated ramp on that transport nothing
Simulation on a Z-Wave light 1 write at most 1 write a second, shared the same way nothing
Simulation on anything else 1 write up to 20 writes a second, never more than one unacknowledged nothing

Simulation is reached more often than the list of native backends suggests: a Home Assistant light group, a ZHA or Zigbee2MQTT group, a fade on Zigbee2MQTT or Z-Wave JS, a step on Z-Wave JS, Shelly or LIFX, and any light whose native backend could not resolve it. These rules apply to all of it:

  • One write in flight. The next write waits for the previous one to be acknowledged, so a slow integration is written to slowly rather than handed a growing queue of stale levels that keep arriving after you let go.
  • Latest level wins, and an unchanged level is never resent.
  • Mesh and bridge budgets. On the transports in the table the gap between writes is stretched to stay inside a shared budget, and where the light supports transition each write carries one so the ramp still reads as continuous. A light group is charged for every member, and a Zigbee group for a broadcast, so a group of five Zigbee bulbs is written about once a second. The cost is precision: after a release, a budgeted light can finish the transition it was last given.
  • Repeated hold events from a remote that re-sends "hold" while the button is down do not re-send a native command that is already running.
  • A target naming both a group and its members drives each bulb once.

The budgets are conservative defaults chosen from published limits, not measurements from this project. A hold ends at the rail on every path, so a lost release is bounded: native ramps stop when the device reaches its limit, and a simulated ramp stops writing when it gets there.

Still open: area targets send one native command per light rather than one group command, native stops are not retried, and nothing here has been soak-tested on a large mesh.

Dimming curve

A ramp that adds a fixed number of brightness units per tick does not look steady. Perceived lightness goes roughly as the cube root of luminance, so a linear ramp races through the bottom of the range — where a few units are a big visible change — and then crawls through the top, where they are barely distinguishable. Held from off to full it reads as "flash, then not much for two seconds".

Stepped ramps therefore advance at a constant rate through perceived lightness, and let the brightness step vary: tiny near the bottom, large near the top. A hold takes exactly as long end to end as it used to; the time is just spent where it is visible. step moves by a percentage of perceptual travel too, so one tap is the same apparent change at either end of the range.

Setting Effect
perceptual (default) Constant apparent rate. Gamma 3.0, which tracks CIE L* closely.
linear The pre-0.3.0 behavior: constant brightness rate.
a number, 1.0–6.0 Raw gamma, if you want to tune it by eye.

Set the default in the integration's options, or override per call with the curve field on move, step and fade. It applies only where this integration steps the ramp itself — the simulation and WiZ paths. Backends that hand the ramp to device firmware (Zigbee2MQTT, Tasmota, Matter, ZHA, Z-Wave JS, Shelly, Hue, deCONZ, LIFX) ignore it: the device's own curve applies, and this integration does not mutate device config.

Minimum brightness

The curve travels between a configurable minimum brightness and full, rather than between zero and full. On a device with coarse resolution this matters more than the curve does: WiZ bulbs accept only 100 discrete levels and report a minimum usable level of 10 (minDimLevel in getModelConfig), so a curve anchored at zero would spend roughly its first third of travel below the point where the bulb does anything.

If the bottom of a hold looks dead, raise minimum brightness to the device's real floor — 26 on the 0–255 scale is WiZ's declared 10%. The default is 1, which preserves the full nominal range.

Installation

Install via HACS as a custom repository: add https://github.com/nohat/dynamic_dimming as an Integration custom repository, install "Dynamic Dimming", restart Home Assistant, then add the integration under Settings → Devices & Services → Add Integration → Dynamic Dimming.

Services

Wire these to a remote's press-and-release events (or call them from Developer Tools → Actions).

dynamic_dimming.move — start dimming and keep going until stopped:

service: dynamic_dimming.move
target:
  entity_id: light.living_room
data:
  direction: up        # up | down
  rate: medium         # optional: slow | medium | fast, or a number (brightness units/sec)

Dimming down bottoms out at the lowest on-level and stays lit (Zigbee "Move" semantics) — it won't turn the light off. Use light.turn_off for that.

dynamic_dimming.stop — stop an in-progress move, holding the current level:

service: dynamic_dimming.stop
target:
  entity_id: light.living_room

dynamic_dimming.step — one relative nudge:

service: dynamic_dimming.step
target:
  entity_id: light.living_room
data:
  direction: up        # up | down
  step_pct: 5          # optional, default 5 (% of perceptual travel)

dynamic_dimming.fade — go to an absolute level over a fixed duration:

service: dynamic_dimming.fade
target:
  entity_id: light.living_room
data:
  brightness_pct: 40   # 0-100
  duration: 3          # seconds, 0.1-120
  color_temp_kelvin: 2700   # optional; asserted from the first write, not faded

Unlike move, which is relative and open-ended, fade promises a level at a time — what a scene transition needs. It exists for lights whose platform can't honor light.turn_on's transition, notably WiZ. Backends that can't fade fall back to simulation, which writes absolute values and so always lands on target.

Every service except stop also takes an optional curve, and a backend override (auto, native, simulated).

All four take a standard Home Assistant target, so one call can name one light, a list of them, or an area — each entity is routed and tracked separately, and stop on one light leaves the others moving. entity_id under data: still works for callers that write it that way.

A typical hold-to-dim binding calls move on button-hold and stop on button-release.

Native backends

For Hue and deCONZ, cached brightness is used to compute a relative delta and duration. Stale state can affect both the rate and the endpoint, especially after a quick reversal. LIFX has a separate estimated-stop limitation described below. Hardware testing of these cases is outstanding. Native fade floors and timing resolution vary by platform; use light.turn_off when an off state is required.

On platforms whose protocol already has move/stop commands, the integration sends those commands instead of simulating the ramp — one message to start, one to stop, and the device dims itself.

Platform How it is driven Notes
Zigbee2MQTT brightness_move / brightness_step published to the device's /set topic Rate profiles map directly to Z2M's units-per-second. Plain brightness_move is used (never brightness_move_onoff), so dimming down stops at the lowest on-level. The base topic is configurable in the integration's options if yours is not zigbee2mqtt.
Tasmota Dimmer > / Dimmer < / Dimmer ! on the device's command topic for move/stop, Dimmer + / Dimmer - for step Ramp speed and step size are the device's own Speed, Fade, and DimmerStep settings; the rate and step_pct fields are ignored on this path, and Fade 1 must be enabled on the device for a visible ramp.
Matter Level Control cluster Move / Stop / Step, sent as device_command calls over the integration's own websocket to the Matter server Home Assistant's Matter integration surfaces no move/stop anywhere — not on the light platform, not as a service, not in its websocket API — so this backend opens its own connection to the same server the Matter config entry points at. Rate profiles map directly to Matter's level-units-per-second. Plain Move/Step are used (never the WithOnOff variants), so dimming down stops at the lowest on-level; the flip side, per the spec's Options handling, is that a move on a light that is off does nothing. fade is native too, as one MoveToLevelWithOnOff with a transition time — on Thread that is one command instead of forty.
ZHA Level Control cluster Move / Stop / Step, issued through ZHA's own zha.issue_zigbee_cluster_command service The same cluster the Zigbee2MQTT path drives, so it makes the same choices: rate profiles map directly to level-units-per-second, and plain Move/Step are used (never the WithOnOff variants), so dimming down stops at the lowest on-level and a move on a light that is off does nothing. No extra connection is needed — ZHA publishes a service that reaches any cluster on any node, so this backend is a service call. fade is native too, as one MoveToLevelWithOnOff with a transition time. Group lights are not claimed (they need a group command) and fall back to simulation.
Z-Wave JS Multilevel Switch CC StartLevelChange / StopLevelChange, invoked through the zwave_js.invoke_cc_api service Z-Wave carries no rate — only the time a full-scale sweep should take — so the rate profiles become durations of 6 s, 3 s and 2 s. The encoding is whole seconds, which is coarse, but the device still runs the ramp. Targeting the service by entity is what makes a multi-channel dimmer address its own channel rather than endpoint 0. The command class has no relative step, so step falls back to a single absolute write, which costs exactly what a native step would have. fade also falls back: Set with a duration can only express whole seconds, and the fade service promises an exact level at an exact time.
Shelly DimUp / DimDown / DimStop on the light's RPC component, POSTed to the device's own HTTP endpoint Gen2+ (RPC) devices only — the whole (Pro) Dimmer family, plus the CCT/RGB/RGBW light components, all of which carry the same three calls. The device runs the ramp; the existing Shelly integration supplies state updates. fade_rate is a discrete 1–5 speed class rather than a rate, so the profiles map slow/medium/fast → 1/3/5 and the exact sweep time is the firmware's. This adapter does not implement a relative step, so step falls back to a single absolute write — the same cost a native step would have had. fade is native, as one Set carrying transition_duration (and ct, on components with a white channel). Password-protected devices are driven with digest auth from the config entry; Gen1 devices fall back to simulation.
Hue dimming_delta transitions PUT to the light's CLIP v2 resource, through the aiohue client the Hue config entry already holds A move sends one bridge API request; release sends a stop request. The bridge speaks durations rather than rates, so a move is "delta to the rail over the time that distance takes at the requested rate", computed from the current brightness. Dimming down clips at the light's own minimum dim level and stays lit. step is native (dimming_delta with the delta), fade is native (dimming with a dynamics duration, on riding along), and a Hue room or zone entity is claimed too — grouped_light answers the same verbs as one bridge-coordinated command. API v2 bridges only; v1 falls back to simulation.
deCONZ bri_inc transitions written through the deconz.configure service; bri_inc: 0 stops the ramp in place The Hue v1 idiom deCONZ inherited: one REST write starts the gateway ramping the light, one halts it. Like the ZHA and Z-Wave JS paths this drives a public service, so there is no extra connection and the service's absence degrades cleanly to simulation. deCONZ speaks target-and-duration rather than rate, so a move is the distance to the rail over the time it takes at the requested rate, computed from current brightness; dimming down aims at bri 1 and stays lit. step is native (bri_inc with transitiontime: 0, matching the other Zigbee paths), fade is native (bri with a transitiontime, color asserted first), and deCONZ group entities are claimed too — dimmed under /action as one Zigbee group cast. Multi-gateway houses work: each call carries the entity's own bridgeid.
LIFX Device-side SetColor transitions over LAN UDP; estimated stop There is no native stop command. The backend estimates brightness from the requested ramp and elapsed time, then sends a zero-duration write and reasserts that level through HA. Packet loss, stale starting state, external commands and device timing can make the estimate inaccurate. Color comes from HA or the active ramp; concurrent color changes can be overwritten. Completed ramps are forgotten so later stops cannot restore an old level. move leaves off bulbs off; fade can turn them on. step uses the HA light integration. This path is not suitable where an exact device-side stop is required.
WiZ A stream of absolute setPilot datagrams straight to the bulb's IP on UDP 38899, sent fire-and-forget at the tick rate WiZ firmware has no ramp command and the HA integration doesn't advertise TRANSITION, so the ramp still has to be stepped — but not through light.turn_on. An acknowledged setPilot round-trip measures 38–476 ms (median ~160 ms), which a 20 Hz ramp cannot wait on; the same datagram sent unacknowledged costs ~0.3 ms. Every tick carries an absolute level, so a dropped datagram self-corrects on the next one. A light group whose members are all WiZ bulbs is claimed too, and driven from a single tick so the bulbs stay visibly in step.
Everything else Stepped simulation

Because the WiZ path bypasses light.turn_on, Home Assistant's state machine goes stale while a bulb is moving; stop and step re-assert the final level through the light entity to put the two back in agreement. LIFX also reasserts its estimated stop level through the light entity. The Matter, ZHA and Z-Wave JS paths need no such reconciliation for brightness: the device reports its own level and each integration's existing subscription feeds that straight back into Home Assistant, measured at one to two seconds on ZHA.

Color is the exception, and only on fade. ZHA subscribes to color_temperature on a thirty-second minimum interval rather than the one-second interval it gives brightness, and plenty of bulbs never bind the report at all — so after a fade asserts a white, the fixture is right while color_temp_kelvin can read the old value for tens of seconds, occasionally until something forces a read. Call homeassistant.update_entity after the fade if an automation needs the attribute promptly.

Selection is automatic. move, step and fade also accept an optional backend field (auto, native, simulated): simulated forces the stepped path on a natively-supported light, which is useful for comparing behavior, and native fails loudly if no native backend supports the light, or if the one that does has no native form of that particular verb.

Status

Version 0.8.0 adds no backends. It bounds what the simulated path can put on a mesh or bridge, fixes several ways a multi-light call could misbehave, and moves the evidence and traffic tables to the top of this page. See RELEASE_NOTES_0.8.0.md.

Z-Wave JS, Shelly, Hue, deCONZ and LIFX have automated protocol and routing tests but have not been validated on physical devices in this project. See TESTING.md for recorded hardware evidence and the remaining checks. Use backend: simulated to compare or bypass an adapter.

Part of a broader effort to bring native move/stop dimming to the Home Assistant ecosystem. Requires Home Assistant 2026.2 or newer.

About

Hold-to-dim for Home Assistant, using the command your light already speaks. Native ZHA, Z-Wave JS, Matter, Zigbee2MQTT, Tasmota and WiZ backends.

Topics

Resources

Stars

4 stars

Watchers

0 watching

Forks

Releases

Contributors

Languages