Reading from a SDM120 meter using EmonHub

Yes, this is the manual which came with the unit - it’s definitely the M version.

1 Like

Ouch.
We didn’t like that…

2021-01-21 08:54:21,246 DEBUG    MainThread Signal 15 received.
2021-01-21 08:54:21,330 INFO     MainThread Exiting hub...
2021-01-21 08:54:27,389 WARNING  SDM120     Exception caught in SDM120 thread. Traceback (most recent call last):
  File "/opt/openenergymonitor/emonhub/src/emonhub_interfacer.py", line 32, in wrapper
    return func(*args)
  File "/opt/openenergymonitor/emonhub/src/emonhub_interfacer.py", line 99, in run
    rxc = self.read()
  File "/opt/openenergymonitor/emonhub/src/interfacers/EmonHubSDM120Interfacer.py", line 76, in read
    self._log.debug("%.2f %.2f %.4f %.4f %.3f %.3f" % (r['voltage'],r['power_active'],r['power_factor'],r['frequency'],r['import_energy_active'],r['current']))
KeyError: 'voltage'

2021-01-21 08:54:27,390 INFO     MainThread Exit completed
2021-01-21 08:54:29,996 INFO     MainThread EmonHub emonHub (emon-pi variant) v2.1.5
2021-01-21 08:54:29,997 INFO     MainThread Opening hub...
2021-01-21 08:54:29,998 INFO     MainThread Logging level set to DEBUG
2021-01-21 08:54:29,999 INFO     MainThread Creating EmonHubJeeInterfacer 'RFM2Pi'
2021-01-21 08:54:30,001 DEBUG    MainThread Opening serial port: /dev/ttyAMA0 @ 38400 bits/s
2021-01-21 08:54:32,008 INFO     MainThread RFM2Pi device firmware version & configuration: not available
2021-01-21 08:54:32,010 INFO     MainThread Setting RFM2Pi baseid: 5 (5i)
2021-01-21 08:54:33,012 INFO     MainThread Setting RFM2Pi frequency: 433 (4b)
2021-01-21 08:54:34,014 INFO     MainThread Setting RFM2Pi group: 210 (210g)
2021-01-21 08:54:35,016 INFO     MainThread Setting RFM2Pi quiet: 1 (1q)
2021-01-21 08:54:36,019 INFO     MainThread Setting RFM2Pi calibration: 230V (1p)
2021-01-21 08:54:37,021 DEBUG    MainThread Setting RFM2Pi pubchannels: ['ToEmonCMS']
2021-01-21 08:54:37,022 DEBUG    MainThread Setting RFM2Pi subchannels: ['ToRFM12']
2021-01-21 08:54:37,024 INFO     MainThread Creating EmonHubMqttInterfacer 'MQTT'
2021-01-21 08:54:37,029 DEBUG    MainThread Setting MQTT pubchannels: ['ToRFM12']
2021-01-21 08:54:37,030 DEBUG    MainThread Setting MQTT subchannels: ['ToEmonCMS']
2021-01-21 08:54:37,031 INFO     MainThread Setting MQTT node_format_enable: 1
2021-01-21 08:54:37,032 INFO     MainThread Setting MQTT nodevar_format_enable: 1
2021-01-21 08:54:37,032 INFO     MainThread Setting MQTT nodevar_format_basetopic: emon/
2021-01-21 08:54:37,034 INFO     MainThread Creating EmonHubEmoncmsHTTPInterfacer 'emoncmsorg'
2021-01-21 08:54:37,036 DEBUG    MainThread Setting emoncmsorg pubchannels: ['ToRFM12']
2021-01-21 08:54:37,037 DEBUG    MainThread Setting emoncmsorg subchannels: ['ToEmonCMS']
2021-01-21 08:54:37,038 WARNING  MainThread Setting emoncmsorg apikey: obscured
2021-01-21 08:54:37,038 INFO     MainThread Setting emoncmsorg url: https://emoncms.org
2021-01-21 08:54:37,039 DEBUG    RFM2Pi     device settings updated: E i5 g210 @ 433 MHz q1 USA 0
2021-01-21 08:54:37,039 INFO     MainThread Setting emoncmsorg senddata: 1
2021-01-21 08:54:37,040 INFO     MainThread Setting emoncmsorg sendstatus: 1
2021-01-21 08:54:37,042 INFO     MainThread Creating EmonHubSDM120Interfacer 'SDM120'
2021-01-21 08:54:37,052 INFO     MainThread Connecting to SDM120 device=/dev/ttyUSB0 baud=2400
2021-01-21 08:54:37,054 INFO     MainThread Setting SDM120 read_interval: 10
2021-01-21 08:54:37,055 INFO     MainThread Setting SDM120 nodename: SDM120
2021-01-21 08:54:37,055 DEBUG    MainThread Setting SDM120 pubchannels: ['ToEmonCMS']
2021-01-21 08:54:37,142 DEBUG    RFM2Pi     device settings updated: E i5 g210 @ 433 MHz q1 USA 0
2021-01-21 08:54:37,246 DEBUG    RFM2Pi     1 NEW FRAME : OK 5 116 252 234 255 94 252 104 92 0 0 0 0 0 0 0 0 0 0 0 0 221 137 0 0 (-0)
2021-01-21 08:54:37,247 DEBUG    RFM2Pi     1 Timestamp : 1611219277.245972
2021-01-21 08:54:37,247 DEBUG    RFM2Pi     1 From Node : 5
2021-01-21 08:54:37,248 DEBUG    RFM2Pi     1    Values : [-908, -22, -930, 236.56, 0, 0, 0, 0, 0, 0, 35293]
2021-01-21 08:54:37,248 DEBUG    RFM2Pi     1 Sent to channel(start)' : ToEmonCMS
2021-01-21 08:54:37,248 DEBUG    RFM2Pi     1 Sent to channel(end)' : ToEmonCMS
2021-01-21 08:54:37,335 INFO     MQTT       Connecting to MQTT Server
2021-01-21 08:54:37,350 DEBUG    RFM2Pi     device settings updated: E i5 g210 @ 433 MHz q1 USA 0
2021-01-21 08:54:37,437 INFO     MQTT       connection status: Connection successful
2021-01-21 08:54:37,438 DEBUG    MQTT       CONACK => Return code: 0
2021-01-21 08:54:37,443 DEBUG    emoncmsorg Buffer size: 1
2021-01-21 08:54:37,452 DEBUG    RFM2Pi     device settings updated: E i5 g210 @ 433 MHz q1 USA 0
2021-01-21 08:54:37,539 INFO     MQTT       on_subscribe
2021-01-21 08:54:37,554 DEBUG    RFM2Pi     device settings updated: E i5 g210 @ 433 MHz q1 USA 0
2021-01-21 08:54:38,765 DEBUG    RFM2Pi     2 NEW FRAME : OK 5 110 252 233 255 87 252 60 92 0 0 0 0 0 0 0 0 0 0 0 0 225 137 0 0 (-0)
2021-01-21 08:54:38,768 DEBUG    RFM2Pi     2 Timestamp : 1611219278.765470
2021-01-21 08:54:38,769 DEBUG    RFM2Pi     2 From Node : 5
2021-01-21 08:54:38,769 DEBUG    RFM2Pi     2    Values : [-914, -23, -937, 236.12, 0, 0, 0, 0, 0, 0, 35297]
2021-01-21 08:54:38,770 DEBUG    RFM2Pi     2 Sent to channel(start)' : ToEmonCMS
2021-01-21 08:54:38,770 DEBUG    RFM2Pi     2 Sent to channel(end)' : ToEmonCMS
2021-01-21 08:54:38,945 DEBUG    MQTT       Publishing: emon/emonpi/power1 -914
2021-01-21 08:54:38,948 DEBUG    MQTT       Publishing: emon/emonpi/power2 -23
2021-01-21 08:54:38,949 DEBUG    MQTT       Publishing: emon/emonpi/power1pluspower2 -937
2021-01-21 08:54:38,951 DEBUG    MQTT       Publishing: emon/emonpi/vrms 236.12
2021-01-21 08:54:38,952 DEBUG    MQTT       Publishing: emon/emonpi/t1 0
2021-01-21 08:54:38,954 DEBUG    MQTT       Publishing: emon/emonpi/t2 0
2021-01-21 08:54:38,956 DEBUG    MQTT       Publishing: emon/emonpi/t3 0
2021-01-21 08:54:38,959 DEBUG    MQTT       Publishing: emon/emonpi/t4 0
2021-01-21 08:54:38,961 DEBUG    MQTT       Publishing: emon/emonpi/t5 0
2021-01-21 08:54:38,962 DEBUG    MQTT       Publishing: emon/emonpi/t6 0
2021-01-21 08:54:38,964 DEBUG    MQTT       Publishing: emon/emonpi/pulsecount 35297
2021-01-21 08:54:38,965 INFO     MQTT       Publishing 'node' formatted msg
2021-01-21 08:54:38,966 DEBUG    MQTT       Publishing: emonhub/rx/5/values -914,-23,-937,236.12,0,0,0,0,0,0,35297
2021-01-21 08:54:43,810 DEBUG    RFM2Pi     4 NEW FRAME : OK 5 102 252 234 255 80 252 84 92 0 0 0 0 0 0 0 0 0 0 0 0 229 137 0 0 (-0)
2021-01-21 08:54:43,812 DEBUG    RFM2Pi     4 Timestamp : 1611219283.809912
2021-01-21 08:54:43,813 DEBUG    RFM2Pi     4 From Node : 5
2021-01-21 08:54:43,814 DEBUG    RFM2Pi     4    Values : [-922, -22, -944, 236.36, 0, 0, 0, 0, 0, 0, 35301]
2021-01-21 08:54:43,815 DEBUG    RFM2Pi     4 Sent to channel(start)' : ToEmonCMS
2021-01-21 08:54:43,815 DEBUG    RFM2Pi     4 Sent to channel(end)' : ToEmonCMS
2021-01-21 08:54:44,004 DEBUG    MQTT       Publishing: emon/emonpi/power1 -922
2021-01-21 08:54:44,006 DEBUG    MQTT       Publishing: emon/emonpi/power2 -22
2021-01-21 08:54:44,008 DEBUG    MQTT       Publishing: emon/emonpi/power1pluspower2 -944
2021-01-21 08:54:44,010 DEBUG    MQTT       Publishing: emon/emonpi/vrms 236.36
2021-01-21 08:54:44,012 DEBUG    MQTT       Publishing: emon/emonpi/t1 0
2021-01-21 08:54:44,013 DEBUG    MQTT       Publishing: emon/emonpi/t2 0
2021-01-21 08:54:44,015 DEBUG    MQTT       Publishing: emon/emonpi/t3 0
2021-01-21 08:54:44,017 DEBUG    MQTT       Publishing: emon/emonpi/t4 0
2021-01-21 08:54:44,019 DEBUG    MQTT       Publishing: emon/emonpi/t5 0
2021-01-21 08:54:44,021 DEBUG    MQTT       Publishing: emon/emonpi/t6 0
2021-01-21 08:54:44,023 DEBUG    MQTT       Publishing: emon/emonpi/pulsecount 35301
2021-01-21 08:54:44,025 INFO     MQTT       Publishing 'node' formatted msg
2021-01-21 08:54:44,025 DEBUG    MQTT       Publishing: emonhub/rx/5/values -922,-22,-944,236.36,0,0,0,0,0,0,35301
2021-01-21 08:54:47,474 WARNING  SDM120     Exception caught in SDM120 thread. Traceback (most recent call last):
  File "/opt/openenergymonitor/emonhub/src/emonhub_interfacer.py", line 32, in wrapper
    return func(*args)
  File "/opt/openenergymonitor/emonhub/src/emonhub_interfacer.py", line 99, in run
    rxc = self.read()
  File "/opt/openenergymonitor/emonhub/src/interfacers/EmonHubSDM120Interfacer.py", line 76, in read
    self._log.debug("%.2f %.2f %.4f %.4f %.3f %.3f" % (r['voltage'],r['power_active'],r['power_factor'],r['frequency'],r['import_energy_active'],r['current']))
