class ShellyplugExporter::PlugClient

Overview

Handles HTTP communication with a single Shelly plug device.

Defined in:

shellyplug_exporter/plug_client.cr

Constant Summary

SHELLY_ENDPOINT = "/shelly"

Constructors

Instance Method Summary

Constructor Detail

def self.new(config : PlugConfig) #

[View source]

Instance Method Detail

def detect_generation : PlugGeneration #

Detects the plug generation by probing the /shelly endpoint. Gen2 devices include a "gen" field in their response. Returns the detected PlugGeneration, defaulting to Gen1 on failure.


[View source]
def fetch_settings : HTTP::Client::Response #

Fetches the settings/config from the plug.


[View source]
def fetch_status : HTTP::Client::Response #

Fetches the status from the plug.


[View source]