Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Dynamic exporters for smartpireadout
(13.05.2017, 20:29)TriCX Wrote: The definition of a struct and returning a map of it goes inline with my idea.
Nevertheless, I would define it more generic.
Let's assume ade7878 is just one of a bunch of inputs,
or we have some readings with different measurement intervals.
For example accumulated watt hours do not need to be recorded every 5 secs.

My proposal is to define a totally generic "measurand".
First shot:
type Measurand struct {
   value float64
   unit string // or are there real units somewhere in go?
   timestamp Time
   name String // used to identify the value and meaning
   properties Type to be defined (maybe it is useful to provide information about time series or accumulated data, don't know)
   sensorID String or int // to identify the sensor (e.g. phase number, or temperature sensor living room, etc.)

ade7878.go might return a slice of measureands to handle a dynamic number.
readout.go could handle multiple inputs (such as ade7878) via this generic interface.
readout.go interates through the received slices and identifies the read values via their name and sensorID.

My Raspberry Pi does not only host the SmartPi unit. It is also connected to an Arduino.
The Arduino counts S0 pulses from a watt meter, see
(In need to update the readme.)

I think my setup is typical for other customers.
Therefore, why not handle multiple sensors via this go project?
I'm not sure whether enerserve is open for additional sensor data,
but I will compare my energy consumption measured via pulse counting with data from ade7878.

This is somewhat similar to how the Prometheus library works.  We already have most of the fields for your struct as part of our library[0].  I've already started to decouple things from the ReadoutValues() function.  In theory we could add additional functionality without it.

The only big issue with the Prometheus library is that we don't offer Get() functions for other parts of the program to pull the status of the registered metrics.  If we had this, we could simply send all of the readings to that library.

There are some other pre-built metrics libraries out there that do pretty much what you want.  I'll talk to of my more experienced Go developer friends to see what would make this easier.


Messages In This Thread
RE: Dynamic exporters for smartpireadout - by SuperQ - 14.05.2017, 15:09

Forum Jump:

Users browsing this thread: 1 Guest(s)