Community
OpenEnergyMonitor

OpenEnergyMonitor Community

Emoncms not creating inputs

Hello. My emoncms is not populating the input from IoTaWatt.

I had to delete all my inputs and feeds on emoncms and start over due to a configuration problem. But now the IoTaWatt is not populating the emoncms’s inputs. I remember I had problems getting it to populate when I first setup emoncms.

I have the server URL set to http://192.168.1.50/emoncms on my IoTaWatt and it is getting these errors:
12/12/21 09:16:33 emoncms: Query failed -5
12/12/21 09:16:38 emoncms: Query failed 401
12/12/21 09:16:43 emoncms: Query failed 401

There is a device access key in emoncms and write api key. I currently have IoTaWatt setup to use the write api key. Which key should I use? Any idea as how to fix that error?

Apache access log:

192.168.1.43 - - [12/Dec/2021:00:00:08 -0700] “POST /emoncms/input/get?node=Willow HTTP/1.1” 401 276 “-” “-”

The node names are “Willow” on both the IoTaWatt uploader and on emoncms.

I already asked for help on the IoTaWatt forum and they said to ask over here.

Thanks!

Any ideas everyone?

Not many people here know very much about iotawatt, me included.

You can check that your emonCMS is operating correctly by using a web browser to send one of the test strings that appear in the Input API Help. If one, or ideally, all of those work, then I’d say there’s very little wrong with your emonCMS, and it’s the structure or format of the message that the iotawatr is sending that’s the problem.

The one you’re using - the Read & Write API Key. (It gives permission to write into emonCMS).

Has the server URL been changed by your router, by any chance?

Is emonCMS where you think it is (i.e., do you need to specify the “/emoncms” directory?

Thanks.

I fixed it. I went into emoncms “API Help” and copied the “Read/Write” API key. I then used that in IoTaWatt and it started updating! I was using the write key before this and it didn’t work.

Now you really confused me. There isn’t a write key.

There is a Read only key, which allows whoever possesses it to read from emonCMS, (but not to add or change data) and

there is a Read & Write key, which allows whoever possesses it to both read from and write to emonCMS, in effect to do anything - read, change, add or delete.

From emoncms->My Account:

Write API Key
Read API Key

I was using the Write API key.

This is what I see:

You are looking in a different place than me. I found those two keys in “My Account”

From emoncms.org’s ‘My Account’ page:

I’ve sent a PM to Trystan pointing out the inconsistency, and that I see the names on the Inputs page as rather more descriptive and thus more helpful.

1 Like

Confusion aside, the two places SHOULD contain the same data - and they certainly do on my system.

The “Write API Key” mentioned on the “My Account” page under Setup aligns exactly with the “Read & Write” key listed on the Input API help page.

Can you compare the two keys on your system and confirm they are in fact different? IF they ARE different - that seems like something has gone wrong somewhere!

Both my local RPi emonCMS and my emoncms.org account have the same key in both places.
I even checked that the “Copy to clipboard” was the same as the visible key - it is on both.

Could @mrfiat have accidentally triggered a new API key if he’s been accessing it in My Account rather than via Input API Help?

[Trystan says he’ll use the Input API Help wording in both places in the next release :+1: ]

1 Like

Yes, mine has the same key in both places to. I was sure I used the write key. The write key should be relabeled as “read/write key”

That’s already in hand, if you read my comment above.