pub struct ShellyClient { /* private fields */ }Expand description
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.
Implementations§
Source§impl ShellyClient
impl ShellyClient
Trait Implementations§
Source§impl Default for ShellyClient
impl Default for ShellyClient
Source§impl SmartDevice for ShellyClient
impl SmartDevice for ShellyClient
Source§fn probe<'life0, 'life1, 'async_trait>(
&'life0 self,
target: &'life1 DeviceTarget,
) -> Pin<Box<dyn Future<Output = Result<Option<DeviceSnapshot>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn probe<'life0, 'life1, 'async_trait>(
&'life0 self,
target: &'life1 DeviceTarget,
) -> Pin<Box<dyn Future<Output = Result<Option<DeviceSnapshot>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Reachable-but-not-Shelly (probe_target returning Error::Parse)
maps to Ok(None), never a guessed vendor. Any other error (offline,
auth, …) propagates as Err.
Source§fn set_power<'life0, 'life1, 'async_trait>(
&'life0 self,
target: &'life1 DeviceTarget,
channel: Option<u8>,
action: PowerAction,
) -> Pin<Box<dyn Future<Output = Result<Relay>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn set_power<'life0, 'life1, 'async_trait>(
&'life0 self,
target: &'life1 DeviceTarget,
channel: Option<u8>,
action: PowerAction,
) -> Pin<Box<dyn Future<Output = Result<Relay>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Issues the power action, then reads back the CONFIRMED post-change
state via switch_status rather than trusting SwitchResult.was_on
(the previous state for Gen2’s Switch.Set/Switch.Toggle, with
inconsistent semantics across generations).
Source§fn firmware_update<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
target: &'life1 DeviceTarget,
_ota_url: Option<&'life2 str>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn firmware_update<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
target: &'life1 DeviceTarget,
_ota_url: Option<&'life2 str>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Shelly’s stable-channel OTA update takes no URL parameter; ota_url
is accepted for trait compatibility but unused in v1.
Source§fn config_get<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
target: &'life1 DeviceTarget,
setting: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Value>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn config_get<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
target: &'life1 DeviceTarget,
setting: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Value>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Shelly has no single-setting GET; config is one blob. setting == ""
returns the whole config. A non-empty setting returns that
top-level key’s value when present; an absent key is Err(Rejected),
never a fabricated null/{} (absent is not a value).
Source§fn config_set<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
target: &'life1 DeviceTarget,
setting: &'life2 str,
value: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<Value>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn config_set<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
target: &'life1 DeviceTarget,
setting: &'life2 str,
value: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<Value>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Returns the device’s actual response to the settings write, never a
fabricated {"ok":true}.
Source§fn backup<'life0, 'life1, 'async_trait>(
&'life0 self,
target: &'life1 DeviceTarget,
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn backup<'life0, 'life1, 'async_trait>(
&'life0 self,
target: &'life1 DeviceTarget,
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
A Shelly config backup is its settings JSON, pretty-printed.
Source§fn console<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
target: &'life1 DeviceTarget,
command: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Value>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn console<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
target: &'life1 DeviceTarget,
command: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Value>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Gen2/3 only: command is "Method [json-params]", passed through
verbatim to the device’s JSON-RPC endpoint. Gen1 has no RPC console,
so it is genuinely Unsupported, not an empty/guessed response.
fn vendor(&self) -> Vendor
Source§fn status<'life0, 'life1, 'async_trait>(
&'life0 self,
target: &'life1 DeviceTarget,
) -> Pin<Box<dyn Future<Output = Result<DeviceSnapshot>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn status<'life0, 'life1, 'async_trait>(
&'life0 self,
target: &'life1 DeviceTarget,
) -> Pin<Box<dyn Future<Output = Result<DeviceSnapshot>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Ok = reachable reading; Err = unreadable (the consumer renders offline).