Help us shape the future of Go! Take the 2026 Go Developer Survey

amrreader

package module
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Header(hostname string) callx.Header

Types

type Account

type Account struct {
	Header       callx.Header
	MeterNo      string
	MeterPoint   string
	CustomerId   string
	CustomerCode string
}

type AmrX

type AmrX interface {
	Auth(config Credential) (*Session, error)
	GetAccount(session Session) (*Account, error)
	GetProfileDaily(acc Account, date string) (*ProfileMeter, error)
	PasswordRotation(config PasswordRotationCredential, header *callx.Header) (*Session, error)
	Logout() error
}

func New

func New(config Config, callX callx.CallX) AmrX

type Config

type Config struct {
	BaseURL string
	Logger  bool
}

func (Config) Hostname

func (c Config) Hostname() string

type Credential

type Credential struct {
	Username string
	Password string
}

func (*Credential) Checksum

func (c *Credential) Checksum() string

type Logger

type Logger struct {
	Enabled bool
}

func (Logger) Error

func (l Logger) Error(msg string, args ...any)

func (Logger) Fatal

func (l Logger) Fatal(v ...any)

func (Logger) Info

func (l Logger) Info(msg string, args ...any)

func (Logger) Warn

func (l Logger) Warn(msg string, args ...any)

Warn logs even when the reader's logging is disabled.

Info and Error are request tracing a caller can reasonably switch off. Warn is reserved for data the reader throws away, which has to reach someone or it is never found — callers run this library with Logger disabled, and that is exactly how a dropped quarter-hour row per day stayed invisible.

type PasswordRotationCredential

type PasswordRotationCredential struct {
	Username    string
	OldPassword string
	NewPassword string
}

type Profile

type Profile struct {
	Time              *time.Time `json:"time"`
	EnergyConsumption *float64   `json:"energyConsumption"`
}

type ProfileMeter

type ProfileMeter struct {
	CustomerId   string    `json:"customerId"`
	CustomerCode string    `json:"customerCode"`
	MeterNo      string    `json:"meterNo"`
	MeterPoint   string    `json:"meterPoint"`
	Profile      []Profile `json:"profile"`
}

type Session

type Session struct {
	Header   callx.Header
	Username string
}

Jump to

Keyboard shortcuts

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