Device contract for a telemetry-only room thermal sensor. Defines SmartClaws topics, payload fields, and master-agent interpretation rules.
编程
Shelly Plug S Gen3
试用Device contract for Shelly Plug S Gen3. Defines SmartClaws topics, payloads, local Shelly RPC methods, and safety rules for bridge and master agents.
它能做什么
Device contract for Shelly Plug S Gen3. Defines SmartClaws topics, payloads, local Shelly RPC methods, and safety rules for bridge and master agents.
技能文档
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.outputapower_w<-apowervoltage_v<-voltagecurrent_a<-currentenergy_total<-aenergy.totaltemperature_c<-temperature.tC
Command Topic
Topic: command.switch.set
Payload:
{
"on": true,
"toggle_after": 0
}
Validation:
onis required boolean.toggle_afteris optional non-negative integer seconds.toggle_after: 0means no auto-revert.- Reject strings, floats, negative values, null, and unknown command topics.
Effect:
on: truemaps to relay ON.on: falsemaps 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_statusfrom the outgoing channel. - Decide whether a command is needed.
- Publish
command.switch.setonly when setup authority allows it. With the SmartClaws plugin, usesmartclaws_publishwith the registered devicenameanddeviceChannel: "command"so the write goes throughSmartClawsDevice.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.setfrom the incoming channel and callSwitch.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
outputmust 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
- Shelly Plug S Gen3 docs: https://shelly-api-docs.shelly.cloud/gen2/Devices/Gen3/ShellyPlugSG3
- Shelly Switch component RPC: https://shelly-api-docs.shelly.cloud/gen2/Components/FunctionalComponents/Switch/
- Shelly RPC protocol: https://shelly-api-docs.shelly.cloud/gen2/General/RPCProtocol
相关技能
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...
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.
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.