apc

package
v0.0.0-...-efe4ef5 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2023 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Overview

Package apc provides utilities for communicating with APC Smart-UPS battery backups

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Status

type Status struct {
	// ReplaceBattery indicates the battery is spent if true
	ReplaceBattery bool `json:"replaceBattery"`

	// LowBattery indicates the battery will run out soon
	LowBattery bool `json:"lowBattery"`

	// Overloaded indicates the battery backup is subject to excess load
	Overloaded bool `json:"overloaded"`

	// OnBattery indicates that the mains connection is disrupted
	OnBattery bool `json:"onBattery"`

	// OnMains indicates the system is on mains power
	OnMains bool `json:"onMains"`

	// SmartBoost indicates APC's "SmartBoost" mode is engaged
	SmartBoost bool `json:"smartBoost"`

	// SmartTrim indicates APC's "SmartTrim" is engaged
	SmartTrim bool `json:"smartTrim"`

	// RunTimeCalibrating indicates the remaining operation time on battery is currently beign calibrated
	RunTimeCalibrating bool `json:"runtimeCalibrating"`
}

Status is a decoded version of the UPS' status bitfield

type UPS

type UPS struct {
	*comm.RemoteDevice
}

UPS represents an uninterruptible power supply

func NewUPS

func NewUPS(addr string, serial bool) *UPS

NewUPS makes a new UPS instance

func (*UPS) Runtime

func (u *UPS) Runtime() (time.Duration, error)

Runtime returns how long the UPS can operate on the current supply

func (*UPS) SelfTest

func (u *UPS) SelfTest() (bool, error)

SelfTest triggers disconnect of mains. Returns true if the test executed

func (*UPS) Status

func (u *UPS) Status() (Status, error)

Status returns the status bitfield of the UPS

func (*UPS) Temperature

func (u *UPS) Temperature() (float64, error)

Temperature is the internal temperature of the battery backup

Jump to

Keyboard shortcuts

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