KeyError: 'voltage'

2021-01-21 08:54:47,672 WARNING  MainThread SDM120 thread is dead.
2021-01-21 08:54:47,673 WARNING  MainThread Attempting to restart thread SDM120 (thread has been restarted 0 times...)
2021-01-21 08:54:47,674 INFO     MainThread Setting RFM2Pi calibration: 230V (1p)
2021-01-21 08:54:47,737 DEBUG    RFM2Pi     device settings updated: E i5 g210 @ 433 MHz q1 USA 0
2021-01-21 08:54:48,676 INFO     MainThread Creating EmonHubSDM120Interfacer 'SDM120'
2021-01-21 08:54:48,678 INFO     MainThread Connecting to SDM120 device=/dev/ttyUSB0 baud=2400
2021-01-21 08:54:48,679 INFO     MainThread Setting SDM120 read_interval: 10
2021-01-21 08:54:48,679 INFO     MainThread Setting SDM120 nodename: SDM120
2021-01-21 08:54:48,680 DEBUG    MainThread Setting SDM120 pubchannels: ['ToEmonCMS']
2021-01-21 08:54:48,748 DEBUG    RFM2Pi     5 NEW FRAME : OK 5 104 252 234 255 82 252 57 92 0 0 0 0 0 0 0 0 0 0 0 0 233 137 0 0 (-0)
2021-01-21 08:54:48,750 DEBUG    RFM2Pi     5 Timestamp : 1611219288.747883
2021-01-21 08:54:48,751 DEBUG    RFM2Pi     5 From Node : 5
2021-01-21 08:54:48,751 DEBUG    RFM2Pi     5    Values : [-920, -22, -942, 236.09, 0, 0, 0, 0, 0, 0, 35305]
2021-01-21 08:54:48,752 DEBUG    RFM2Pi     5 Sent to channel(start)' : ToEmonCMS
2021-01-21 08:54:48,753 DEBUG    RFM2Pi     5 Sent to channel(end)' : ToEmonCMS
2021-01-21 08:54:48,963 DEBUG    MQTT       Publishing: emon/emonpi/power1 -920
2021-01-21 08:54:48,964 DEBUG    MQTT       Publishing: emon/emonpi/power2 -22
2021-01-21 08:54:48,966 DEBUG    MQTT       Publishing: emon/emonpi/power1pluspower2 -942
2021-01-21 08:54:48,967 DEBUG    MQTT       Publishing: emon/emonpi/vrms 236.09
2021-01-21 08:54:48,968 DEBUG    MQTT       Publishing: emon/emonpi/t1 0
2021-01-21 08:54:48,970 DEBUG    MQTT       Publishing: emon/emonpi/t2 0
2021-01-21 08:54:48,971 DEBUG    MQTT       Publishing: emon/emonpi/t3 0
2021-01-21 08:54:48,972 DEBUG    MQTT       Publishing: emon/emonpi/t4 0
2021-01-21 08:54:48,974 DEBUG    MQTT       Publishing: emon/emonpi/t5 0
2021-01-21 08:54:48,975 DEBUG    MQTT       Publishing: emon/emonpi/t6 0
2021-01-21 08:54:48,977 DEBUG    MQTT       Publishing: emon/emonpi/pulsecount 35305
2021-01-21 08:54:48,979 INFO     MQTT       Publishing 'node' formatted msg
2021-01-21 08:54:48,979 DEBUG    MQTT       Publishing: emonhub/rx/5/values -920,-22,-942,236.09,0,0,0,0,0,0,35305
2021-01-21 08:54:53,792 DEBUG    RFM2Pi     7 NEW FRAME : OK 5 115 252 234 255 93 252 227 91 0 0 0 0 0 0 0 0 0 0 0 0 237 137 0 0 (-0)
2021-01-21 08:54:53,794 DEBUG    RFM2Pi     7 Timestamp : 1611219293.791961
2021-01-21 08:54:53,795 DEBUG    RFM2Pi     7 From Node : 5
2021-01-21 08:54:53,796 DEBUG    RFM2Pi     7    Values : [-909, -22, -931, 235.23000000000002, 0, 0, 0, 0, 0, 0, 35309]
2021-01-21 08:54:53,796 DEBUG    RFM2Pi     7 Sent to channel(start)' : ToEmonCMS
2021-01-21 08:54:53,797 DEBUG    RFM2Pi     7 Sent to channel(end)' : ToEmonCMS
2021-01-21 08:54:53,916 DEBUG    MQTT       Publishing: emon/emonpi/power1 -909
2021-01-21 08:54:53,918 DEBUG    MQTT       Publishing: emon/emonpi/power2 -22
2021-01-21 08:54:53,919 DEBUG    MQTT       Publishing: emon/emonpi/power1pluspower2 -931
2021-01-21 08:54:53,921 DEBUG    MQTT       Publishing: emon/emonpi/vrms 235.23000000000002
2021-01-21 08:54:53,922 DEBUG    MQTT       Publishing: emon/emonpi/t1 0
2021-01-21 08:54:53,924 DEBUG    MQTT       Publishing: emon/emonpi/t2 0
2021-01-21 08:54:53,925 DEBUG    MQTT       Publishing: emon/emonpi/t3 0
2021-01-21 08:54:53,927 DEBUG    MQTT       Publishing: emon/emonpi/t4 0
2021-01-21 08:54:53,928 DEBUG    MQTT       Publishing: emon/emonpi/t5 0
2021-01-21 08:54:53,929 DEBUG    MQTT       Publishing: emon/emonpi/t6 0
2021-01-21 08:54:53,931 DEBUG    MQTT       Publishing: emon/emonpi/pulsecount 35309
2021-01-21 08:54:53,932 INFO     MQTT       Publishing 'node' formatted msg
2021-01-21 08:54:53,933 DEBUG    MQTT       Publishing: emonhub/rx/5/values -909,-22,-931,235.23000000000002,0,0,0,0,0,0,35309
2021-01-21 08:54:57,453 WARNING  SDM120     Exception caught in SDM120 thread. Traceback (most recent call last):
  File "/opt/openenergymonitor/emonhub/src/emonhub_interfacer.py", line 32, in wrapper
    return func(*args)
  File "/opt/openenergymonitor/emonhub/src/emonhub_interfacer.py", line 99, in run
    rxc = self.read()
  File "/opt/openenergymonitor/emonhub/src/interfacers/EmonHubSDM120Interfacer.py", line 76, in read
    self._log.debug("%.2f %.2f %.4f %.4f %.3f %.3f" % (r['voltage'],r['power_active'],r['power_factor'],r['frequency'],r['import_energy_active'],r['current']))
