emonTx v2 - data visible in log, not in Emoncms

Hi all,

I’ve just finished building an emonTx v2 and I have an issue with the data being posted to Emoncms. The emonTx is visible in the inputs page but all I see is the rssi input. In the logs I can see that the data is being received by the RFM12PI:

2017-04-01 21:01:03,828 DEBUG    RFM2Pi     67342 NEW FRAME : 10 147 2 0 0 0 0 34 13
2017-04-01 21:01:03,836 DEBUG    RFM2Pi     67342 Timestamp : 1491080463.83
2017-04-01 21:01:03,838 DEBUG    RFM2Pi     67342 From Node : 10
2017-04-01 21:01:03,841 DEBUG    RFM2Pi     67342    Values : [659, 0, 0, 3362]
2017-04-01 21:01:03,843 DEBUG    RFM2Pi     67342 Sent to channel(start)' : ToEmonCMS
2017-04-01 21:01:03,849 INFO     RFM2Pi     Publishing: emon/emontx1/power1 659
2017-04-01 21:01:03,856 INFO     RFM2Pi     Publishing: emon/emontx1/power2 0
2017-04-01 21:01:03,888 INFO     RFM2Pi     Publishing: emon/emontx1/power3 0
2017-04-01 21:01:03,897 INFO     RFM2Pi     Publishing: emon/emontx1/power4 3362
2017-04-01 21:01:03,902 INFO     RFM2Pi     Publishing: emon/emontx1/rssi 0
2017-04-01 21:01:03,908 INFO     RFM2Pi     Publishing: emonhub/rx/10/values 659,0,0,3362
2017-04-01 21:01:03,914 INFO     RFM2Pi     Publishing: emonhub/rx/10/rssi 0
2017-04-01 21:01:03,921 DEBUG    RFM2Pi     67342 adding frame to buffer => [1491080463.828155, 10, 659, 0, 0, 3362]
2017-04-01 21:01:03,924 DEBUG    RFM2Pi     67342 Sent to channel(end)' : ToEmonCMS

I also have an emonTh v3 which is working successfully. I’m running Emoncms 9.8.0 locally with an RFM12PI and the emonTx uses an RFM69.

Here is the config for the emonTx:

    nodename = emontx1
       names = power1, power2, power3, power4, vrms, temp1, temp2, temp3, temp4, temp5, temp6, pulse
       datacode = h
       scales = 1,1,1,1,0.01,0.1,0.1, 0.1,0.1,0.1,0.1,1
       units =W,W,W,W,V,C,C,C,C,C,C,p

Any help greatly appreciated!


What does your emonTx V2 sketch look like? Is it sending the same data that emonHub is expecting? (Or more to the point, have you configured the node in emonHub to accept the data set that the emonTx V2 is sending? The reason I ask is, the V2 has only 3 current inputs, so it can only read 3 powers, and you are expecting 4. If the data that comes in isn’t what the configuration in emonHub expects, it rejects the data, thinking it is corrupted.

There is a known issue with the emoncms MQTT input implementation that doesn’t recognize newly created inputs. You can see from the log there are some emontx1 values are being published to MQTT but if only the RSSI is visible in emoncms, that MQTT isn’t getting through, to date the only way of getting your new inputs to be seen in emoncms is to totally reboot the Pi.

Although, as @Robert.Wall says the emonTx v2 only has 3 CT inputs and therefore usually only 3 “powers”, I think you are using the default emonTx v3 [Nodes] configuration in the emonhub.conf and that will need modifying so at least the naming and scaling is correct. I would also recommending using the more explicit datacodes= rather than a datacode= setting.

The reason data was able to pass through emonhub without being rejected in this instance is because of the datacode = h setting that will allow any packet containing an even number of byte values through as that setting is a loose “undefined number of 16bit signed integers” packet format and is not intended for use when a single fixed known packet format is known. The emonTx v3 [nodes] configuration should really use datacodes= h,h,h,h,h,h,h,h,h,h,h,L (or datacodes = h,h,h,h,h,h,h,h,h,h,h,h depending on the vintage and whether it is sending 12 or 13 bytes).

The use of "datacode = h` is why an obviously different (wrong?) packet got through the error checking and could have corrupted good data if that input was already in use (eg with an emonTx v3). Error checking was also removed from the scaling in the “emonpi” variant of emonhub (and never applied to the names or units) so you need to be very sure of your configuration or accept erroneous data whilst setting up, not so much a problem with new builds but more so for existing setups.

you should correct your node definition which will be something like

    nodename = emontx1
       names = power1, power2, power3, voltage
       datacodes = h, h, h, h
       scales = 1,1,1,0.001
       units =W,W,W,V

but will depend on which sketch you used, I’ve just guessed and generalized an example.

The “3362” 4th value might be Vcc*1000= 3.3v so pay attention to the scaling as that will be 0.001 where as a Vrms value would be 0.01.

Then reboot the Pi to see the correct inputs in emoncms.

Many thanks for the quick replies. It turns out the Pi did indeed need a reboot - I guess I should have done that in the first place, I think the fact that the data was clearly being received by the RFM2Pi threw me.

All the above info is very useful and I will update my sketch to reflect your recommendations.