Skip to content

fix(tuya): retry once on a stale persistent socket before reporting offline - #47

Merged
Developer-Simon merged 3 commits into
mainfrom
fix/tuya-valve-offline-flapping
Sep 22, 2026
Merged

Developer-Simon merged 3 commits into
mainfrom
fix/tuya-valve-offline-flapping

Conversation

@Developer-Simon

Copy link
Copy Markdown
Owner

Squash-merge commit message

fix(tuya): retry once on a stale persistent socket before reporting offline

The Tuya valve bridge polls each device over a persistent TinyTuya
socket. Production logs show that socket returning "Unexpected
Payload from Device" (Err 904) on roughly every second poll, right
after a preceding successful poll on the same connection - a fresh
reconnect always succeeds immediately after. poll_one previously
treated any single failed poll as a hard offline flip, so this
alternation showed up as the valve flapping online/offline every
poll interval. Now a failed status() call reconnects and retries
once in the same cycle before giving up.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

Summary

Checklist

  • Subject line follows Conventional Commits
    (type(scope): summary) and matches the style in git log.
  • Relevant checks from
    CONTRIBUTING.md → Running the checks
    pass locally (Python bridges, HA integration, Go dashboard, dashboard JS,
    dashboard smoke test — whichever the change touches).
  • ./scripts/deploy/check_tracked_secrets.sh is clean — no real
    credentials, private-range IPs, or device serials.
  • AI assistance, if any, is disclosed per
    AI-DISCLAIMER.md.
  • For anything beyond a small fix: a linked issue describing the change.

Developer-Simon and others added 3 commits September 22, 2026 18:03
…ffline

The Tuya valve bridge polls each device over a persistent TinyTuya
socket. Production logs show that socket returning "Unexpected
Payload from Device" (Err 904) on roughly every second poll, right
after a preceding successful poll on the same connection - a fresh
reconnect always succeeds immediately after. poll_one previously
treated any single failed poll as a hard offline flip, so this
alternation showed up as the valve flapping online/offline every
poll interval. Now a failed status() call reconnects and retries
once in the same cycle before giving up.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@Developer-Simon
Developer-Simon merged commit 1dfc8bd into main Sep 22, 2026
15 checks passed
@Developer-Simon
Developer-Simon deleted the fix/tuya-valve-offline-flapping branch September 22, 2026 16:08
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