netswitch

package
v0.0.0-...-621b64f Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2017 License: MIT Imports: 13 Imported by: 1

Documentation

Overview

netswitch control.

The NetSwitches have Relays that must be in sync with our system. For example when a NetSwitch is plugged in, the relay must go into the correct position. The mfi Switches are by default switched on and need to turn off after being plugged in.

Index

Constants

View Source
const NETSWITCH_TYPE_MFI = "mfi"

Variables

This section is empty.

Functions

This section is empty.

Types

type MfiSensor

type MfiSensor struct {
	Output      int     `json:"output"`
	Power       float64 `json:"power"`
	Energy      float64 `json:"energy"`
	Enabled     float64 `json:"enabled"`
	Current     float64 `json:"current"`
	Voltage     float64 `json:"voltage"`
	PowerFactor float64 `json:"powerfactor"`
	Relay       int     `json:"relay"`
	Lock        int     `json:"lock"`
}

type MfiSwitch

type MfiSwitch struct {
	Sensors []MfiSensor `json:"sensors"`
	Status  string      `json:"status"`
}

func (*MfiSwitch) On

func (swi *MfiSwitch) On() bool

type NetSwitch

type NetSwitch struct {
	On bool `json:"-"`
	// We're using this without Beego ORM attached
	Id                  int64
	NetswitchUrlOn      string
	NetswitchUrlOff     string
	NetswitchHost       string
	NetswitchSensorPort int
	NetswitchType       string
	// contains filtered or unexported fields
}

func (*NetSwitch) ApplyConfig

func (ns *NetSwitch) ApplyConfig(updates chan<- string, xmppClient *xmpp.Xmpp, userId int64) (err error)

func (*NetSwitch) FetchNetswitchStatus

func (ns *NetSwitch) FetchNetswitchStatus() (
	relayState string,
	current float64,
	err error,
)

func (*NetSwitch) SetOn

func (ns *NetSwitch) SetOn(on bool) (err error)

func (*NetSwitch) String

func (ns *NetSwitch) String() string

func (*NetSwitch) UrlOff

func (ns *NetSwitch) UrlOff() string

func (*NetSwitch) UrlOn

func (ns *NetSwitch) UrlOn() string

Jump to

Keyboard shortcuts

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