dsmr

package module
v0.0.0-...-e15b2d1 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2023 License: MIT Imports: 4 Imported by: 3

README

Go DSMR

GoDoc GitHub - License GitHub Workflow Status GitHub contributors
go-dsmr is a Go library for reading Dutch Smart Meter Requirements (DSMR).
Explore the docs »
Report Bug · Request Feature

Introduction

Go library for reading Dutch Smart Meter Requirements (DSMR). This is a pure Golang implementation based on the DSMR.

Usage

Installation

go get github.com/roaldnefs/go-dsmr

Importing

import "github.com/roaldnefs/go-dsmr"

Examples

// ...

Resources

Authors

go-dsmr is heavily based on GotSmart with the modified work by Roald Nefs. GotSmart is created by Bas van der Lei.

Documentation

Index

Constants

View Source
const DateTimeFormat = "060102150405"

DateTimeFormat used in a telegram in the YYMMDDhhmmssX format. The ASCII presentation of timestamp with Year, Month, Day, Hour, Minute, Second, and an indication whether DST is active (X=S) or DST is not active (X=W).

Variables

This section is empty.

Functions

This section is empty.

Types

type DataObject

type DataObject struct {
	OBIS      string // OBIS reduced ID-code
	Timestamp string
	Value     string
	Unit      string
}

DataObject represent data object and it's reference to the OBIS as defined in EN-EN-IEC 62056-61:2002 Electricity metering – Data exchange for meter reading, tariff and load control – Part 61: OBIS Object Identification System.

func ParseDataObject

func ParseDataObject(do string) (DataObject, error)

ParseDataObject will parse a single line into a DataObject.

type Telegram

type Telegram struct {
	Header   string
	Version  string    // Version information for P1 output.
	DateTime time.Time // Date-time stamp of the P1 message.

	DataObjects map[string]DataObject
}

Telegram represent a single DSMR P1 message.

func ParseTelegram

func ParseTelegram(telegram string) (t Telegram, err error)

ParseTelegram will parse the DSMR telegram.

func (Telegram) ActualElectricityPowerDelivered

func (t Telegram) ActualElectricityPowerDelivered() (string, bool)

ActualElectricityPowerDelivered returns the actual electricity power delivered (+P) in 1 Watt resolution.

func (Telegram) ActualElectricityPowerReceived

func (t Telegram) ActualElectricityPowerReceived() (string, bool)

ActualElectricityPowerReceived returns the actual electricity power received (-P) in 1 Watt resolution.

func (Telegram) InstantaneousCurrentL1

func (t Telegram) InstantaneousCurrentL1() (string, bool)

InstantaneousCurrentL1 returns the instantaneous current L1 in A resolution.

func (Telegram) InstantaneousCurrentL2

func (t Telegram) InstantaneousCurrentL2() (string, bool)

InstantaneousCurrentL2 returns the instantaneous current L2 in A resolution.

func (Telegram) InstantaneousCurrentL3

func (t Telegram) InstantaneousCurrentL3() (string, bool)

InstantaneousCurrentL3 returns the instantaneous current L3 in A resolution.

func (Telegram) InstantaneousVoltageL1

func (t Telegram) InstantaneousVoltageL1() (string, bool)

InstantaneousVoltageL1 returns the instantaneous voltage L1 in V resolution.

func (Telegram) InstantaneousVoltageL2

func (t Telegram) InstantaneousVoltageL2() (string, bool)

InstantaneousVoltageL2 returns the instantaneous voltage L3 in V resolution.

func (Telegram) InstantaneousVoltageL3

func (t Telegram) InstantaneousVoltageL3() (string, bool)

InstantaneousVoltageL3 returns the instantaneous voltage L3 in V resolution.

func (Telegram) MeterReadingElectricityDeliveredByClientTariff1

func (t Telegram) MeterReadingElectricityDeliveredByClientTariff1() (string, bool)

MeterReadingElectricityDeliveredByClientTariff1 returns the meter reading electricity delivered by client (Tariff 1) in 0,001 kWh.

