Repository navigation
Show device sleep and filter for asleep devices - #36
Merged
Merged
Conversation
NervesHub can now track devices that say they are going to sleep. The device JSON gains a nullable sleep object, and the device list's connection filter and advanced query accept "asleep". nh refused --filter connection:asleep because the value wasn't in its list; it is now. Device gains Sleep (state, mode, expected_wake_at), and nh device show adds a Sleep: row after Status:, which still says disconnected. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
NervesHub is adding device sleep tracking in nerves-hub/nerves_hub_web#3349. A device can tell the server it's going to sleep, in deep or light mode and optionally for how long. The server then shows it as asleep or overdue instead of offline.
That PR only adds to the API. Device JSON gets a nullable
sleepobject withstate,modeandexpected_wake_at. The device list'sconnectionfilter and the advanced query'sconnectioncolumn acceptasleep.connection_statusandonlinedon't change, so a sleeping device still reportsdisconnectedthere.This PR updates nh to match:
nh device list --filter connection:asleepno longer fails in nh. Before,asleepwasn't in nh's list of allowed values. The help text now lists it and mentionsconnection = "asleep"for--query.api.Devicehas a newSleepfield (DeviceSleep: state, mode, expected wake time). It is nil when the server sendssleep: nullor doesn't send the field.nh device showadds aSleep:row afterStatus:when the device is sleeping. Examples:deep, back at <time>,deep, overdue: was due back <time>, orlight, going to sleep.Status:stays as it is.The
asleepfilter only matches devices on a server running nerves-hub/nerves_hub_web#3349.🤖 Generated with Claude Code