KeyError: 'voltage'

2021-01-21 08:54:57,643 WARNING  MainThread SDM120 thread is dead.
2021-01-21 08:54:57,644 WARNING  MainThread Attempting to restart thread SDM120 (thread has been restarted 1 times...)
2021-01-21 08:54:57,646 INFO     MainThread Setting RFM2Pi calibration: 230V (1p)
2021-01-21 08:54:57,727 DEBUG    RFM2Pi     device settings updated: E i5 g210 @ 433 MHz q1 USA 0
2021-01-21 08:54:58,648 INFO     MainThread Creating EmonHubSDM120Interfacer 'SDM120'
2021-01-21 08:54:58,650 INFO     MainThread Connecting to SDM120 device=/dev/ttyUSB0 baud=2400
2021-01-21 08:54:58,651 INFO     MainThread Setting SDM120 read_interval: 10
2021-01-21 08:54:58,652 INFO     MainThread Setting SDM120 nodename: SDM120
2021-01-21 08:54:58,652 DEBUG    MainThread Setting SDM120 pubchannels: ['ToEmonCMS']

et cetera…

Oh dear, well on the plus side things have got further along so we’ve conquered one hurdle, but it seems there are other issues. I’m not at a pc right now and will have a look later.

Modbus is renowned for getting the 2 com wires confused and as it is safe to swap them, before delving any deeper try swapping them over to see if it gets further or not. May need another restart.

