Documentation ¶
Index ¶
Constants ¶
View Source
const NotifyStatus = "NotifyStatus"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Counters ¶
type Counters struct { Time time.Time Device string PhaseA EnergyCounters PhaseB EnergyCounters PhaseC EnergyCounters Total EnergyCounters }
type DevicePayload ¶
type DevicePayload struct { Source string `json:"src"` Destination string `json:"dst"` Method string `json:"method"` Params json.RawMessage `json:"params"` }
type EnergyCounters ¶
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
func NewHandler ¶
func NewHandler(repo Repository) *Handler
func (*Handler) HandleMessage ¶
type Measurement ¶
type Measurement struct { Time time.Time Device string PhaseA PhaseMeasurement PhaseB PhaseMeasurement PhaseC PhaseMeasurement TotalActualPower float64 TotalApparentPower float64 TotalCurrent float64 }
type NotifyStatusEMData0 ¶
type NotifyStatusEMData0 struct { ID int32 `json:"id,omitempty"` ATotalActualEnergy float64 `json:"a_total_act_energy,omitempty"` ATotalActualReturnedEnergy float64 `json:"a_total_act_ret_energy,omitempty"` BTotalActualEnergy float64 `json:"b_total_act_energy,omitempty"` BTotalActualReturnedEnergy float64 `json:"b_total_act_ret_energy,omitempty"` CTotalActualEnergy float64 `json:"c_total_act_energy,omitempty"` CTotalActualReturnedEnergy float64 `json:"c_total_act_ret_energy,omitempty"` TotalActual float64 `json:"total_act,omitempty"` TotalActualReturned float64 `json:"total_act_ret,omitempty"` }
type NotifyStatusEm0 ¶
type NotifyStatusEm0 struct { ID int32 `json:"id,omitempty"` AActualPower float64 `json:"a_act_power,omitempty"` AApparentPower float64 `json:"a_aprt_power,omitempty"` ACurrent float64 `json:"a_current,omitempty"` AFrequency float64 `json:"a_freq,omitempty"` APowerFactor float64 `json:"a_pf,omitempty"` AVoltage float64 `json:"a_voltage,omitempty"` BActualPower float64 `json:"b_act_power,omitempty"` BApparentPower float64 `json:"b_aprt_power,omitempty"` BCurrent float64 `json:"b_current,omitempty"` BFrequency float64 `json:"b_freq,omitempty"` BPowerFactor float64 `json:"b_pf,omitempty"` BVoltage float64 `json:"b_voltage,omitempty"` CActualPower float64 `json:"c_act_power,omitempty"` CApparentPower float64 `json:"c_aprt_power,omitempty"` CCurrent float64 `json:"c_current,omitempty"` CFrequency float64 `json:"c_freq,omitempty"` CPowerFactor float64 `json:"c_pf,omitempty"` CVoltage float64 `json:"c_voltage,omitempty"` // nil if there is no N clamp NCurrent *float64 `json:"n_current,omitempty"` TotalActualPower float64 `json:"total_act_power,omitempty"` TotalApparentPower float64 `json:"total_aprt_power,omitempty"` TotalCurrent float64 `json:"total_current,omitempty"` }
type NotifyStatusMessage ¶
type NotifyStatusMessage struct { Timestamp UnixTimestamp `json:"ts"` EM0 *NotifyStatusEm0 `json:"em:0"` EMData0 *NotifyStatusEMData0 `json:"emdata:0"` }
type PhaseMeasurement ¶
type Repository ¶
type TimescaleRepository ¶
type TimescaleRepository struct {
// contains filtered or unexported fields
}
func NewTimescaleRepository ¶
func NewTimescaleRepository(db *sql.DB) *TimescaleRepository
func (*TimescaleRepository) InsertCounters ¶
func (t *TimescaleRepository) InsertCounters(ctx context.Context, counters Counters) error
func (*TimescaleRepository) InsertMeasurements ¶
func (t *TimescaleRepository) InsertMeasurements(ctx context.Context, measurement Measurement) error
type UnixTimestamp ¶
func (*UnixTimestamp) UnmarshalJSON ¶
func (ts *UnixTimestamp) UnmarshalJSON(msg []byte) error
Click to show internal directories.
Click to hide internal directories.