api

package
v1.4.2 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package api makes calls to the SunSynk API to read inverter statistics and to update settings.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BatteryDischargeThreshold

func BatteryDischargeThreshold(ctx context.Context) (int, error)

BatteryDischargeThreshold returns the percentage SoC of the battery at which the inverter will use the grid rather than the battery to power the loads.

func EssentialOnly

func EssentialOnly(ctx context.Context) bool

EssentialOnly returns true if the inverter should power only the essential circuits and returns false if the inverter should power all loads.

func InverterRatedPower

func InverterRatedPower(ctx context.Context) (int, error)

InverterRatedPower returns the rated power of the inverter.

func LowBatteryCapacity added in v0.2.0

func LowBatteryCapacity(ctx context.Context) (int, error)

LowBatteryCapacity returns the SoC that generates a low battery capacity alarm.

func Poll

func Poll(ctx context.Context, configFile string, ch chan State)

Poll polls the SunSynk API and sends changes to the channel passed as an argument.

func ReadState

func ReadState(ctx context.Context, s *State) (bool, error)

ReadState reads the current state of the inverter. The state must be passed as a pointer; the reference state will be updated if the SunSynk API returns fresh data. This function returns false if the state is unchanged.

func UpdateBatteryCapacity

func UpdateBatteryCapacity(cap int) error

UpdateBatteryCapacity sets the battery's depth of discharge before the inverter will switch to grid power.

func UpdateEssentialOnly

func UpdateEssentialOnly(eo bool) error

UpdateEssentialOnly sets whether the inverter should power all circuits (true) or should power all loads (false).

Types

type State

type State struct {
	Power int
	Soc   int
	Load  int
	Time  string
}

State represents the state of the inverter: input power, battery SoC, load power and the time at which the measurements were taken.

func (State) String

func (s State) String() string

Jump to

Keyboard shortcuts

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