Documentation
¶
Index ¶
- Constants
- type Config
- type Device
- func (d *Device) AuthConfigRequest(auth *device.AuthConfig) (*http.Request, error)
- func (d *Device) ConfigureRequests(config device.Config) ([]*http.Request, error)
- func (d *Device) DelimitedRow(sep string) string
- func (d *Device) Driver() string
- func (d *Device) EnrichRequest() (*http.Request, error)
- func (d *Device) EnrichUnmarshaler() *json.Unmarshalers
- func (d *Device) Generation() string
- func (d *Device) ID() string
- func (d *Device) IP() net.IP
- func (d *Device) MAC() net.HardwareAddr
- func (d *Device) MarshalJSON() ([]byte, error)
- func (d *Device) Model() string
- func (d *Device) Name() string
- func (d *Device) Outdated() bool
- func (d *Device) RebootRequest() (*http.Request, error)
- func (d *Device) Secured() bool
- func (d *Device) SetCredentials(cred *device.Credentials)
- func (d *Device) UpdateDetails() string
- func (d *Device) UpdateRequest() (*http.Request, error)
- func (d *Device) Vendor() string
- func (d *Device) VersionRequest() (*http.Request, error)
- func (d *Device) VersionUnmarshaler() *json.Unmarshalers
- type Prober
Constants ¶
const ( // Driver name for this device implementation. Driver = "shellygen1" // Vendor represents the name of the company that developed the device. Vendor = "Shelly" // Generation of this device implementation. Generation = "1" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Policy *device.Policy `json:"policy,omitempty"`
Settings *settings `json:"settings,omitempty"`
SettingsAP *settings `json:"settings_ap,omitempty"`
SettingsSTA *settings `json:"settings_sta,omitempty"`
SettingsSTA1 *settings `json:"settings_sta1,omitempty"`
SettingsCloud *settings `json:"settings_cloud,omitempty"`
SettingsActions *[]*settings `json:"settings_actions,omitempty"`
SettingsRelay *[]*settings `json:"settings_relay,omitempty"`
SettingsPower *[]*settings `json:"settings_power,omitempty"`
SettingsExtTemperature *[]*settings `json:"settings_ext_temperature,omitempty"`
SettingsExtHumidity *[]*settings `json:"settings_ext_humidity,omitempty"`
SettingsExtSwitch *[]*settings `json:"settings_ext_switch,omitempty"`
}
Config implementation for the Shelly Gen1 driver.
type Device ¶
type Device struct {
Firmware string
FirmwareNext string
// contains filtered or unexported fields
}
Device implementation for the Shelly Gen1 driver.
func (*Device) AuthConfigRequest ¶
AuthConfigRequest returns an authentication setup HTTP request. See: https://shelly-api-docs.shelly.cloud/gen1/#settings-login
func (*Device) ConfigureRequests ¶
ConfigureRequests generates a slice of *http.Requests that are to be executed in order to configure an IoT device.
func (*Device) DelimitedRow ¶
DelimitedRow returns a string representation of the resource, with fields separated by a delimiter (e.g., comma or tab).
func (*Device) EnrichRequest ¶
EnrichRequest returns an HTTP request for device data enrichment. See: https://shelly-api-docs.shelly.cloud/gen1/#settings
func (*Device) EnrichUnmarshaler ¶
func (d *Device) EnrichUnmarshaler() *json.Unmarshalers
EnrichUnmarshaler returns a *json.Unmarshalers for decoding additional metadata from a secondary data source (i.e. endpoint).
func (*Device) Generation ¶
Generation represents the generation of this device.
func (*Device) MarshalJSON ¶
MarshalJSON implements the Marshaler interface.
func (*Device) RebootRequest ¶
RebootRequest returns a device reboot HTTP request. See: https://shelly-api-docs.shelly.cloud/gen1/#reboot
func (*Device) Secured ¶
Secured returns true if the device requires authentication to be accessed, false otherwise.
func (*Device) SetCredentials ¶
func (d *Device) SetCredentials(cred *device.Credentials)
SetCredentials for device authentication.
func (*Device) UpdateDetails ¶
UpdateDetails prints the device update information.
func (*Device) UpdateRequest ¶
UpdateRequest returns a device firmware update HTTP request. See: https://shelly-api-docs.shelly.cloud/gen1/#ota
func (*Device) VersionRequest ¶
VersionRequest for a device version check via HTTP. See: https://shelly-api-docs.shelly.cloud/gen1/#ota
func (*Device) VersionUnmarshaler ¶
func (d *Device) VersionUnmarshaler() *json.Unmarshalers
VersionUnmarshaler returns a *json.Unmarshalers that decodes the JSON response from the device's version API endpoint. It is used to interpret the version information so the caller can determine whether a newer firmware release is available.
type Prober ¶
type Prober struct{}
Prober implementation for the Shelly Gen1 driver.
func (*Prober) Unmarshaler ¶
func (p *Prober) Unmarshaler() *json.Unmarshalers
Unmarshaler returns a *json.Unmarshalers for decoding the JSON response from a network probe. On success, it hydrates a Device resource. This typically includes the device model, MAC address, security status, and firmware version. If the required fields are missing, it returns an error indicating an unexpected device.