Skip to content

Keep the requested mode after set_mode() - #96

Open
TRusselo wants to merge 1 commit into
jath03:masterfrom
TRusselo:set-mode-tracks-requested-mode
Open

TRusselo wants to merge 1 commit into
jath03:masterfrom
TRusselo:set-mode-tracks-requested-mode

Conversation

@TRusselo

@TRusselo TRusselo commented Oct 1, 2026

Copy link
Copy Markdown

Device.set_mode() sends UPDATEMODE and then calls update(). OpenRGB 1.0 applies SDK writes on a per-controller thread but answers REQUEST_CONTROLLER_DATA right away, so that update() can return the previous mode. set_color() and set_colors() then dispatch on the stale active_mode, and when it has no colors (e.g. Off) they send nothing, without an error.

Home Assistant's OpenRGB integration hits this every time it turns a light on from Off: set_mode("Direct") followed by set_color(color, fast=True) leaves the device in Direct with its old color.

This keeps active_mode at the mode that was just sent. Against servers that apply writes in order the re-read already matches, so nothing changes there.

The server side is reported as https://gitlab.com/CalcProgrammer1/OpenRGB/-/work_items/5924.

Testing

Off → set_mode("Direct") → random set_color(..., fast=True), 20 rounds, each result checked from a second client (script in the OpenRGB issue), on a Razer Goliathus:

Server 0.3.7 This branch
OpenRGB master 0b02dc62 (protocol 6) 0–3/20, timing dependent 20/20
OpenRGB git 1e1fb09 (protocol 5) 20/20 20/20

flake8 and mypy output is unchanged.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Bs25H1VRVY917EZg6GxZhr

OpenRGB 1.0 applies SDK writes on a per-controller thread but answers
REQUEST_CONTROLLER_DATA right away, so the update() in set_mode() can
return the previous mode. set_color() and set_colors() then dispatch on
that stale mode, and when it has no colors (e.g. Off) they send nothing.
Home Assistant hits this every time it turns a light on from Off.

See https://gitlab.com/CalcProgrammer1/OpenRGB/-/work_items/5924

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Bs25H1VRVY917EZg6GxZhr
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