Apply near-dry margin to soil moisture low alert threshold - #6
Merged
Conversation
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
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.
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