Coding

Shelly Plug S Gen3

Try it

Device contract for Shelly Plug S Gen3. Defines SmartClaws topics, payloads, local Shelly RPC methods, and safety rules for bridge and master agents.

What it does

Device contract for Shelly Plug S Gen3. Defines SmartClaws topics, payloads, local Shelly RPC methods, and safety rules for bridge and master agents.

The skill document

Shelly Plug S Gen3 Device Contract

This is a device contract skill. It does not install SmartClaws, register a device, or define an agent role. Use it with smartclaws-master-agent or smartclaws-bridge-agent.

Device Identity

  • Vendor: Shelly
  • Device: Shelly Plug S Gen3, Type F variant
  • Capability: one relay switch channel with built-in power metering
  • Local protocol: Shelly Gen2+/Gen3 JSON-RPC over HTTP
  • Controllable component: switch:0

SmartClaws Channels

The setup must provide channel addresses in SMARTCLAWS.md.

  • Outgoing telemetry channel: required.
  • Incoming command channel: required only for commandable setups.

Do not invent channel addresses. If a channel is missing, ask for setup.

Telemetry Topic

Topic: telemetry.switch_status

Normalized payload:

{
  "output": true,
  "apower_w": 852.3,
  "voltage_v": 230.1,
  "current_a": 3.7,
  "energy_total": 142.4,
  "temperature_c": 41.5
}

Fields:

  • output: relay state, true = ON, false = OFF.
  • apower_w: active power in watts.
  • voltage_v: mains voltage.
  • current_a: current draw in amps.
  • energy_total: cumulative energy value reported by Shelly.
  • temperature_c: plug internal temperature in Celsius; not room temperature.

Shelly RPC source mapping:

  • output <- Switch.GetStatus?id=0.output
  • apower_w <- apower
  • voltage_v <- voltage
  • current_a <- current
  • energy_total <- aenergy.total
  • temperature_c <- temperature.tC

Command Topic

Topic: command.switch.set

Payload:

{
  "on": true,
  "toggle_after": 0
}

Validation:

  • on is required boolean.
  • toggle_after is optional non-negative integer seconds.
  • toggle_after: 0 means no auto-revert.
  • Reject strings, floats, negative values, null, and unknown command topics.

Effect:

  • on: true maps to relay ON.
  • on: false maps to relay OFF.

Local RPC Methods

Read device info:

GET /rpc/Shelly.GetDeviceInfo

Read relay/power state:

GET /rpc/Switch.GetStatus?id=0

Set relay state:

GET /rpc/Switch.Set?id=0&on=true
GET /rpc/Switch.Set?id=0&on=false

If authentication is enabled, the bridge setup must provide the credential path or mechanism. Do not print credentials.

Master-Agent Use

A master may:

  • Read telemetry.switch_status from the outgoing channel.
  • Decide whether a command is needed.
  • Publish command.switch.set only when setup authority allows it. With the SmartClaws plugin, use smartclaws_publish with the registered device name and deviceChannel: "command" so the write goes through SmartClawsDevice.publishCommand.

A master must not:

  • Call Shelly RPC directly.
  • Treat plug internal temperature as room temperature.
  • Re-send commands repeatedly without checking recent telemetry/decision state.

Bridge-Agent Use

A bridge may:

  • Read Shelly RPC status and publish telemetry.switch_status.
  • In command-enabled modes, read command.switch.set from the incoming channel and call Switch.Set.
  • Persist the last handled command offset in its setup state file.

A bridge must not:

  • Execute unknown command topics.
  • Reprocess already-handled command offsets.
  • Publish fake telemetry unless explicitly running a labelled simulation.

Sanity Rules

  • output must be boolean.
  • Power, voltage, current, energy, and temperature must be numeric when present.
  • Missing optional numeric fields may be omitted; do not invent values.
  • If Shelly is unreachable, publish no telemetry for that cycle and log/fail loud.

References

Related skills

Device contract for a telemetry-only room thermal sensor. Defines SmartClaws topics, payload fields, and master-agent interpretation rules.

1 installs

Device contract for a NovaPM/SDS011 air-quality bridge. Defines SmartClaws telemetry topics, payloads, local serial behavior, and safety rules.

SmartPi 设备绑定、扫码、设备管理与连接故障排查。Use when the user mentions binding SmartPi, SmartPi QR code, 9002, SmartPi connection failure, listing SmartPi devices, or removi...

27 installs

Run one SmartClaws bridge cycle for a single device: read the local hardware/API, validate against the device contract, and publish telemetry on-chain — and, in a command-enabled mode, apply on-chain commands. Trigger when asked to read the sensor and publish, run a telemetry/bridge cycle, or apply incoming device commands. Needs the SmartClaws plugin and one device contract skill.

Run one SmartClaws master control cycle: read device telemetry on-chain, decide under the owner's guidelines, command a device only when allowed, and log the decision on-chain. Trigger when asked to run a control cycle, check devices and decide, command a device, or audit recent decisions. Needs the SmartClaws plugin and a device contract skill per device.

1 installs

Query and control a SimpliSafe alarm system from the shell with curl — read system state, sensors, locks, events and settings, and arm/disarm or lock/unlock. Use when the user asks about their SimpliSafe alarm, house sensors, door locks, or whether the system is armed. Requires a one-time browser login to mint a refresh token.

1 installs