Hive Thermostat (British Gas) Tutorial

It is actually a web front-end I put together to the evohome api, to help me edit evohome schedules more easily. This web page is then shown on an openHAB sitemap using webview in the usual way.

hoping someone can help.
i’m trying to follow this guide:

stuck on trying to execute the script. If i try running just i get
-bash: command not found.
running bash get line 7: syntax error near unexpected token newline'_ line 7:
google hasnt been much help, only thing i’ve found is it dosnt like !DOCTYPE.html but not found a way to resolve this.
any ideas?

It looks as if you have not downloaded the scripts as raw text files, but have downloaded them as html pages. Try saving the following link directly: and running this.

1 Like

Thanks, such a simple solution and Google let me down

You are most welcome.

Ok next problem. I cannot control Hive from openhab. If i put the temp up and hit boost nothing happens. reading data from hive works fine; so if i boost from hive and update OH it shows heating it boosted and target temp. Am i missing something simple here?

Sorry, I don’t think I can help you much on this one as it has been a very long time since I last looked at these scripts (I no longer have a Hive).

From memory, I can only suggest that you make sure your openHAB calls the correct script file for boosting or setting the temperature (setpoint). These are separate scripts which as I noted in my first post of the thread, worked when I first put them together but were not something I used much, and so could be broken. Also note that from a quick look now, I didn’t see those scripts in @robkenny’s github repo. If you were to use them from my repo, you may have to do a bit more work in terms of getting your hive config file set up (or it may all just work! :slight_smile: ).

i noticed those scripts werent there but assumed they had been intigrated into the 1 script by @robkenny
I’ll throw in your scripts and see what happens. Thanks

Hi not sure if this thread is still active, but here goes.

I tried running the ./ script but it only returned an error, see below

< HTTP/2 400
< date: Fri, 05 Oct 2018 19:22:05 GMT
< content-type: application/vnd.alertme.zoo-6.2+json;charset=UTF-8
< x-zoo-transaction-id: 4d73a602-fd54-4ab8-a314-9935a41c0d64
< access-control-allow-methods: GET, POST, DELETE, PUT, OPTIONS
< access-control-allow-credentials: true
< access-control-allow-headers: Content-Type, X-Omnia-Client, X-AlertMe-Client, X-Omnia-Access-Token, Authorization, X-Omnia-Client-User
< pragma: no-cache
< expires: Thu, 01 Jan 1970 00:00:00 GMT
< cache-control: no-cache
< cache-control: no-store
< server: Jetty(9.4.7.v20170914)
{ [42 bytes data]
* Curl_http_done: called premature == 0
100   120    0    42  100    78    122    228 --:--:-- --:--:-- --:--:--   228
* Connection #0 to host left intact
Session: { "error": { "reason": "Could not read json" } }
jq: error (at <stdin>:1): Cannot iterate over null (null)
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100    38  100    38    0     0    138      0 --:--:-- --:--:-- --:--:--   137

The only bones I could pick out was “Could not read json” any ideas ?


I’ve also had this same error.
In the nodes.jsn file is the following:

Sorry, I don’t use Hive anymore and so cannot really help. Error message says that your authorisation failed. That normally means userid/password issue. Failing this, British Gas may have updated something at their end, which would mean the scripts may be out of date.

I’ve created some software that uses the Hive API to give much more control over it. It was aimed at landlords but it also logs all of the temperature data to Excel for analysis so may be of some use to all sorts of people

Hi, not sure how active this thread is, but I’ve been playing with the beekeeper API to communicate with my Hive setup. Google hasn’t thrown up any other examples of beekeeper over here, so I’m hoping this will be of use to the community.

The attached script is what I’ve got so far.


if [ "$1" == "" ]

        LOGINRESP=$(curl -s -X POST \
                -H 'Content-Type: application/json' \
                -d '{
                        "username": "<username>",
                        "password": "<password>",
                        "products": true
        echo $(jq -r '.token' <<< "${LOGINRESP}") > /etc/openhab2/scripts/hive.token


        if [ "$2" == "" ]
                PRODRESP=$(curl -s \
                        -H "Authorization: ${TOKEN}" \

                case "$1" in
                        echo $(jq -r '.[0].props.temperature' <<< "${PRODRESP}");;
                        echo $(jq -r '.[0]' <<< "${PRODRESP}");;
                        if [ $(jq -r '.[0].props.working' <<< "${PRODRESP}") == true ]
                                echo "ON"
                                echo "OFF"
                        fi  ;;
                        echo $(jq -r '.[0].state.mode' <<< "${PRODRESP}");;


                curl -s -X POST \
              <thermostatID> \
                        -H 'Content-Type: application/json' \
                        -H "Authorization: ${TOKEN}" \
                        -d "{
                                ""$1"": ""$2""
                        }" >> /dev/null

  1. Replace the <username>,<password>,<thermostatID> placeholders with the values for your system - these will match the values from the other API I believe

  2. save to /etc/openhab2/scripts or somewhere sensible (but be aware there is a hardcoded reference to this directory to save the access token)

  3. Profit


Run on it’s own to get an auth token
Specify one of four variables temperature/target/working/mode to read that value from the cloud
Specify one of the above four variables and a vlue to set that value in the cloud (so “./ mode BOOST” activates boost)

I’ve not wired it into openhab itself yet, but I’m designing it to work with the 1.x EXEC binding (which I prefer to 2.x due to being able to use types other than string). The general idea being:

  1. On startup run it without arguments to log in to hive
  2. Bind it to Items to get/set hive values
  3. Unknown at this point, but possibly add a rule to periodically log into hive and get a new token. This may be needed if the token times out even if being used regularly.

Ultimately I’d love to write a proper Binding using what I’m learning here, but I’m not massively familiar with Java dev’t so that may be a while, so I’m quite happy if this inspires someone else to do so!

Also, I don’t have a hot water controller or any lights to develop against, so I’m hoping someone can pick this up and start running with it for you guys who do have those things!

Hi all have this topic “died a death” now, if so are there any other “Hive” implementations as I cannot get this one working

Patrick Did you ever get to the bottom of this

I initially had this issue however I then realised that I had not wrapped the username and password in quotation("") marks. As soon as I did this it worked.

As it happens I’ve been working on an actual binding for hive. It only supports the thermostat at the moment but i’ll be actively developing it. More info here: First try at a binding for Hive from British Gas

Hi. I noticed that the Hive connector stopped working on October 2nd. There’s a Home Assistant fix for the same issue described here.

Any chance anyone could explain how to make that fix to the OpenHab Binding?