I generated new API keys for read and read/write (thought I had a problem with the old keys when pulling data from the API). I didn’t realise this would stop Emoncms.org logging data. Looking at this earlier exchange (Is it possible to generate new api keys?), it seems I now need to “update all devices and software etc that were using the old key” but I can find no guidance on how to do this. Alternatively, I guess I could restore the old API key but don’t know if that is possible.
Advice welcomed - I’m new to Open Energy Monitor and I’m not a programmer or Pi user!
Welcome, Nick, to the OEM forum.
Which API Keys did you replace, or maybe I should phrase it as, how are you collecting the data and sending the data to emoncms.org? Because there could well be two sets of API keys, and it’s important to only change the right one(s).
Basically, the APIKey is to assure the device receiving the data that it’s come from a genuine source, so it’s the source we need to identify in order to get the APIKey from the destination and replace it in the source.
Thanks @Robert.Wall I’ve got the emonPi2 kit installed on my heat pump. I was using R to pull the data from the API. The R code had stopped working - had worked previously. Thought there might be an issue with the API keys so generated new keys - changed both read and read/write API keys on Emoncms.org. But that has broken the feeds coming in from the emonPi2 - at least, no updates on Emoncms.org since I did this. I didn’t realise the kit also used the API keys when uploading data (or that’s what I’m assuming).
Yes, your emonHP (a customised emonPi2) has a pair of APIkeys, and your emoncms.org account has a different pair of APIkeys.
You need to log in to emoncms.org and copy the read/write APIkey and insert it into your emonhub.conf file in your HP emonPi2. You access this though the Setup menu and emonHub (the loudhailer icon). The top of the file should look something like this:
#######################################################################
####################### emonhub.conf #########################
#######################################################################
### emonHub configuration file, for info see documentation:
### https://github.com/openenergymonitor/emonhub/blob/emon-pi/configuration.md
#######################################################################
####################### emonHub settings #######################
#######################################################################
[hub]
### loglevel must be one of DEBUG, DEBUG, DEBUG, DEBUG, and CRITICAL
loglevel = DEBUG
### Uncomment this to also send to syslog
# use_syslog = yes
#######################################################################
####################### Interfacers #######################
#######################################################################
[interfacers]
### This interfacer manages the RFM12Pi/RFM69Pi/emonPi module
[[RFM2Pi]]
Type = EmonHubJeeInterfacer
[[[init_settings]]]
com_port = /dev/ttyAMA0
com_baud = 38400 # 9600 for old RFM12Pi
[[[runtimesettings]]]
pubchannels = ToEmonCMS,
subchannels = ToRFM12,
group = 210
frequency = 868
baseid = 5 # emonPi / emonBase nodeID
calibration = 230V # (UK/EU: 230V, US: 110V)
quiet = true # Disable quite mode (default enabled) to enable RF packet debugging, show packets which fail crc
# interval = 300 # Interval to transmit time to emonGLCD (seconds)
[[MQTT]]
Type = EmonHubMqttInterfacer
[[[init_settings]]]
mqtt_host = 127.0.0.1
mqtt_port = 1883
mqtt_user = emonpi
mqtt_passwd = emonpimqtt2016
[[[runtimesettings]]]
pubchannels = ToRFM12,
subchannels = ToEmonCMS,
# emonhub/rx/10/values format
# Use with emoncms Nodes module
node_format_enable = 1
node_format_basetopic = emonhub/
# emon/emontx/power1 format - use with Emoncms MQTT input
# http://github.com/emoncms/emoncms/blob/master/docs/RaspberryPi/MQTT.md
nodevar_format_enable = 1
nodevar_format_basetopic = emon/
[[emoncmsorg]]
Type = EmonHubEmoncmsHTTPInterfacer
[[[init_settings]]]
[[[runtimesettings]]]
pubchannels = ToRFM12,
subchannels = ToEmonCMS,
url = https://emoncms.org
apikey = xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
senddata = 0 # Enable sending data to Emoncms.org
sendstatus = 0 # Enable sending WAN IP to Emoncms.org MyIP > https://emoncms.org/myip/list
sendinterval= 30 # Bulk send interval to Emoncms.org in seconds
In the last section above (the pane scrolls!) ([[emoncmsorg]]
) I’m NOT sending any data, but you will be. You need to remove the x’s and in their place put the read/write APIkey for emoncms.org (32 characters) and don’t change anything else - all the rest should be OK.
Make sure you get the APIkeys from emoncms.org and not from your HP emonPi2.
As I wrote - the read/write APIkey from emoncms.org is your userID and password/permission to write data to your account there. That’s why your HP needs it and the data won’t be accepted without it.
@Robert.Wall Many thanks for taking the time to share this - much appreciated. My problem now is that I have no idea how to make the edit you suggest! I see some guidance here (emonHub Configuration File — OpenEnergyMonitor 0.0.1 documentation) but when I go into Setup on Emoncms.org, I don’t see ‘ Emonhub’ as an option.
Am going to see if it is possible to restore the old API key as that might be the simpler solution.
Contact The Shop. Support for the HP is included in the price you paid, but best mention this Topic.
Thanks. I’ve much to learn, clearly!