go_anel_pwrctrl

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2022 License: MIT Imports: 5 Imported by: 1

README

go-anel-pwrctrl

go wrapper for ip power outlets (ANEL-Elektronik NET-PwrCtrl)

How the API works

The Power outlets api is very rudimentary. It's status is reported through a csv like (; seperated) string similar to this:

Device type Device name Device IP Device netmask Gateway? MAC-addr ? ? ? ? Outlet name 1 Outlet name 2 ... outlet status 1 outlet status 2 ...
NET-PWRCTRL_04.6 NET-CONTROL 123.4.5.6 255.255.255.0 123.4.5.254 00:01:02:03:04:05 06 H Rote Lampe (Rec) Dell Monitor Nr. 3 Nr. 4 Nr. 5 Nr. 6 Nr. 7 Nr. 8 1 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 an vom Browser aus vom Browser aus vom Browser Anfangsstatus Anfangsstatus Anfangsstatus Anfangsstatus Anfangsstatus end NET - Power Control

Index 20+i tells us whether outlet i is on or not.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PwrCtrl

type PwrCtrl struct {
	// contains filtered or unexported fields
}

func New

func New(addr string, auth string) PwrCtrl

New creates an instance of PwrCtrl. Auth should be provided like "user:password"

func (*PwrCtrl) IsOn

func (c *PwrCtrl) IsOn(outletIndex int) (bool, error)

IsOn returns whether the outlet with index outletIndex is on or not.

func (*PwrCtrl) TurnOff

func (c *PwrCtrl) TurnOff(outletIndex int) error

TurnOff powers off the outlet with the index outletIndex

func (*PwrCtrl) TurnOn

func (c *PwrCtrl) TurnOn(outletIndex int) error

TurnOn powers on the outlet with the index outletIndex

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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