Documentation ¶
Index ¶
- type Connection
- type DeviceInfo
- type EnergyMeter
- func (sh *EnergyMeter) CurrentPower() (float64, error)
- func (sh *EnergyMeter) Currents() (float64, float64, float64, error)
- func (sh *EnergyMeter) Powers() (float64, float64, float64, error)
- func (sh *EnergyMeter) TotalEnergy() (float64, error)
- func (sh *EnergyMeter) Voltages() (float64, float64, float64, error)
- type Gen1StatusResponse
- type Gen1SwitchResponse
- type Gen2Em
- type Gen2EmData
- type Gen2EmDataStatusResponse
- type Gen2EmStatusResponse
- type Gen2RpcPost
- type Gen2StatusResponse
- type Gen2Switch
- type Gen2SwitchResponse
- type Switch
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Connection ¶
Connection is the Shelly connection
func NewConnection ¶
func NewConnection(uri, user, password string, channel int) (*Connection, error)
NewConnection creates a new Shelly device connection.
type DeviceInfo ¶
type DeviceInfo struct { Gen int `json:"gen"` Id string `json:"id"` Model string `json:"model"` Type string `json:"type"` Mac string `json:"mac"` App string `json:"app"` Auth bool `json:"auth"` AuthEn bool `json:"auth_en"` NumMeters int `json:"num_meters"` Profile string `json:"profile"` }
Shelly api homepage https://shelly-api-docs.shelly.cloud/#common-http-api
type EnergyMeter ¶
type EnergyMeter struct {
*Connection
}
func NewEnergyMeter ¶
func NewEnergyMeter(conn *Connection) *EnergyMeter
func (*EnergyMeter) CurrentPower ¶
func (sh *EnergyMeter) CurrentPower() (float64, error)
CurrentPower implements the api.Meter interface
func (*EnergyMeter) Currents ¶
func (sh *EnergyMeter) Currents() (float64, float64, float64, error)
Currents implements the api.PhaseCurrents interface
func (*EnergyMeter) Powers ¶
func (sh *EnergyMeter) Powers() (float64, float64, float64, error)
Powers implements the api.PhasePowers interface
func (*EnergyMeter) TotalEnergy ¶
func (sh *EnergyMeter) TotalEnergy() (float64, error)
TotalEnergy implements the api.Meter interface
type Gen1StatusResponse ¶
type Gen1SwitchResponse ¶
type Gen1SwitchResponse struct {
Ison bool
}
type Gen2EmData ¶
type Gen2EmDataStatusResponse ¶
type Gen2EmDataStatusResponse struct {
TotalEnergy float64 `json:"total_act"`
}
type Gen2EmStatusResponse ¶
type Gen2EmStatusResponse struct { TotalPower float64 `json:"total_act_power"` CurrentA float64 `json:"a_current"` CurrentB float64 `json:"b_current"` CurrentC float64 `json:"c_current"` VoltageA float64 `json:"a_voltage"` VoltageB float64 `json:"b_voltage"` VoltageC float64 `json:"c_voltage"` PowerA float64 `json:"a_act_power"` PowerB float64 `json:"b_act_power"` PowerC float64 `json:"c_act_power"` Em0 Gen2Em `json:"em1:0"` Em1 Gen2Em `json:"em1:1"` Em2 Gen2Em `json:"em1:2"` Em0Data Gen2EmData `json:"em1data:0"` Em1Data Gen2EmData `json:"em1data:1"` Em2Data Gen2EmData `json:"em1data:2"` }
type Gen2RpcPost ¶
type Gen2StatusResponse ¶
type Gen2StatusResponse struct { Switch0 Gen2Switch `json:"switch:0"` Switch1 Gen2Switch `json:"switch:1"` Switch2 Gen2Switch `json:"switch:2"` Pm0 Gen2Switch `json:"pm1:0"` Pm1 Gen2Switch `json:"pm2:1"` Pm2 Gen2Switch `json:"pm3:2"` }
type Gen2Switch ¶
type Gen2SwitchResponse ¶
type Gen2SwitchResponse struct {
Output bool `json:"output"`
}
type Switch ¶
type Switch struct {
*Connection
}
func NewSwitch ¶
func NewSwitch(conn *Connection) *Switch
func (*Switch) CurrentPower ¶
CurrentPower implements the api.Meter interface
func (*Switch) TotalEnergy ¶
TotalEnergy implements the api.Meter interface
Click to show internal directories.
Click to hide internal directories.