Thank you Paul.
I had read that devices often got their 'A’s and 'B’s mixed up, but have not tried swapping them.
Will try in a bit and report back.

Uncomment these 2 lines to see what you have got back

It will still throw and exception.

[edit]
this may help. sdm-modbus · PyPI

[edit2]
There is an example.py there you could try (remove the emonhub interfacer config first)

I hope the swap makes a difference because a 2nd look at the code snippet I posted previously shows there is very little in between the mentioned "If . . . " line (L70) and the newly failing log line (L76) in fact just one line to “read_all” the registers (L71), if that is failing I suspect either a HW fault (poor conn or swapped conns etc) or a sdm_modbus library issue since the implementation is very minimal.

Ideally there should be some try/except clauses in there with better error reporting, and handling to avoid crashing out as you are currently seeing.

No, it seems this interfacer skips using the [nodes] section altogether and opts for hardcoded names in Line 78 of the same snippet.

I have to say I prefer the more generic library names to the hardcoded alternatives, since all the inputs will be posted under a node name of “sdm_120” (or similar) the “sdm_” prefixes make the input names somewhat more vague eg “sdm_120:sdm_P” isn’t as clear as “sdm_120:power” but I assume this is done this way to accommodate MQTT perhaps? This is specifically why node definitions (and default settings) are IMO important.

