Repository navigation
Power readings, and plugctl wait for a power level - #11
Merged
Merged
Conversation
virzak
force-pushed
the
feature/power-wait
branch
from
November 29, 2026 21:28
7e3738b to
6f15f02
Compare
virzak
force-pushed
the
feature/power-wait
branch
from
November 29, 2026 21:34
6f15f02 to
88b0060
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On devices with a power meter, a job can now tell whether the load came back up after a cycle.
stateshows the draw in watts (power_win--json) on devices with a meter: Kasa KP115, KP125 and HS110 plugs, and Kasa bulbs.plugctl wait <plug> --above 2W | --below 1W [--for 5s] [--timeout 60s]reads the meter every second until the level holds for--forwithout a break, so a spike at power-on does not count. On timeout it exits 1 with the last reading; a device without a meter fails at once.Plug::power(defaults to no meter),Connected::powerandwait_power,PowerCondition,PowerWait, andError::NoPowerMeter/PowerTimeout. Kasa handles bothpower_mwand the first HS110'spowerin watts.Tested: unit tests for both reply formats, no meter, a hold broken by a dip, and the timeout. On a KL125 switched on:
stateshows 10.8 W,wait --above 2W --for 5ssucceeds after about 6 s, andwait --below 1Wfails with the last reading 10.8 W. Switched off,wait --below 1W --for 2ssucceeds at 0.0 W. An HS103 says it has no power meter. Not tested: a plug's meter (none here).