teleinfo

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Frame

type Frame struct {
	Time time.Time `gorm:"time"`
	// TotalActiveEnergy in watt per hour
	TotalActiveEnergy int `gorm:"total_active_energy"`
	// InstantApparentPower in VA
	InstantApparentPower int `gorm:"instant_apparent_power"`
	// InstantApparentInjectedPower in VA
	InstantApparentInjectedPower int `gorm:"instant_apparent_injected_power"`
}

func (Frame) TableName

func (f Frame) TableName() string

type RawFrame

type RawFrame struct {
	TotalActiveEnergy            string `json:"EAST"`
	InstantApparentPower         string `json:"SINSTS"`
	InstantApparentInjectedPower string `json:"SINSTI"`
}

func (*RawFrame) SetDefaults

func (r *RawFrame) SetDefaults()

func (*RawFrame) ToFrame

func (r *RawFrame) ToFrame() (*Frame, error)

type Service

type Service struct {
	// contains filtered or unexported fields
}

func NewService

func NewService(log logr.Logger, store *Store) *Service

func (*Service) Create

func (s *Service) Create(ctx context.Context, f *RawFrame) error

type Store

type Store struct {
	// contains filtered or unexported fields
}

func NewStore

func NewStore(log logr.Logger, db *gorm.DB) (*Store, error)

func (*Store) Create

func (s *Store) Create(ctx context.Context, frame *Frame) error

Jump to

Keyboard shortcuts

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