Skip to content

Show device sleep and filter for asleep devices - #36

Merged
joshk merged 1 commit into
mainfrom
feature/device-sleep
Nov 25, 2026
Merged

joshk merged 1 commit into
mainfrom
feature/device-sleep

Conversation

@joshk

@joshk joshk commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

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 sleep object with state, mode and expected_wake_at. The device list's connection filter and the advanced query's connection column accept asleep. connection_status and online don't change, so a sleeping device still reports disconnected there.

This PR updates nh to match:

  • nh device list --filter connection:asleep no longer fails in nh. Before, asleep wasn't in nh's list of allowed values. The help text now lists it and mentions connection = "asleep" for --query.
  • api.Device has a new Sleep field (DeviceSleep: state, mode, expected wake time). It is nil when the server sends sleep: null or doesn't send the field.
  • nh device show adds a Sleep: row after Status: when the device is sleeping. Examples: deep, back at <time>, deep, overdue: was due back <time>, or light, going to sleep. Status: stays as it is.

The asleep filter only matches devices on a server running nerves-hub/nerves_hub_web#3349.

🤖 Generated with Claude Code

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>
@joshk
joshk merged commit 76382e9 into main Nov 25, 2026
1 check 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.

1 participant