shelly

package
v0.0.0-...-c35a62c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 24, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Connection

type Connection struct {
	Generation
}

Connection is the Shelly connection

func NewConnection

func NewConnection(uri, user, password string, channel int, cache time.Duration) (*Connection, error)

NewConnection creates a new Shelly device connection.

type DeviceInfo

type DeviceInfo struct {
	Mac       string `json:"mac"`
	Gen       int    `json:"gen"`
	Model     string `json:"model"`
	Type      string `json:"type"`
	Auth      bool   `json:"auth"`
	AuthEn    bool   `json:"auth_en"`
	NumMeters int    `json:"num_meters"`
	Profile   string `json:"profile"`
}

DeviceInfo is the common /shelly endpoint response https://shelly-api-docs.shelly.cloud/gen1/#shelly https://shelly-api-docs.shelly.cloud/gen2/ComponentsAndServices/Shelly#http-endpoint-shelly

type Gen1Status

type Gen1Status struct {
	Meters []struct {
		Power          float64
		Current        float64
		Voltage        float64
		Total          float64
		Total_Returned float64
	}
	// Shelly EM meter JSON response
	EMeters []struct {
		Power          float64
		Current        float64
		Voltage        float64
		Total          float64
		Total_Returned float64
	}
}

type Gen1SwitchResponse

type Gen1SwitchResponse struct {
	Ison bool
}

type Gen2EM1Data

type Gen2EM1Data struct {
	TotalActEnergy    float64 `json:"total_act_energy"`
	TotalActRetEnergy float64 `json:"total_act_ret_energy"`
}

type Gen2EM1Status

type Gen2EM1Status struct {
	Current  float64 `json:"current"`
	Voltage  float64 `json:"voltage"`
	ActPower float64 `json:"act_power"`
}

type Gen2EMData

type Gen2EMData struct {
	TotalAct    float64 `json:"total_act"`
	TotalActRet float64 `json:"total_act_ret"`
}

type Gen2EMStatus

type Gen2EMStatus struct {
	TotalActPower float64 `json:"total_act_power"`
	ACurrent      float64 `json:"a_current"`
	BCurrent      float64 `json:"b_current"`
	CCurrent      float64 `json:"c_current"`
	AVoltage      float64 `json:"a_voltage"`
	BVoltage      float64 `json:"b_voltage"`
	CVoltage      float64 `json:"c_voltage"`
	AActPower     float64 `json:"a_act_power"`
	BActPower     float64 `json:"b_act_power"`
	CActPower     float64 `json:"c_act_power"`
}

type Gen2Methods

type Gen2Methods struct {
	Methods []string
}

type Gen2RpcPost

type Gen2RpcPost struct {
	Id     int    `json:"id"`
	On     bool   `json:"on"`
	Src    string `json:"src"`
	Method string `json:"method"`
}

type Gen2SwitchStatus

type Gen2SwitchStatus struct {
	Output  bool
	Apower  float64
	Voltage float64
	Current float64
	Aenergy struct {
		Total float64
	}
	Ret_Aenergy struct {
		Total float64
	}
}

type Generation

type Generation interface {
	CurrentPower() (float64, error)
	Enabled() (bool, error)
	Enable(bool) error
	TotalEnergy() (float64, error)
}

type Phases

type Phases interface {
	Currents() (float64, float64, float64, error)
	Voltages() (float64, float64, float64, error)
	Powers() (float64, float64, float64, error)
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL