Emonpi not communicating with emoncms

i’m trying to ask if its possible to get more than just the payload data (feed value) from emoncms when using the node-red-emoncms. It appears to just give you the kWh value (from use_kWh feed), but I would also like the name of the feed for example so that I can use this as a reference in my SQL table for that particular location.

Thanks for taking the time to try and help me. I hope this makes more sense

Currently no. The nod-red node just returns the value of the Feed. It could return more.

Thanks Brian. I’ll see if i can get a combination of MQTT and node-red-emoncms feeds into the db.

Not sure what your skill level is, but how is your javascript?

The API call http://IPADDRESS/feed/aget.json?id=77 gives more data

{
	"id": "77",
	"userid": "1",
	"name": "Pulse-Wh",
	"datatype": "1",
	"tag": "3",
	"public": "0",
	"size": "",
	"engine": "5",
	"processList": "",
	"unit": "Wh",
	"time": 1611569777,
	"value": 438690
}

The Node could be modified (or a new node added) to get all data fields and return the other bits as well.

Thanks Brian. I’ll see if I can figure this out. My skill level is pretty close to zero, but i generally get there with a bit of trial and error (and a very generous community of people posting their experiences).

If I get a chance I’ll have a look at it.

My approach would be to offer an option within the node to return all data fields, by default just return the data (so backward compatible).

Just then need to change the url and parse the data field else return the whole JSON.

Thanks Brian. I’m trying the following to pull through from emoncms (obviously missing something quite fundamental though)

http request node with url https://emoncms.org/feed/aget.json?id=429752. This works on my browser, but not in node-red. It says “{“success”:false,“message”:“406 Not Acceptable. Route not found”}”. Is this because i haven’t entered an api key in the URL?.

I’m thinking if i can get this information then i can use the JSON node to get the detail i want to send to MySQL

I added my API key https://emoncms.org/feed/aget.json?id=429752&APIKEY=apikey from emoncms.org, but got the same error

I have added the feature to the node and submitted a PR for it to be included.

try this - put the API key here.

image

That worked! I now get all api feed data from emoncms. Next step is to separate out parts I need.

Thank you very much for your help with this Brian. I really appreciate you taking the time to look into this.

1 Like

I’ve managed to get name and value from the api into my server database.

Thanks again @borpin for your help

The emoncms node has been updated to return all data from the Feed.

Hi,

I am facing a same issue with the initial post in the topic.

I followed the step of copying the write API key from emoncms.org to emonhub in the local page of emonpi, saved it and nothing happened. Feeds and inputs are not presented to emoncms.org.
I have checked the log file and it seems like publishing the data (screenshot attached). Do you have any idea of what is the reason ?

There’s not enough there to see what’s happening - or not. Do you have lines like this in emonhub.log? (they do appear on the screen)

2021-03-02 14:06:13,548 DEBUG    emoncmsorg Buffer size: 7
2021-03-02 14:06:13,550 INFO     emoncmsorg sending: https://emoncms.org/input/bulk.json?apikey=E-M-O-N-C-M-S-A-P-I-K-E-Y&data=[[1614693943.9732373,5,153,141,294,238.16,0,0,0,0,0,0,44291,45066,41257],[1614693948.841209,5,154,142,296,238.3,0,0,0,0,0,0,44291,45066,41258],[1614693953.7030284,5,153,141,294,238.13,0,0,0,0,0,0,44291,45067,41258],[1614693958.5762427,5,152,140,292,238.07,0,0,0,0,0,0,44291,45067,41258],[1614693963.332359,5,154,142,296,238.23000000000002,0,0,0,0,0,0,44291,45067,41258],[1614693968.1817343,5,154,142,296,237.94,0,0,0,0,0,0,44292,45067,41258],[1614693973.035411,5,153,141,294,237.53,0,0,0,0,0,0,44292,45067,41259]]&sentat=1614693973
2021-03-02 14:06:13,878 DEBUG    emoncmsorg acknowledged receipt with 'ok' from https://emoncms.org

You should see that every 60 s, as set in emonhub.conf with sendinterval:

[[emoncmsorg]]
    Type = EmonHubEmoncmsHTTPInterfacer
    [[[init_settings]]]
    [[[runtimesettings]]]
        pubchannels = ToRFM12,
        subchannels = ToEmonCMS,
        url = https://emoncms.org
        apikey =  c6f4b9f8b4037f0dfc2ddf1e198bb5a2  # Not a real APIkey
        senddata = 1                   # Enable sending data to Emoncms.org
        sendstatus = 1                  # Enable sending WAN IP to Emoncms.org MyIP > https://emoncms.org/myip/list
        sendinterval= 60                # Bulk send interval to Emoncms.org in seconds

I’m not a networking expert; if this doesn’t help, and your router is not blocking it, somebody else will need to help you.

Hi!
Thankyou for your answer.

So, yes in the emonhub.log do exist these lines

2021-03-02 14:27:12,988 DEBUG    emoncmsorg Buffer size: 6
2021-03-02 14:27:12,991 INFO     emoncmsorg sending: https://emoncms.org/input/bulk.json?apikey=E-M-O-N-C-M-S-A-P-I-K-E-Y&data=[[1614695206.0196967,5,133,0,133,230,0,0,0,0,0,0,0],[1614695211.0739658,5,134,0,134,230,0,0,0,0,0,0,0],[1614695216.0341742,5,135,0,135,230,0,0,0,0,0,0,0],[1614695221.109749,5,135,0,135,230,0,0,0,0,0,0,0],[1614695226.0757647,5,134,0,134,230,0,0,0,0,0,0,0],[1614695231.035981,5,133,0,133,230,0,0,0,0,0,0,0]]&sentat=1614695232
2021-03-02 14:27:13,584 DEBUG    emoncmsorg acknowledged receipt with 'ok' from https://emoncms.org

But yet the Emoncms.org does not show any data/inputs from emonpi. Furthermore, the "find local devices " option is not able to identify any local device.

“And your router is not blocking it” How could I check this?

Regards

emoncms.org IS receiving your data and the APIKey appears to be correct:

emoncmsorg acknowledged receipt with 'ok' from https://emoncms.org

so it is not your router.

@TrystanLea controls emoncms.org, he is the person to help you now.

Hello @Ioanna could you PM me your emoncms.org account name and I can take a look to see if I can see anything on this end?

Can you test that please? It was originally interval then accidentally changed to sendinterval then corrected back to interval. Has it regressed again? Or maybe just a little confusion (as one might expect).

See Emonhub Interfacer Interval setting

I was copying it out of my emonPi, which has the emonSD-200724.emonSD-24Jul20.img

(I’ve renamed the file so that it sorts into date order :smile:)

I’ve got a second emonPi, that started off with exactly the same image, but that self-updated recently (without asking me :rage: - that’s half the reason I don’t use Windoze any more) so I can power that up shortly and try it. But surely, if done sensibly, it would accept both names if there was a change for a reason other than it conflicted?

[Edit]=======================

Looking at the updated emonPi:
The log:

Starting update via service-runner-update.sh (v3.0) >
- emonSD version: emonSD-24Jul20

and from Admin:

EMONCMS
Version
low-write 10.2.7
Modules
Administration | App v2.2.5 | Backup v2.2.6 | EmonHub Config v2.0.5 | Dashboard v2.0.9 | DemandShaper v2.1.3 | Device v2.0.8 | EventProcesses | Feed | Graph v2.0.10 | Input | Postprocess v2.1.4 | CoreProcess | Schedule | Network Setup v1.0.0 | sync | Time | User | Visualisation | WiFi v2.0.3

And in emonhub.conf, I have

In the RFM2PI interfacer:
interval = 300

In the emoncmsorg interfacer:

        sendinterval= 40                # Bulk send interval to Emoncms.org in seconds

It appears that emonHub is using interval, but emonhub.conf is still being distributed with “sendinterval”
Just to make sure, I’ve unzipped the downloaded 16GB image, mounted it in this laptop and sure enough, there’s confusion.

rootfs/etc/emonhub/emonhub.conf has “sendinterval”
rootfs/opt/openenergymonitor/emonhub/conf/emonhub.conf has “interval”
rootfs/opt/openenergymonitor/emonhub/conf/emonpi.default.emonhub.conf has “sendinterval”
rootfs/opt/openenergymonitor/emonhub/conf/old.default.emonhub.conf has “sendinterval”