I’m guessing this is a WiP and just an early release of unfinished code.

My previous approach with the symlink was to avoid editing the source as I was unclear how comfy Sean was with it and it will block (hopefully imminent) updates via git. If Sean is happy to edit the source then adding a couple of simple try/excepts would avoid the crashes and the whole result of read_all could be logged rather than that commented out first level loop which will crash if r = None.

I will get on this now and make the changes to the code. Should have an updated version to test shortly.

@TrystanLea I have just submitted a PR

Please test it first if you use it as I was unable to test.

1 Like

Thanks @pb66

Thanks again @pb66, tested here, with a minor modification to the connection

self._sdm = sdm_modbus.SDM120(device=device, baud=int(baud))

it worked fine.

I will have a look at improving the options to name the parameters.

1 Like

I’ve added a prefix option which makes the sdm_ part optional.

[[SDM120]]
    Type = EmonHubSDM120Interfacer
    [[[init_settings]]]
        device = /dev/ttyUSB0
        baud = 2400
    [[[runtimesettings]]]
        pubchannels = ToEmonCMS,
        read_interval = 10
        nodename = SDM120
        # prefix = sdm_

In the code there is an array that defines the SDM120 key’s to read, short names and number of decimal points to round the value too:

    read_keys = {
        'voltage':('V',2),
        'power_active':('P',2),
        'power_factor':('PF',4),
        'frequency':('FR',4),
        'import_energy_active':('E',3),
        'current':('I',3)
    }

