Skip to content

Honour dynamics.duration on v2 light and grouped_light updates - #1157

Merged
mariusmotea merged 1 commit into
diyhue:masterfrom
Pharex38:v2-dynamics-duration
Oct 23, 2026
Merged

mariusmotea merged 1 commit into
diyhue:masterfrom
Pharex38:v2-dynamics-duration

Conversation

@Pharex38

Copy link
Copy Markdown
Contributor

In the v2 API a transition is sent as dynamics.duration (milliseconds), for example PUT /clip/v2/resource/light/<id> with {"on": {"on": true}, "dynamics": {"duration": 4000}}. v2StateToV1 only looked at the non-standard top-level transitiontime, so the duration was dropped and every v2 change ran with the protocol's default transition.

v2StateToV1 now converts dynamics.duration to v1 transitiontime (100 ms steps). Light PUTs (Light.setV2State) and grouped_light PUTs (setV2Action) both go through it, so both get the transition. From there it takes the same path as a v1 request with transitiontime. dynamics.speed (effect speed) is still handled in Light.setV2State as before, and the old top-level transitiontime still wins if a client sends it.

Tests: tests/test_v2_state_conversion.py covers the duration conversion, rounding, and that speed alone sets no transition. The duration cases fail on master; pytest tests passes.

@mariusmotea
mariusmotea merged commit 02852ec into diyhue:master Oct 23, 2026
5 checks passed
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.

2 participants