Hive Heating and Plugs. Error running hiveToOpenHAB script

Hi all,
I’m a long time reader of this community for the past couple of years and have used it extensively to set up my system for which I thank all contributors.
My setup comprises of a Raspberry Pi 3 and various Zwave nodes, Hue Lights, switches and motion sensors, 6 Sonoff switches and the Hive Heating system with active plugs but no bulbs.

I set up my Hive January 2018 using the excellent guide at

and the code at

In the last week I noticed my Hive sitemap was showing no temperatures and the Hive update status entry was saying the script had failed.

Something had changed with the data returned from the British gas servers and the cause of the script error was about line 39 of hive.rules that states:-

// crude error check based on script output
if (hiveHomeCliOutput.startsWith(“OK”)) {

After running in various debug and verbose modes I figured out that the data coming back didn’t now have “OK” at the start of it.
The actual data began with <!DOCTYPE html>

So I changed the script to :-

if (hiveHomeCliOutput.startsWith("<!DOCTYPE")) {

and everything started working again. There are other errors about a web page not being found and I have not investigated this fully, but it certainly seems like a quick fix.

Hope this helps someone and if I find out any more I will post again.

The web page not found error is due to not being able to find one of my 5 plug nodes.
I can see the plug and control it in the hive app and I can see the node ID in the json but the script claims it doesn’t exist. I’ve had to remove it from my config file.

Also unfortunately, running the script with the -getIDs option now no longer shows the plug ID’s.

Something has definitely changed.


The problem with not seeing one of my five plugs was down to me not adding a fifth item into the plugs section of the Openhab configuration part the config file. I’ve not had it long and was not using it in my Hive sitemap.
The problem with the -getIDs option of the script still exists but it’s not too difficult to manually pull the node id’s out of the jsn file.
I have compared my original nodes.jsn from when I first set this up and it is quite different to the one coming in from British Gas now so that’s where the problem lies, but for the moment it still works.
I should also add that I am using this in a “read only” mode as I quite like the Hive app, but after delving into the jsn file I can see the switches are reporting power consumption which could be useful. I’ve not seen this in the app.
Also the battery operated motion detector I have but I’m not using for anything special, reports battery level and temperature which could also be useful and again I’ve not seen in the app either.


Does the tutorial still work ? As I am having difficulties following it to set up the hive integration, or to be more exact getting error messages, that i am not sure where they are coming from such as when I run in a browser I get {“error”:{“reason”:“NOT_AUTHORIZED”}} that returned. Regards Steve

Hi Steve,

As you need a session id from the site its not sufficient to just enter into your browser. I get exactly the same.
The scripts seem to do the correct handshaking to log you on and get at the data (I think it’s the ‘curl’ statements) using the credentials entered in hive.config.
Have you entered your hive logon details into the hive.config file ?
If you have you need to get to /etc/openhab2/scripts and run (this on a rpi 3 running Raspian)

This should create a file called nodes.jsn and scroll some stuff on the screen which is useful.
You can view the file using vs code, or I rename it nodes.json and load it in Waterfox for a clickable list of all the nodes and then try and pick out the node ID’s you need and enter them in the hive.config.

I set this up a year ago when running -getIDs gave you a nice list of all the nodes, and the temperatures side of it worked straight away.

Unfortunately I know next to nothing about shell scripting so had a tortuous time setting up my plugs as they where not included in the original tutorial. I don’t have any bulbs which were included in the tutorial and scripts and commented out a fair bit of the script.
It is definitely more difficult now that BG have changed the layout of the data, though everything still seems to work.

I have limited time, but I would like to understand how to get the -getIDs option working again though it is slightly academic as I do now know all my node ID’s !
By the way, there are options in hive.config

These will give you a much more detailed output to the screen and a file if you set them true, although I did have some sort of permission error outputting to hive-debug the first time I tried it and had to create an empty file and chmod 666 it.

Let me know how you get on.