Skip to content

Read and switch Kasa bulbs - #8

Merged
virzak merged 1 commit into
masterfrom
fix/kasa-bulbs
Nov 29, 2026
Merged

virzak merged 1 commit into
masterfrom
fix/kasa-bulbs

Conversation

@virzak

@virzak virzak commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

Kasa bulbs report on/off in light_state.on_off and have no relay_state, so plugctl read a lit bulb as off, and the plug's relay command does not switch one.

  • A device whose sysinfo has light_state is treated as a bulb: state comes from light_state.on_off, and switching goes through smartlife.iot.smartbulb.lightingservice / transition_light_state with no fade. Light strips (sysinfo has length) use smartlife.iot.lightStrip; no strip was available to test.
  • Switch replies now check err_code for plugs too, so a command the device rejects is an error rather than a silent success.
  • Brightness and colour are out of scope.

Tested: unit tests for parsing and commands; plugctl state on two KL125 bulbs agrees with python-kasa (read-only). On a KL125: on, cycle (5 s) and off switched it at once and each was read back; python-kasa confirmed it ended off. On an HS103 that was already on, on passed the new err_code check.

Bulbs have no relay_state, so they always read as off, and the relay
command does nothing on them. Switch replies now check err_code.
@virzak
virzak merged commit b747ec3 into master Nov 29, 2026
3 checks passed
@virzak
virzak deleted the fix/kasa-bulbs branch November 29, 2026 13:39
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