rootfs/opt/openenergymonitor/emonhub/conf/interfacer_examples/graphite/graphite.emonhub.conf has “sendinterval”
rootfs/opt/openenergymonitor/emonhub/conf/interfacer_examples/modbus/modbusTCP.emonhub.conf has “interval”


Testing with sendinterval = 40

2021-03-04 13:09:46,453 INFO     emoncmsorg sending: https://emoncms.org/input/bulk.json?apikey=E-M-O-N-C-M-S-A-P-I-K-E-Y&data=[[1614863359.61132,5,0,0,0,0,0,0,0,0,0,0,0],[1614863364.5580225,5,0,0,0,0,0,0,0,0,0,0,0],[1614863369.5931797,5,0,0,0,0,0,0,0,0,0,0,0],[1614863374.5301616,5,0,0,0,0,0,0,0,0,0,0,0],[1614863379.5804522,5,0,0,0,0,0,0,0,0,0,0,0],[1614863384.618505,5,0,0,0,0,0,0,0,0,0,0,0]]&sentat=1614863386
2021-03-04 13:09:46,694 DEBUG    emoncmsorg acknowledged receipt with 'ok' from https://emoncms.org
2021-03-04 13:10:16,716 INFO emoncmsorg sending: https://emoncms.org/input/bulk.json?apikey=E-M-O-N-C-M-S-A-P-I-K-E-Y&data=[[1614863389.5705168,5,0,0,0,0,0,0,0,0,0,0,0],[1614863394.6062639,5,0,0,0,0,0,0,0,0,0,0,0],[1614863399.546249,5,0,0,0,0,0,0,0,0,0,0,0],[1614863404.589052,5,0,0,0,0,0,0,0,0,0,0,0],[1614863409.5370674,5,0,0,0,0,0,0,0,0,0,0,0],[1614863414.586817,5,0,0,0,0,0,0,0,0,0,0,0]]&sentat=1614863416 2021-03-04 13:10:16,965 DEBUG emoncmsorg acknowledged receipt with 'ok' from https://emoncms.org

So NOT obeying the set interval

Testing with interval = 40

2021-03-04 13:13:38,545 INFO     emoncmsorg sending: https://emoncms.org/input/bulk.json?apikey=E-M-O-N-C-M-S-A-P-I-K-E-Y&data=[[1614863579.6197546,5,0,0,0,0,0,0,0,0,0,0,0],[1614863584.668141,5,0,0,0,0,0,0,0,0,0,0,0],[1614863589.6053035,5,0,0,0,0,0,0,0,0,0,0,0],[1614863594.6444068,5,0,0,0,0,0,0,0,0,0,0,0],[1614863599.5912955,5,0,0,0,0,0,0,0,0,0,0,0],[1614863604.6300666,5,0,0,0,0,0,0,0,0,0,0,0],[1614863609.5783212,5,0,0,0,0,0,0,0,0,0,0,0],[1614863614.6213903,5,0,0,0,0,0,0,0,0,0,0,0]]&sentat=1614863618
2021-03-04 13:13:38,825 DEBUG    emoncmsorg acknowledged receipt with 'ok' from https://emoncms.org
2021-03-04 13:14:18,858 DEBUG    emoncmsorg Buffer size: 8
2021-03-04 13:14:18,860 INFO     emoncmsorg sending: https://emoncms.org/input/bulk.json?apikey=E-M-O-N-C-M-S-A-P-I-K-E-Y&data=[[1614863619.6708913,5,0,0,0,0,0,0,0,0,0,0,0],[1614863624.6116045,5,0,0,0,0,0,0,0,0,0,0,0],[1614863629.6616616,5,0,0,0,0,0,0,0,0,0,0,0],[1614863634.6181579,5,0,0,0,0,0,0,0,0,0,0,0],[1614863639.6563766,5,0,0,0,0,0,0,0,0,0,0,0],[1614863644.592955,5,0,0,0,0,0,0,0,0,0,0,0],[1614863649.6281838,5,0,0,0,0,0,0,0,0,0,0,0],[1614863654.6758657,5,0,0,0,0,0,0,0,0,0,0,0]]&sentat=1614863658
2021-03-04 13:14:19,118 DEBUG    emoncmsorg acknowledged receipt with 'ok' from https://emoncms.org

behaves as expected.

So, my conclusion is confusion in the downloaded image has resulted in an obsolete/incompatible version of emonhub.conf being installed on the SD card.