The parameters are then read if present in the data returned from the SDM120:

for i in read_keys:
    if i in r:
        c.names.append(self._settings['prefix']+read_keys[i][0])
        c.realdata.append(round(r[i],read_keys[i][1]))

The prefix is blank by default so inputs will appear under nodename SDM120, input names: V,P,PF etc.

My own use case is posting the SDM120 data alongside MBUS data under a single nodename called heatpumpmonitor and so the prefix is useful so that I can then set the inputs to be: heatpumpmonitor:sdm_V etc…

@srt these recent updates are still in the emonhub master branch for now. With a bit more testing I will merge them into stable and do a release. For now would you mind switching to this branch to test the new changes?

The steps are (via SSH):

cd /opt/openenergymonitor/emonhub
git checkout master
git pull

As @srt has modified some of the files, he will need to get rid of the changes by checking out that file first else Git will complain.

1 Like

One thing, I think it is bad form to drop experimental stuff into master - it should really go into a dev branch first IMHO, merged to master for final testing and then released as stable.

You have told me many times @borpin :slight_smile: I think there are too many steps, perhaps we should just have stable and development for the main branches… I do leave features in a specific feature branch when they are really experimental but try and bring them into master at least when they dont break anything else, even if the feature itself in this case the SDM120 reader is a very early version of the feature. I just find things go stale very quickly if left in feature branches for wider testing. I know I’m not going to get agreement on this.

