Skip to content

Apply near-dry margin to soil moisture low alert threshold - #6

Merged
spate141 merged 2 commits into
mainfrom
claude/notification-trigger-thresholds-rja3hq
Jul 12, 2026
Merged

Apply near-dry margin to soil moisture low alert threshold#6
spate141 merged 2 commits into
mainfrom
claude/notification-trigger-thresholds-rja3hq

Conversation

@spate141

Copy link
Copy Markdown
Owner

The "Low soil moisture" alert fired the instant a reading dipped under
band.min, which is the same cutoff the "Soil moisture vs. band" dashboard
chart uses to distinguish "Drying" (still OK) from "Dry". The dashboard
already buffers this with _nearDryMargin (25% of band width, floored at
2 points); the alert had no equivalent, so it re-fired on every small dip
that the dashboard itself wouldn't yet call dry.

Add derived.near_dry_margin() as a Python port of the JS helper and apply
it in rules._bed_dry_threshold(), so the Telegram alert only fires once a
bed has crossed into the same "Dry" zone shown on the dashboard.

Co-Authored-By: Claude Sonnet 5 noreply@anthropic.com
Claude-Session: https://claude.ai/code/session_01AaJ9A6DwhXAQP6xXzAvMpJ

claude added 2 commits July 12, 2026 13:45
The "Low soil moisture" alert fired the instant a reading dipped under
band.min, which is the same cutoff the "Soil moisture vs. band" dashboard
chart uses to distinguish "Drying" (still OK) from "Dry". The dashboard
already buffers this with _nearDryMargin (25% of band width, floored at
2 points); the alert had no equivalent, so it re-fired on every small dip
that the dashboard itself wouldn't yet call dry.

Add derived.near_dry_margin() as a Python port of the JS helper and apply
it in rules._bed_dry_threshold(), so the Telegram alert only fires once a
bed has crossed into the same "Dry" zone shown on the dashboard.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AaJ9A6DwhXAQP6xXzAvMpJ
deploy.sh restarts garden-agent itself partway through, so bot.py launches
it as an independent transient systemd unit (systemd-run --collect) instead
of a plain subprocess -- otherwise that restart would kill the deploy script
before it finished the remaining steps. deploy.sh now also notifies Telegram
of success/failure directly via curl, since the process that queued the
deploy doesn't survive to report back itself.

Requires one-time passwordless sudo setup on the VM for systemctl/tee/
systemd-run (documented in docs/telegram.md), since there's no terminal to
answer a sudo password prompt when the deploy is triggered from Telegram.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AaJ9A6DwhXAQP6xXzAvMpJ
@spate141 spate141 closed this Jul 12, 2026
@spate141 spate141 reopened this Jul 12, 2026
@spate141
spate141 merged commit 312ab92 into main Jul 12, 2026
6 checks 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.

2 participants