pingvin

package
v0.0.27 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Pingvin

type Pingvin struct {
	Coils     []pingvinCoil
	Registers []pingvinRegister
	Status    pingvinStatus

	Debug PingvinLogger
	// contains filtered or unexported fields
}

unit modbus data

func New

func New(serial string, debug bool) *Pingvin

create a Pingvin struct, read coils and registers from CSVs

func (*Pingvin) Collect

func (p *Pingvin) Collect(ch chan<- prometheus.Metric)

Implements prometheus.Collect()

func (*Pingvin) Describe

func (p *Pingvin) Describe(ch chan<- *prometheus.Desc)

Implements prometheus.Describe()

func (*Pingvin) Monitor

func (p *Pingvin) Monitor(interval int)

func (*Pingvin) Quit

func (p *Pingvin) Quit()

func (*Pingvin) ReadCoil

func (p *Pingvin) ReadCoil(n uint16) ([]byte, error)

Read single coil

func (*Pingvin) ReadRegister

func (p *Pingvin) ReadRegister(addr uint16) (int, error)

Read a single holding register, stores value in p.Registers Returns integer value of register

func (*Pingvin) Temperature

func (p *Pingvin) Temperature(action string) error

Change temperature setpoint (register 135) action can be up, down or a value. If value, the value can be the raw register value (200-300), a decimal degree value (20.0 - 23.0), or full degrees (20-30) Temperature must be between 20 and 30 deg Celsius, otherwise returns an error

func (*Pingvin) Update

func (p *Pingvin) Update()

Wrapper function for updating coils, registers and populating p.Status for Home Assistant

func (*Pingvin) WriteCoil

func (p *Pingvin) WriteCoil(n uint16, val bool) bool

Force a single coil

func (*Pingvin) WriteCoils

func (p *Pingvin) WriteCoils(startaddr uint16, quantity uint16, vals []bool) error

Force multiple coils

func (*Pingvin) WriteRegister

func (p *Pingvin) WriteRegister(addr uint16, value uint16) (uint16, error)

Update a single holding register

type PingvinLogger

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

func (*PingvinLogger) Println

func (logger *PingvinLogger) Println(msg ...any)

Jump to

Keyboard shortcuts

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