Issues with node activation on local emoncms

Hi Open Energy Team:

Sorry for bothering you with this issue but I haven't been able to solve it and after two full days it seems that I have reached my level of incompetency!

I found that my emoncms wasn't working anymore and I took the chance to upgrade it and redo the whole thing, now I can't make it work. The eomoncms doesn't receive any feeds. The details follow:

I have an EmonTxV3.2 with a variation of the "emonTxV3 Discrete Sampling" from Glyn Hudson & Trystan Lea, this has been my working version for more than a year. Via serial interface I can see that the sketch works as expected. The radio is a RF12_433MHZ, nodeID = 10,  networkGroup = 210. And this sketch uses this library: RFu_JeeLib.h

At the end it produces and sends the following data structure:  typedef struct { int power1, power2, power3, power4, Vrms, temp, tempExt, humidityExt; } PayloadTX;  via the instruction: rf12_sendNow(0, &emontx, sizeof emontx); 

Now, on the other "side" I have a raspberry Pi, same radio and group with Node Id=15. 4Gb SD, and a thumbdrive as a HDD. I downloaded the emonSD-17Jun2015.img to both and did the procedure to use the HDD, still as a low write version. Based on this image, the version for emoncms is low-write-v8.5. The node 10 appears as inactive and the emonhub log sends this:

2015-11-27 05:12:22,991 INFO emoncmsorg sending: http://localhost/emoncms/input/bulk.json?apikey=E-M-O-N-C-M-S-A-P-I-K-E-Y&data=[]&sentat=1448579542

2015-11-27 05:12:23,334 WARNING emoncmsorg send failure: wanted 'ok' but got 'Error: Format error, json string supplied is not valid.

In the API Section if I query for the values http://10.10.1.107/emoncms/nodes/10/rx/values, I get

<br /> <b>Notice</b>: Undefined property: stdClass::$10 in <b>/var/www/emoncms/Modules/nodes/nodes_controller.php</b> on line <b>239</b><br /> <br /> <b>Notice</b>: Trying to get property of non-object in <b>/var/www/emoncms/Modules/nodes/nodes_controller.php</b> on line <b>239</b><br /> <br /> <b>Notice</b>: Trying to get property of non-object in <b>/var/www/emoncms/Modules/nodes/nodes_controller.php</b> on line <b>239</b><br /> null
 

So my guess is that he string is not assembled correctly due to the values from the node, or it's format, or...beats me

 

This is the configuration for the node 10 in the  Emonhub configuration file:
[10]]
    nodename = emonTx_1
    firmware =V1_6_emonTxV3_4_DiscreteSampling
    hardware = emonTx_(NodeID_DIP_Switch1:OFF)
    [[[rx]]]
       #names = power1, power2, power3, power4, Vrms, temp1, temp2, temp3, temp4, temp5, temp6, pulse #Firmware V1.6
       names = power1, power2, power3, power4, Vrms, temp, tempExt, humidityExt                                         #Firmware =<V1.4 (un-comment)
       datacode = h
       #scales = 1,1,1,1,0.01,0.1,0.1, 0.1,0.1,0.1,0.1,1 #Firmware V1.6
       #units =W,W,W,W,V,C,C,C,C,C,C,p                   #FirmwareV1.6
       scales = 1,1,1,1,0.01,1,1,1                       #Firmware =<V1.4 (un-comment) 
       units =W,W,W,W,Vrms,C,C,%                              #Firmware =<V1.4 (un-comment)

And this is the interfacer:

### This interfacer manages the RFM2Pi module
[[RFM2Pi]]
    Type = EmonHubJeeInterfacer
    [[[init_settings]]]
        com_port = /dev/ttyAMA0
        com_baud = 38400
    [[[runtimesettings]]]
        pubchannels = ToEmonCMS,
        subchannels = ToRFM12,
        
        # datacode = B #(default:h)
        # scale = 100 #(default:1)
        group = 210 #(default:210)
        frequency = 433 #(default:433)
        baseid = 15 #(emonPi default:5)
        quiet = false #(default:true)
        calibration = 110V #(UK/EU: 230V, US: 110V)
        # interval = 300 #(default:0)
        # nodeoffset = 32 #(default:0)

### This interfacer manages the RFM2Pi module
[[MQTT]]

    Type = EmonHubMqttInterfacer
    [[[init_settings]]]
        mqtt_host = 127.0.0.1
        mqtt_port = 1883
    [[[runtimesettings]]]
        pubchannels = ToRFM12,
        subchannels = ToEmonCMS,
        basetopic = emonhub/
        
[[emoncmsorg]]
    Type = EmonHubEmoncmsHTTPInterfacer
    [[[init_settings]]]
    [[[runtimesettings]]]
        pubchannels = ToRFM12,
        subchannels = ToEmonCMS,
        url = http://localhost/emoncms
        apikey = my write api key is here
        senddata = 1
        sendstatus = 1
        

If I kill emoncms process and start minicom, I receive the following stream

