Skip to content

v4.4.0: choose which Shellys to add, and Gen 4 input states via Modbus - #1

Merged
Highsteads merged 2 commits into
mainfrom
claude/cool-brown-t681ae
Nov 2, 2026
Merged

Highsteads merged 2 commits into
mainfrom
claude/cool-brown-t681ae

Conversation

@Highsteads

Copy link
Copy Markdown
Owner

What this adds

Choose which Shellys become Indigo devices

  • Discovered list: each Shelly that mDNS announces is probed once with Shelly.GetDeviceInfo, classified by the same code Discover uses (now _classify_shelly(), moved unchanged), and remembered by MAC. Nothing is created.
  • Discovered Shelly menu in all 10 IP device dialogs. It lists only channels of that type that no other Indigo device owns, and picking one fills in IP, channel, PM and 3-phase. On save, the MAC is stored only if the fields still match the pick. A channel taken meanwhile is refused, with the owning device named.
  • Plugins → Shelly Direct → Create Indigo Devices...
    • Pick one Shelly or all, and tick the kinds to create. Only free channels are created.
    • The MAC is read again at the Shelly's address before anything is created.
    • A Scan Subnets button runs a probe-only scan that creates nothing.
  • channel_specs() follows the same creation rules as _discover_thread. A parity test checks that both produce the same types, names and props. Discover Shelly Devices is unchanged.

Gen 4 input states

  • Gen 4 relays and dimmers get dynamic input<N> and inputReadVia states.
  • Switch-type inputs: read from Input.GetStatus and from live NotifyStatus messages.
  • Button-type inputs, which report state null over RPC:
    • Read over Modbus TCP, only when the user has already enabled Modbus on the Shelly.
    • Read-only: only functions 2 and 4 are sent, and the plugin never turns Modbus on.
    • The MAC is checked over Modbus before a reading is trusted.
    • After a failed read, Modbus is left alone for 10 minutes.
    • Without Modbus, the state follows live btn_down / btn_up events.
  • An input that cannot be read is never written.
  • The register map comes from Shelly's Modbus and Input API pages. Unit id 1 and the MAC byte order are not documented by Shelly. They follow berkinet/shelly-indigo's hardware test and are unverified here.

Docs and version

  • Info.plist, the plugin.py header, the README, docs/changelog.md, docs/getting-started.md, docs/plugin-menu.md and docs/devices.md are updated for 4.4.0.

Testing

  • pytest tests: 619 passed, 2 skipped. New tests are in tests/test_v440_discovered_devices.py and tests/test_v440_modbus_inputs.py. ruff check and compileall are clean.
  • Four existing tests in tests/test_v320_features.py needed a _poll_inputs stub on their fake host.
  • Not yet run on a live Indigo server or a Gen 4 Shelly. Please check:
    1. In the Create dialog, with nothing ticked, an error is shown and the dialog stays open.
    2. The MAC from a pick is kept after saving.
    3. The Discovered Shelly list updates after clicking Refresh.
    4. On a Gen 4 with Modbus enabled, input0 follows a held button.

Generated by Claude Code

…vices menu

- Shellys announced by mDNS (and found by a new probe-only subnet scan) are
  classified and remembered by MAC without creating anything.
- Every IP device dialog gains a Discovered Shelly menu listing free channels
  of that type; picking one fills address, channel and PM. The MAC is stored
  on save only if the fields still match the pick, and a channel taken
  meanwhile is refused.
- New Plugins -> Shelly Direct -> Create Indigo Devices... creates the ticked
  kinds for one Shelly or all, free channels only, after re-reading the MAC
  at the address.
- Discovery's classification moved unchanged into _classify_shelly;
  channel_specs() mirrors its creation rules, held to parity by a test.
- Discover Shelly Devices is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019Z2FM6p63Gkkv8cJ1oUXq8
- Gen 4 relays and dimmers get dynamic input<N> and inputReadVia states.
- Switch-type inputs: Input.GetStatus state, and live NotifyStatus deltas.
- Button-type inputs (state null over RPC): read over Modbus TCP when the
  user has enabled Modbus on the Shelly; otherwise live btn_down/btn_up.
- Modbus is read-only (functions 2 and 4), checks the MAC over Modbus
  before trusting a reading, never enables Modbus, and backs off 10 min
  after a failure. An input that cannot be read is never written.
- Register map from Shelly's Modbus and Input API docs; unit id 1 and the
  MAC byte-order handling follow berkinet/shelly-indigo's hardware test.
- tests/test_v440_modbus_inputs.py; docs and changelog updated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019Z2FM6p63Gkkv8cJ1oUXq8
@Highsteads
Highsteads merged commit bbb2cab into main Nov 2, 2026
1 check 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