Shelly.CloudV1 (Shelly v0.3.0)

Copy Markdown View Source

The legacy Shelly Cloud v1 API (/device/status, /device/relay/control). Shelly has deprecated it and announced removal — prefer Shelly.CloudV2 (same auth key) or the OAuth Shelly.Account API. Kept as a fallback.

Takes the same Shelly.Client as Shelly.CloudV2 — one holding an :auth_key.

Summary

Functions

Full status for one device, as {:ok, {device_status, online}}device_status goes to Shelly.Status.parse/4, online is the cloud's view of the device.

Switch a relay channel on or off.

Functions

get_status(conn, device_id)

@spec get_status(Shelly.Client.t(), String.t()) ::
  {:ok, {map(), boolean()}} | {:error, term()}

Full status for one device, as {:ok, {device_status, online}}device_status goes to Shelly.Status.parse/4, online is the cloud's view of the device.

The v1 response wraps the status: data holds online and device_status. Returning data itself (as this did before 0.2.1) handed callers a map Shelly.Status.parse/4 reads as "unknown" with on: false — a device that looks permanently off.

set_switch(conn, device_id, channel, on?)

@spec set_switch(Shelly.Client.t(), String.t(), non_neg_integer(), boolean()) ::
  :ok | {:error, term()}

Switch a relay channel on or off.