solarman

package
v1.1.10 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Debug bool
	// contains filtered or unexported fields
}

Client communicates with an inverter through a Solarman V5 wifi dongle.

func NewClient

func NewClient(host string, port int, serial uint32, slaveID byte) *Client

NewClient creates a new Solarman V5 client.

func (*Client) Close

func (c *Client) Close() error

Close closes the TCP connection.

func (*Client) Connect

func (c *Client) Connect() error

Connect opens a TCP connection to the dongle.

func (*Client) ProbeSlaveID

func (c *Client) ProbeSlaveID(maxID byte) (byte, error)

ProbeSlaveID discovers the correct slave ID for the device behind this dongle. It tries the currently configured slave ID first, then scans IDs 1 through maxID. A shorter timeout is used for probing. On success, the client's slave ID is set to the discovered ID and returned.

func (*Client) ReadRegisters

func (c *Client) ReadRegisters(startAddr uint16, count uint16) ([]uint16, error)

ReadRegisters reads holding registers from the inverter.

func (*Client) ScanFrames

func (c *Client) ScanFrames(callback func(modbusFrame []byte) bool) error

ScanFrames reads V5 frames from the dongle stream and calls the callback for each valid MODBUS frame found. Returns when callback returns false or on error.

func (*Client) WriteMultipleRegisters

func (c *Client) WriteMultipleRegisters(startAddr uint16, values []uint16) error

WriteMultipleRegisters writes multiple contiguous registers.

func (*Client) WriteSingleRegister

func (c *Client) WriteSingleRegister(addr uint16, value uint16) error

WriteSingleRegister writes a single register on the inverter.

Jump to

Keyboard shortcuts

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