Edit: I think @srt is the first person to use this in 2 months? or at least post an issue…

Why have you opted for hardcoded names albeit with a prefix rather than using the existing practice of using [nodes] definitions? “Voltage” is obviously more user friendly than “sdm_v” or just “v” especially as there is no way to change the names in emoncms if you want data via mqtt?

There is no reason you couldn’t have a default array of names eg sdm_v, sdm_p, etc and let users define their own array. Likewise for precision levels.

Although the oem emonhub follows the emonhub-wide [nodes] definitions I am veering towards interfacer level node definitions so rather than a [nodes] definition you could easily have names = voltage,power_active etc and precision = 2,2,4 etc in the interfacer [[runtimesettings]].

However, I personally would prefer to see users able to define any number of the available values in any order so they can create thier own node formats eg

   values = power_active, voltage
   names = Power, MainsVoltage
   precision = 2, 1

would give a node of 2 values, “Power” first to 0.01 units (I assume Watts?) and MainsVoltage to 0.1 volts. This might not have much effect on “status” type MQTT but when frames of data are posted via http (and hopefully MQTT too) you can select the order the inputs are read and processed, very important when using more than one input in a calculation during processing.

@pb66 true that could work fine, so the values setting would define the SDM120 parameter order to map to names and precision… is values the best name for this?

Whilst I don’t disaggree with what you say, the naming of the branches is what causes the confusion, ordinarily development is done in another branch eg “dev” and merged to “master” after final testing, only after a release has seen the test of time could it be called “stable” so really oem stable = master and oem master = dev since master is usually where the releases come from not from “stable” as is the case with oem.

1 Like

Ha Ha!

Yes naming is crucial, eg above eg rfm12pi (with rfm69 module) or emoncms id/name name/desc etc, not our strongest point, ay?

I’m not fixed on “values” it possibly isn’t right but it needs to be generic so that all interfacers can reuse without issue (for example using “interval” rather than “read_interval”), I was just floating the concept as I really don’t like hardcoded elements so IF changes were being made I hoped this would approach could be considered.

I first used this approach for the wunderground interfacer even before emonhub experimental branch.

[edit - just looked to see what I used back then]

Currently available datafields are “temp_c”, “feelslike_c”, “dewpoint_c”, “heat_index_c”, “windchill_c”, “wind_mph”, “wind_gust_mph”, “visibility_mi”, “precip_1hr_metric”, “precip_today_metric”, “UV”, “wind_degrees”, “pressure_mb”, “pressure_in”, “pressure_trend”, “relative_humidity”, “temp_f”, “feelslike_f”, “dewpoint_f”, “heat_index_f”, “windchill_f”, “wind_kph”, “wind_gust_kph”, “visibility_km”, “precip_1hr_in”, “precip_today_in”

Which any number can be strung together as csv, in any order to create a frame be passed to emoncms eg

datafields = relative_humidity, feelslike_c, pressure_mb

I think datafields works well, it’s generic and clear.

1 Like