Just had a chance to sort it out, took less than an hour, and most of that was me missing some really simple things. I followed https://github.com/openenergymonitor/emonhub/blob/emon-pi/configuration.md. The mistakes I made were as follows:
- I put the code for
[[mysocketlistener]]
Type = EmonHubSocketInterfacer
[[[init_settings]]]
port_nb = 8080
[[[runtimesettings]]]
pubchannels = ToEmonCMS,
timestamped = True
at the bottom of the emonHub config, instead of the interfacers section.
- It didn’t mention to restart emonHub, but that was required
- On realising I had to restart emonHub I got an error message. I did an “emonPi update” which seemed to fix it
- Its important that in the python code
import socket, time
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(('emonpi ip', 8080))
s.sendall(str(time.time())+' 98 3.8 1.6 5.2 80.3\r\n')
the last digit of data doesn’t have a space before the \r\n
Once I got past those silly mistakes, it works perfectly with the code I had written previously to post via the http api, the input shows up on both my local emonPi and on emoncms.org.