feat(cli): add alerts command for scriptable alarm-state scans#281
Open
jongio wants to merge 1 commit into
Open
feat(cli): add alerts command for scriptable alarm-state scans#281jongio wants to merge 1 commit into
jongio wants to merge 1 commit into
Conversation
Add a one-shot `alerts` command that scans the current alarm state across devices and reports any channel that is actively alarming. Without a serial it checks every device on the account; pass a serial to scope to one device. The command is built for scripting: it exits with code 1 when at least one channel is alarming and 0 when everything is clear, so a cron job or shell loop can trigger a webhook, text, or desktop notification when a cook goes out of range. The exit code is set in both human and --json modes. Reuses the SDK getChannelAlarmState helper for state classification. Read-only: it never writes to a device. Adds unit tests covering high and low alarm detection, single-device scoping, JSON output, the clear case, and the not-logged-in error path. Docs updated in the CLI README and cli-reference. Closes #276 Co-authored-by: Copilot App <[email protected]>
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.
What
Adds a one-shot
thermoworks alertscommand that scans the current alarm state across your devices and reports any channel that is actively alarming. Without a serial it checks every device on the account; pass a serial to scope to one device.Why
The CLI can arm and list alarms (
alarm set/alarm list), but there was no scriptable way to ask "is anything alarming right now?"watchshows live alarm state on screen, but you cannot drop it in a cron job or shell loop.alertsfills that gap with a plain exit-code contract.How
getChannelAlarmStatehelper to classify each channel ashigh,low, ornone.getDevices/getDeviceplusgetAllDeviceChannels. Read-only, so it never writes to a device.1when at least one channel is alarming and0when everything is clear. The exit code is set in both human and--jsonmodes so scripts can branch on it.--jsonprints an array of{ serial, deviceLabel, channel, channelLabel, state, value, units }.Testing
packages/cli/tests/alerts.test.ts: high and low alarm detection with a non-zero exit code, the clear case at exit 0, single-device scoping viagetDevice, JSON output shape, empty JSON array, and the not-logged-in error path.pnpm --dir packages/cli typecheckclean.pnpm --dir packages/cli testgreen (883 tests).pnpm lintclean.Docs
packages/cli/README.md: newthermoworks alertssection.docs/cli-reference.md: newthermoworks alertsreference plus added to the--jsonsupported-commands list.Closes #276