lgpcs

package
v0.0.0-...-1470ac1 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package lgpcs implements access to the LG pcs device (aka inverter). Pcs is the LG power conditioning system that converts the PV (or battery) - DC current into AC current (and controls the batteries)

Index

Constants

View Source
const (
	LoginURI     = "/v1/login"
	UserLoginURI = "/v1/user/setting/login"
	MeterURI     = "/v1/user/essinfo/home"
)

URIs

View Source
const (
	LgEss8  = 0 // lgess 8/10
	LgEss15 = 1 // lgess 15
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Com

type Com struct {
	*request.Helper
	// contains filtered or unexported fields
}

func GetInstance

func GetInstance(uri, registration, password string, cache time.Duration, essType Model) (*Com, error)

GetInstance implements the singleton pattern to handle the access via the authkey to the PCS of the LG ESS HOME system

func (*Com) Data

func (m *Com) Data() (EssData, error)

Data gives the cached data read from the pcs.

func (*Com) Login

func (m *Com) Login() error

Login calls login and stores the returned authorization key

type EssData

type EssData interface {
	GetGridPower() float64               // in [W]
	GetPvTotalPower() float64            // in [W]
	GetBatConvPower() float64            // in [W]
	GetBatUserSoc() float64              // in [%]
	GetCurrentGridFeedInEnergy() float64 // in [Wh]
	GetCurrentPvGenerationSum() float64  // in [Wh]
}

data in the format expected by the accessing (lgess) module

type EssData15

type EssData15 struct {
	GridPower    int `json:"grid_power_01kW"`
	PvTotalPower int `json:"pv_total_power_01kW"`
	BatConvPower int `json:"batt_conv_power_01kW"`
	BatUserSoc   int `json:"bat_user_soc"`
}

power values are in 100W units

type EssData8

type EssData8 struct {
	GridPower               float64 `json:"grid_power,string"`
	PvTotalPower            float64 `json:"pcs_pv_total_power,string"`
	BatConvPower            float64 `json:"batconv_power,string"`
	BatUserSoc              float64 `json:"bat_user_soc,string"`
	CurrentGridFeedInEnergy float64 `json:"current_grid_feed_in_energy,string"`
	CurrentPvGenerationSum  float64 `json:"current_pv_generation_sum,string"`
}

type MeterResponse15

type MeterResponse15 struct {
	Statistics EssData15
	Direction  struct {
		IsGridSelling        int `json:"is_grid_selling_"`
		IsBatteryDischarging int `json:"is_battery_discharging_"`
	}
}

func (MeterResponse15) GetBatConvPower

func (m MeterResponse15) GetBatConvPower() float64

func (MeterResponse15) GetBatUserSoc

func (m MeterResponse15) GetBatUserSoc() float64

func (MeterResponse15) GetCurrentGridFeedInEnergy

func (m MeterResponse15) GetCurrentGridFeedInEnergy() float64

func (MeterResponse15) GetCurrentPvGenerationSum

func (m MeterResponse15) GetCurrentPvGenerationSum() float64

func (MeterResponse15) GetGridPower

func (m MeterResponse15) GetGridPower() float64

func (MeterResponse15) GetPvTotalPower

func (m MeterResponse15) GetPvTotalPower() float64

type MeterResponse8

type MeterResponse8 struct {
	Statistics EssData8
	Direction  struct {
		IsGridSelling        int `json:"is_grid_selling_,string"`
		IsBatteryDischarging int `json:"is_battery_discharging_,string"`
	}
}

func (MeterResponse8) GetBatConvPower

func (m MeterResponse8) GetBatConvPower() float64

func (MeterResponse8) GetBatUserSoc

func (m MeterResponse8) GetBatUserSoc() float64

func (MeterResponse8) GetCurrentGridFeedInEnergy

func (m MeterResponse8) GetCurrentGridFeedInEnergy() float64

func (MeterResponse8) GetCurrentPvGenerationSum

func (m MeterResponse8) GetCurrentPvGenerationSum() float64

func (MeterResponse8) GetGridPower

func (m MeterResponse8) GetGridPower() float64

func (MeterResponse8) GetPvTotalPower

func (m MeterResponse8) GetPvTotalPower() float64

type Model

type Model int

Models

Jump to

Keyboard shortcuts

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