Victron to Emoncms, “Get” syntax

I found a very nice little program by for transferring data from my new Victron units to Emoncms GitHub - Paulf007/dbus-emoncms: A Python Script to upload Victron data to Emoncms directly from CCGX / Color control

It works great posting to emoncms.org, but I just can’t get it to post to my local server on http://192.168.0.200

I guess it’s due to the http rather than the https connection, but I just can’t get the syntax right. Code:

  # --------------------------------------------- upload data to emon --------------------------------------------------------------- #   
        try:
            conn = httplib.HTTPConnection(server)
            conn.request("GET", "/"+emoncmspath+"/input/post.json?&node="+str(nodeid)+"&json="+"{"+payload+"}"+"&apikey="+apikey)
            response = conn.getresponse()
            conn.close()
            print "Emondata sent:" + payload
        except Exception as e:
            print "error sending to emoncms...: " + str(e)
            return [0]
        return [1]        ''

What do I do to have this software connect to http://192.168.0.200?

1 Like

Try printing the actual URL generated then typing that into a browser window and see what happens.

I note you never print the response? what response do you get - that will be a big clue.

The 2 servers do need different API keys.

I tried printing and pasting into browser window, and to my surprise I got the response:

{“success”: false, “message”: “Format error, json value is not numeric”}

Turnes out one of the parameters has the value “None” in stead of “0.00” and that posting works fine if I remove the parameter. Odd though that “None” seem to work when posting to emoncms.org.

1 Like

One check is to paste the resulting JSON into jsonlint.com.

The json input format is a json like format and not true JSON.

Using the fulljson format is, I think, more tolerant and just fires a NAN into the emoncms input stream.