Documentation ¶
Index ¶
- Constants
- Variables
- type AlarmMode
- type AlarmModeType
- type Cable
- type CableType
- type Driver
- type DriverType
- type Event
- type EventType
- type Mode
- type ModeType
- type Model
- type SelftestResult
- type SelftestResultType
- type Sensivity
- type SensivityType
- type Signal
- type State
- type Status
- type TransferOnbatteryReason
- type TransferOnbatteryReasonType
Constants ¶
View Source
const ( EventTypeSignal = EventType("signal") EventTypeCommlost = EventType("commlost") EventTypeCommlostEnd = EventType("commlost_end") EventTypeOnbatt = EventType("onbatt") EventTypeOnbattEnd = EventType("onbatt_end") EventTypeOffline = EventType("offline") EventTypeOnline = EventType("online") EventTypeLineOk = EventType("line_ok") EventTypeTrim = EventType("trim") EventTypeBoost = EventType("boost") EventTypeOverload = EventType("overload") EventTypeOverloadEnd = EventType("overload_end") EventTypeNobatt = EventType("nobatt") EventTypeNobattEnd = EventType("nobatt_end") EventTypeTurnedOn = EventType("turned_on") EventTypeTurnedOff = EventType("turned_off") )
Event types
View Source
const ( SignalCommfailure = Signal("commfailure") SignalCommok = Signal("commok") SignalStartselftest = Signal("startselftest") SignalEndselftest = Signal("endselftest") SignalPowerout = Signal("powerout") SignalMainsback = Signal("mainsback") SignalOnbattery = Signal("onbattery") SignalOffbattery = Signal("offbattery") SignalBattattach = Signal("battattach") SignalChangeme = Signal("changeme") SignalFailing = Signal("failing") SignalTimeout = Signal("timeout") SignalLoadlimit = Signal("loadlimit") SignalDoshutdown = Signal("doshutdown") SignalAnnoyme = Signal("annoyme") SignalRemotedown = Signal("remotedown") )
Signals
Variables ¶
View Source
var AlarmModeTypes = map[string]interface{}{ "No alarm": AlarmModeType(1), "Always": AlarmModeType(2), "5 Seconds": AlarmModeType(3), "30 Seconds": AlarmModeType(4), "Low Battery": AlarmModeType(5), }
AlarmModeTypes type enum
View Source
var CableTypes = map[string]interface{}{ "Custom Cable Simple": CableType(1), "APC Cable 940-0119A": CableType(2), "APC Cable 940-0127A": CableType(3), "APC Cable 940-0128A": CableType(4), "APC Cable 940-0020B": CableType(5), "APC Cable 940-0020C": CableType(6), "APC Cable 940-0023A": CableType(7), "MAM Cable 04-02-2000": CableType(8), "APC Cable 940-0095A": CableType(9), "APC Cable 940-0095B": CableType(10), "APC Cable 940-0095C": CableType(11), "Custom Cable Smart": CableType(12), "APC Cable 940-0024B": CableType(121), "APC Cable 940-0024C": CableType(122), "APC Cable 940-1524C": CableType(123), "APC Cable 940-0024G": CableType(124), "APC Cable 940-0625A": CableType(125), "Ethernet Link": CableType(13), "USB Cable": CableType(14), }
CableTypes type enum
View Source
var DriverTypes = map[string]interface{}{ "DUMB UPS Driver": DriverType(1), "APC Smart UPS (any)": DriverType(2), "USB UPS Driver": DriverType(3), "NETWORK UPS Driver": DriverType(4), "TEST UPS Driver": DriverType(5), "PCNET UPS Driver": DriverType(6), "SNMP UPS Driver": DriverType(7), "MODBUS UPS Driver": DriverType(8), }
DriverTypes type enum
View Source
var ModeTypes = map[string]interface{}{ "Stand Alone": ModeType(1), "ShareUPS Slave": ModeType(2), "ShareUPS Master": ModeType(3), }
ModeTypes type enum
View Source
var SelftestResultTypes = map[string]interface{}{ "NO": SelftestResultType(1), "OK": SelftestResultType(2), "BT": SelftestResultType(3), "NG": SelftestResultType(4), "IP": SelftestResultType(5), "WN": SelftestResultType(6), "??": SelftestResultType(7), }
SelftestResultTypes type enum
View Source
var SensivityTypes = map[string]interface{}{ "Low": SensivityType(1), "Medium": SensivityType(2), "High": SensivityType(3), "Auto Adjust": SensivityType(4), "Unknown": SensivityType(5), }
SensivityTypes type enum
View Source
var StatusFlags = map[string]uint64{
"calibration": 0x00000001,
"trim": 0x00000002,
"boost": 0x00000004,
"online": 0x00000008,
"onbatt": 0x00000010,
"overload": 0x00000020,
"battlow": 0x00000040,
"replacebatt": 0x00000080,
"commlost": 0x00000100,
"shutdown": 0x00000200,
"slave": 0x00000400,
"slavedown": 0x00000800,
"onbatt_msg": 0x00020000,
"fastpoll": 0x00040000,
"shut_load": 0x00080000,
"shut_btime": 0x00100000,
"shut_ltime": 0x00200000,
"shut_emerg": 0x00400000,
"shut_remote": 0x00800000,
"plugged": 0x01000000,
"battpresent": 0x04000000,
}
StatusFlags ..
View Source
var TransferOnbatteryReasonTypes = map[string]interface{}{ "No transfers since turnon": TransferOnbatteryReasonType(1), "Automatic or explicit self test": TransferOnbatteryReasonType(2), "Forced by software": TransferOnbatteryReasonType(3), "Low line voltage": TransferOnbatteryReasonType(4), "High line voltage": TransferOnbatteryReasonType(5), "Unacceptable line voltage changes": TransferOnbatteryReasonType(6), "Line voltage notch or spike": TransferOnbatteryReasonType(7), "Input frequency out of range": TransferOnbatteryReasonType(8), "UNKNOWN EVENT": TransferOnbatteryReasonType(9), }
TransferOnbatteryReasonTypes enum
Functions ¶
This section is empty.
Types ¶
type Model ¶
type Model struct { State State PrevState State NewEvents []Event EventLimit int ChangedFields map[string][]interface{} // contains filtered or unexported fields }
Model data
type SelftestResult ¶
type SelftestResult struct { Type SelftestResultType Text string }
SelftestResult ..
type State ¶
type State struct { // input InputSensivity Sensivity InputFrequency float64 InputVoltage float64 InputVoltageMin float64 InputVoltageMax float64 InputVoltageNominal float64 InputVoltageTransferLow float64 InputVoltageTransferHigh float64 // output OutputLoad float64 OutputAmps float64 OutputPowerNominal float64 OutputPowerApparentNominal float64 OutputVoltage float64 OutputVoltageNominal float64 // battery BatteryCharge float64 BatteryVoltage float64 BatteryVoltageNominal float64 BatteryExternalCount uint16 BatteryBadCount uint16 BatteryReplacedDate time.Time // ups UpsManafacturedDate time.Time UpsModel string UpsSerial string UpsFirmware string UpsName string UpsStatus Status UpsDipSwitchFlag uint64 UpsReg1 uint64 UpsReg2 uint64 UpsReg3 uint64 UpsTimeleftSeconds int64 UpsTimeleftSecondsLowBattery int64 UpsTransferOnBatteryCount uint64 UpsTransferOnBatteryReason TransferOnbatteryReason UpsTransferOnBatteryDate time.Time UpsTransferOffBatteryDate time.Time UpsOnBatterySeconds int64 UpsOnBatterySecondsCumulative int64 UpsTurnOffDelaySeconds int64 UpsTurnOnDelaySeconds int64 UpsTurnOnBatteryMin float64 UpsTempInternal float64 UpsTempAmbient float64 UpsHumidity float64 UpsAlarmMode AlarmMode UpsSelftestResult SelftestResult UpsSelftestIntervalSeconds int64 UpsCable Cable UpsDriver Driver UpsMode Mode // shutdown ShutdownBatteryMin float64 ShutdownTimeleftSecondsMin int64 ShutdownOnBatterySecondsMax int64 // apcupsd ApcupsdHost string ApcupsdVersion string ApcupsdStartTime time.Time }
State - parsed 'apcaccess status' result
func NewStateFromOutput ¶
NewStateFromOutput ..
func (State) GetLastUpsOnBatteryDuration ¶
GetLastUpsOnBatteryDuration - last or current (if on battery)
type TransferOnbatteryReason ¶
type TransferOnbatteryReason struct { Type TransferOnbatteryReasonType Text string }
TransferOnbatteryReason ..
type TransferOnbatteryReasonType ¶
type TransferOnbatteryReasonType uint8
TransferOnbatteryReasonType type
Click to show internal directories.
Click to hide internal directories.