inverterlogger

package module
v0.0.0-...-53940a7 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2023 License: MIT Imports: 4 Imported by: 1 module, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

inverterlogger

A small library that encodes and decodes data from Solarman data loggers. It works with wifi kits with a s/n starting with 17xxxxxxxx.

Please be careful with changing constants, as you can accidentialy send different command. So instead of fetching real-time data, you could change some setting of an inverter (this can be really dangerous).

Refer to the example to see how it can be used.

Hope this helps you to understand how the protocol works.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Frame

type Frame struct {
	PayloadLength uint16
	ControlCode   uint16
	SerialNumber  uint16
	DeviceSN      uint32
	Payload       []byte
}

func NewFrame

func NewFrame(deviceSN uint32, payload []byte) *Frame

func (*Frame) MarshalBinary

func (f *Frame) MarshalBinary() ([]byte, error)

func (*Frame) UnmarshalBinary

func (f *Frame) UnmarshalBinary(data []byte) error

type RequestPayload

type RequestPayload struct {
	FrameType    uint8
	SensorType   uint16
	DeliveryTime uint32
	PowerOnTime  uint32
	OffsetTime   uint32

	DeviceAddress uint8
	FunctionCode  uint8
	StartReg      uint16
	RegCount      uint16
}

func NewRequestPayload

func NewRequestPayload(startReg, regCount uint16) *RequestPayload

func (*RequestPayload) MarshalBinary

func (r *RequestPayload) MarshalBinary() ([]byte, error)

type ResponsePayload

type ResponsePayload struct {
	FrameType    uint8
	StatusCode   uint8
	DeliveryTime uint32
	PowerOnTime  uint32
	OffsetTime   uint32

	DeviceAddress uint8
	FunctionCode  uint8
	ValueLength   uint8
	Value         []byte
}

func (*ResponsePayload) UnmarshalBinary

func (r *ResponsePayload) UnmarshalBinary(data []byte) error

Directories

Path Synopsis
example module

Jump to

Keyboard shortcuts

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