Skip to main content

Module switchkit_impl

Module switchkit_impl 

Source
Expand description

switchkit::SmartDevice adapter for Shelly Gen1 (REST) and Gen2/3 (JSON-RPC) devices.

ShellyClient is stateless: one instance serves every switchkit::DeviceTarget. Every trait method opens a fresh ShellyDevice addressed by DeviceTarget.host (never DeviceInfo.ip, which drops any port a target carries), then maps the shelly-core response onto switchkit’s vendor-neutral types.

§Honesty

[snapshot_from] only ever converts a value the device actually reported. A switch absent from the device’s status response is simply absent from relays (never a fabricated Off); metering fields (energy) are None unless at least one switch actually reports a metering value; signal is only ever built from a real dBm reading via Signal::from_dbm, never a guessed percentage. See the field-level comments in snapshot_from for the full mapping.

Structs§

ShellyClient
Stateless switchkit::SmartDevice adapter for Shelly devices. No per-device state is kept here; every call re-opens the device (a cheap HTTP probe) so the adapter always reflects the device’s current generation and identity.