Skip to content

Replace pytuya with tinytuya, add protocol auto-detection and real-ti… - #67

Open
msupino wants to merge 9 commits into
ziirish:masterfrom
msupino:master
Open

Replace pytuya with tinytuya, add protocol auto-detection and real-ti…#67
msupino wants to merge 9 commits into
ziirish:masterfrom
msupino:master

Conversation

@msupino

@msupino msupino commented Mar 24, 2026

Copy link
Copy Markdown

…me state monitoring

  • Replace bundled pytuya with tinytuya (protocol 3.1-3.5 support)
  • Add automatic protocol version detection
  • Add persistent listener for real-time plug state updates
  • Replace polling checkbox with status monitor dropdown
  • Remove plugin debug_logging toggle, use OctoPrint's Logging settings
  • Consolidate to single logger, remove separate debug log file
  • Code cleanup, lint/format with ruff, drop Python 2 compat
  • Rewrite README for forked project

Made-with: Cursor

msupino added 9 commits March 24, 2026 09:26
…me state monitoring

- Replace bundled pytuya with tinytuya (protocol 3.1-3.5 support)
- Add automatic protocol version detection
- Add persistent listener for real-time plug state updates
- Replace polling checkbox with status monitor dropdown
- Remove plugin debug_logging toggle, use OctoPrint's Logging settings
- Consolidate to single logger, remove separate debug log file
- Code cleanup, lint/format with ruff, drop Python 2 compat
- Rewrite README for forked project

Made-with: Cursor
OctoPrint sends "M81 POWER" even when user types "M81 power",
so the label search must be case-insensitive.

Made-with: Cursor
Slot field now accepts comma-separated values (e.g. "3,4") to
control multiple outlets on the same device together. The primary
slot (first) is used for state monitoring.

Made-with: Cursor
New linkedPlugs field (comma-separated labels) triggers other
plugs to turn on/off together. Runs linked actions in separate
threads to avoid blocking. Uses _from_link flag to prevent loops.

Made-with: Cursor
Some Tuya devices only allow one active connection. The persistent
listener would conflict with sendCommand's connection, causing 914
errors. Now pauses the specific plug's listener before sending and
resumes it after, using per-plug stop events.

Made-with: Cursor
Only restart listeners when plug config actually changes (ip, id,
key, slot, version). Status updates that just save currentState
no longer trigger a full listener restart cascade.

Made-with: Cursor
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