func (Telegram) MeterReadingElectricityDeliveredByClientTariff2

func (t Telegram) MeterReadingElectricityDeliveredByClientTariff2() (string, bool)

MeterReadingElectricityDeliveredByClientTariff2 returns the meter reading electricity delivered by client (Tariff 2) in 0,001 kWh.

func (Telegram) MeterReadingElectricityDeliveredToClientTariff1

func (t Telegram) MeterReadingElectricityDeliveredToClientTariff1() (string, bool)

MeterReadingElectricityDeliveredToClientTariff1 returns the meter reading electricity delivered to client (Tariff 1) in 0,001 kWh.

func (Telegram) MeterReadingElectricityDeliveredToClientTariff2

func (t Telegram) MeterReadingElectricityDeliveredToClientTariff2() (string, bool)

MeterReadingElectricityDeliveredToClientTariff2 returns the meter reading electricity delivered to client (Tariff 2) in 0,001 kWh.

func (Telegram) MeterReadingGasDeliveredToClient

func (t Telegram) MeterReadingGasDeliveredToClient(channel int) (string, bool)

MeterReadingGasDeliveredToClient returns the meter reading gas delivered to client in m3 with a mm3 resolution for the gas meter that is installed on the given channel.

func (Telegram) NumberOfLongPowerFailuresInAnyPhase

func (t Telegram) NumberOfLongPowerFailuresInAnyPhase() (string, bool)

NumberOfLongPowerFailuresInAnyPhase returns the number of power failures in any phase.

func (Telegram) NumberOfPowerFailuresInAnyPhase

func (t Telegram) NumberOfPowerFailuresInAnyPhase() (string, bool)

NumberOfPowerFailuresInAnyPhase returns the number of power failures in any phase.

func (Telegram) NumberOfVoltageSagsInPhaseL1

func (t Telegram) NumberOfVoltageSagsInPhaseL1() (string, bool)

NumberOfVoltageSagsInPhaseL1 returns the number of voltage sags in phase L1.

func (Telegram) NumberOfVoltageSagsInPhaseL2

func (t Telegram) NumberOfVoltageSagsInPhaseL2() (string, bool)

NumberOfVoltageSagsInPhaseL2 returns the number of voltage sags in phase L2.

func (Telegram) NumberOfVoltageSagsInPhaseL3

func (t Telegram) NumberOfVoltageSagsInPhaseL3() (string, bool)

NumberOfVoltageSagsInPhaseL3 returns the number of voltage sags in phase L3.

func (Telegram) NumberOfVoltageSwellsInPhaseL1

func (t Telegram) NumberOfVoltageSwellsInPhaseL1() (string, bool)

NumberOfVoltageSwellsInPhaseL1 returns the number of voltage swells in phase L1.

func (Telegram) NumberOfVoltageSwellsInPhaseL2

func (t Telegram) NumberOfVoltageSwellsInPhaseL2() (string, bool)

NumberOfVoltageSwellsInPhaseL2 returns the number of voltage swells in phase L2.

func (Telegram) NumberOfVoltageSwellsInPhaseL3

func (t Telegram) NumberOfVoltageSwellsInPhaseL3() (string, bool)

NumberOfVoltageSwellsInPhaseL3 returns the number of voltage swells in phase L3.

func (Telegram) PowerFailureEventLog

func (t Telegram) PowerFailureEventLog() (string, bool)

TODO update regex so it will match:

None: 1-0:99.97.0()
Two: 1-0:99.97.0(2)(0-0:96.7.19)(101208152415W)(0000000240*s)(101208151004W)(0000000301*s)

PowerFailureEventLog returns the power failure event log (long power failures).

func (Telegram) TariffIndicatorElectricity

func (t Telegram) TariffIndicatorElectricity() (string, bool)

TariffIndicatorElectricity returns the tariff indicator that can be used to switch tariff dependent loads e.g. boilers.

func (Telegram) TextMessage

func (t Telegram) TextMessage() (string, bool)

TextMessage returns text message of max 1024 characters.

Jump to

Keyboard shortcuts

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