Error: json string supplied is not valid

I´m trying to setup emonHub to send to emoncms.org and my local emoncms. You can see the emonhub setup below. For some reason I get a send failure WARNING when sending to my local emoncms. I´m running the local emoncms on windows 7 and emonhub on RasPi. I have one emonTx v2 connected to the system

2015-07-16 08:49:46,781 INFO emoncmsorg sending: http://emoncms.org/input/bulk.json?apikey=E-M-O-N-C-M-S-A-P-I-K-E-Y&data=[]&sentat=1437036586

2015-07-16 08:49:46,889 DEBUG emoncmsorg acknowledged receipt with 'ok' from http://emoncms.org

2015-07-16 08:49:54,431 INFO emoncms_local sending: http://10.10.1.200/emoncms/myip/set.json?apikey=E-M-O-N-C-M-S-A-P-I-K-E-Y

2015-07-16 08:49:56,422 INFO emoncms_local sending: http://10.10.1.200/emoncms/input/bulk.json?apikey=E-M-O-N-C-M-S-A-P-I-K-E-Y&data=[]&sentat=1437036596

2015-07-1608:49:56,579 WARNING emoncms_local send failure: wanted 'ok' but got 'Error: Format error, json string supplied is not valid
 

[[emoncmsorg]]
    Type = EmonHubEmoncmsHTTPInterfacer
    [[[init_settings]]]
    [[[runtimesettings]]]
        pubchannels = ToRFM12,
        subchannels = ToEmonCMS,
        url = http://emoncms.org
        apikey = xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
        senddata = 1
        sendstatus = 1

[[emoncms_local]]
    Type = EmonHubEmoncmsHTTPInterfacer
    [[[init_settings]]]
    [[[runtimesettings]]]
        pubchannels = ToRFM12,
        subchannels = ToEmonCMS,
        url = http://10.10.1.200/emoncms
        apikey = xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
        senddata = 1
        sendstatus = 1 

pb66's picture

Re: Error: json string supplied is not valid

Actually it looks like the string is incorrectly formed for both emoncms instances, but emoncms.org just isn't informing you of the problem.

Both strings contain "data=[]" which is an empty array ie no data, this should be picked up and handled in emonhub.

Can you show us the rest of the log there will probably be some errors regards the parsing of the frame.

Can you also show the [nodes] section of the emonhub.conf and tell us about the format of the data arriving from the emontx v2

Paul

natemay17's picture

Re: Error: json string supplied is not valid

I am having a very similiar problem where I cannot connect to my nodes and I am also receiving the invalid Json string. I am trying to get data locally which is why emoncmsorg is commented out

Feed:

2015-12-09 12:54:16,420 INFO MainThread Deleting interfacer 'emoncmsorg'

2015-12-09 12:54:16,423 DEBUG MainThread MQTT Subscribed to channel' : ToEmonCMS

2015-12-09 12:54:16,424 DEBUG MainThread localhost Subscribed to channel' : ToEmonCMS

2015-12-09 12:54:27,890 INFO localhost sending: http://10.16.1.20/emoncms/myip/set.json?apikey=E-M-O-N-C-M-S-A-P-I-K-E-Y 2015-12-09

12:54:28,196 INFO localhost sending: http://10.16.1.20/emoncms/input/bulk.json?apikey=E-M-O-N-C-M-S-A-P-I-K-E-Y&data=[]&sentat=1449665668

2015-12-09 12:54:28,308 WARNING localhost send failure: wanted 'ok' but got 'Error: Format error, json string supplied is not valid

 

Code: 

[interfacers]

### This interfacer manages the RFM2Pi module
[[RFM2Pi]]
    Type = EmonHubJeeInterfacer
    [[[init_settings]]]
        com_port = /dev/ttyAMA0
        com_baud = 9600
    [[[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 = 230V #(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/

[[localhost]]
    Type = EmonHubEmoncmsHTTPInterfacer
    [[[init_settings]]]
    [[[runtimesettings]]]
        pubchannels = ToRFM12,
        subchannels = ToEmonCMS,
        url = http://10.16.1.20/emoncms
        apikey = my write api key
        senddata = 1
        sendstatus = 1
        
###[[emoncmsorg]]
 ###   Type = EmonHubEmoncmsHTTPInterfacer
 ###   [[[init_settings]]]
###    [[[runtimesettings]]]
###        pubchannels = ToRFM12,
###        subchannels = ToEmonCMS,
###        url = http://emoncms.org
###        apikey = my write api key
###        senddata = 0
###        sendstatus = 0

borpin123's picture

Re: Error: json string supplied is not valid

One issue may be that EmonCMS does not seem to like valid json data.  I raised it wrt MQTT here without response so far.

Cheers, Brian

Comment viewing options

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