10 48 3 20 0 193 0 0 0 167 50 225 0 0 0 0 0         

 10 22 3 19 0 194 0 0 0 186 50 225 0 0 0 0 0         

 10 82 3 21 0 195 0 0 0 191 50 225 0 0 0 0 0

That looks ok to me

Any insights? How could I troubleshoot better? I don't mind starting from zero gain if you think that is the correct way (I'm at zero anyway)

Thanks a lot for reading this!

Patricio Duenas

 

Robert Wall's picture

Re: Issues with node activation on local emoncms

Paul (pb66) is the expert, but aren't you sending it back to itself with:

[[emoncmsorg]]
     Type = EmonHubEmoncmsHTTPInterfacer
     [[[init_settings]]]
     [[[runtimesettings]]]
         pubchannels = ToRFM12,
         subchannels = ToEmonCMS,
         url = http://localhost/emoncms
         apikey = my write api key is here
         senddata = 1
         sendstatus = 1

I think you can comment out all of that section, it is for sending to emoncms.org (like the title of the section says), not back to localhost, which is itself!

pb66's picture

Re: Issues with node activation on local emoncms

Robert is right about not needing that "emoncmsorg" interfacer to send to the local emoncms, the emonhub"emon-pi" variant on that image uses MQTT to pass data to emoncms.

Although the log you supplied is for the unneeded http interfacer, the MQTT interfacer will be working in tandem with the same data so the probability is it is getting an empty data frame too. I can't see any obvious reason for the empty dataframe as your conf seems ok (aside from the missing first square bracket "[10]]" which I assume to be a cut and paste casualty).

Can you provide some more log showing the passage of a dataframe through emonhub from starting from the "NEW FRAME" log entry? and also confirmation of a successful MQTT connection and publish?

Paul 

Patricio Duenas's picture

Re: Issues with node activation on local emoncms

Hi Paul and Robert

Thanks for the help. Some notes:

1. There is no missing bracket in [[10]] it was a cut and paste error, sorry for that.

2. I commented all the Emoncms part. Rebooted and this is the tail of the emonhub log:
2015-12-01 05:56:49,426 INFO MainThread EmonHub emonHub 'emon-pi' variant v1.0

2015-12-01 05:56:49,429 INFO MainThread Opening hub...

2015-12-01 05:56:49,432 INFO MainThread Logging level set to DEBUG

2015-12-01 05:56:49,434 INFO MainThread Creating EmonHubJeeInterfacer 'RFM2Pi'

2015-12-01 05:56:49,441 DEBUG MainThread Opening serial port: /dev/ttyAMA0 @ 38400 bits/s

2015-12-01 05:56:51,449 WARNING MainThread Device communication error - check settings

2015-12-01 05:56:51,459 INFO MainThread Setting RFM2Pi frequency: 433 (4b)

2015-12-01 05:56:52,462 INFO MainThread Setting RFM2Pi group: 210 (210g)

2015-12-01 05:56:53,466 INFO MainThread Setting RFM2Pi quiet: 0 (0q)

2015-12-01 05:56:54,470 INFO MainThread Setting RFM2Pi baseid: 15 (15i)

2015-12-01 05:56:55,474 INFO MainThread Setting RFM2Pi calibration: 110V (2p)

2015-12-01 05:56:56,478 DEBUG MainThread Setting RFM2Pi subchannels: ['ToRFM12']

2015-12-01 05:56:56,481 DEBUG MainThread Interfacer: Subscribed to channel' : ToRFM12

2015-12-01 05:56:56,483 DEBUG MainThread Setting RFM2Pi pubchannels: ['ToEmonCMS']

2015-12-01 05:56:56,496 DEBUG MainThread Interfacer: Subscribed to channel' : ToRFM12

2015-12-01 05:56:56,500 INFO MainThread Creating EmonHubMqttInterfacer 'MQTT'

2015-12-01 05:56:56,504 INFO MainThread MQTT Init mqtt_host=127.0.0.1 mqtt_port=1883

2015-12-01 05:56:56,538 DEBUG MainThread MQTT Subscribed to channel' : ToEmonCMS

2015-12-01 05:56:56,667 INFO MQTT Connecting to MQTT Server

2015-12-01 05:56:57,261 INFO MQTT connection status: Connection successful

2015-12-01 05:56:57,265 DEBUG MQTT CONACK => Return code: 0

2015-12-01 05:56:57,404 INFO MQTT on_subscribe
 

As you can see, this line bothers me: 
2015-12-01 05:56:51,449 WARNING MainThread Device communication error - check settings

But i tested the radio with minicom and it is reciving info from node 10

Does this help?

 

Thanks a lot again

Patricio Duenas's picture

Re: Issues with node activation on local emoncms

Hey!

I downloaded the baudrate to 9,600 and it works!  I am happy as I can be, thanks a lot!

Now to recalibrate and create the dashboard

 

Do you recommend upgrading to 9.0?

 

 

Again, thanks a lot!!!

 

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.