Closed lawrie closed 8 years ago
HI thanks for letting me know. It looks like there has been a change to the API response, I suspect this happened back when they released the new thermostat.
Specifically the problem is with the call to - https://api.bgchlivehome.co.uk/v5/users/:username/hubs/:hubid/devices which should return a list of devices on the system, there would only be one device the thermostat. They're about to launch a range of new devices shortly so It looks like they have switched to a new api to support this. This code was based on the old "alert me" api. Hopefully they'll publish a new api one day until then there isn't much I can currently do unfortunately.
Does this mean your node.js API has stopped working for everyone?
Morning. I have installed homebridge and have got wemo working. Is this simple enough for a noob to get up and running on my pi ? If so can someone help me please. Cheers Gary
Took a look at this last night and it looks like that endpoint now returns an object instead of an array where the keys of the object are the device IDs.
I'll have a go at fixing it when I get time.
I changed hubs.js line 36 from: HAHVACThermostatSLR2:{ to: HAHVACThermostat:{
and the examples are now working for me.
Is it possible for a learner like me to get this working in Homebridge ? Cheers. Gary
Hi lawrie, thanks for investigating. It looks like I was mistaken about the api change. I think there may have been a network outage... again, which was why I wasn't receiving a response. I've done some testing and everything appears to be working fine... at least for me, however thanks to your efforts it looks like the hive receiver type isn't labelled consistently for everyone, I'm not sure if you have an older receiver model, regardless using the model name isn't going to work for everyone. A more robust solution may be to use the receiver name which is user configurable via your account screen / settings / manage your devices and connect as follows :-
var hive = new Hive("<
I'll put in some time to see if I can implement this over the weekend.
surfshag, Whilst it would be possible to use this api as the foundation for a plug-in which will work with HomeBridge you'd have to be able to write the additional plug in code to make it work with Homebridge. I know someone who has done this but I don't know if they released the code. So the tldr answer is no this won't work out of the box but if you're happy to learn node.js then you should be able to hack something together.
Hi aklambeth, Thanks for that. I only got the Hive a few weeks ago, so I suspect mine is newer rather than older. I have just been experimenting with your node-red package. Did you ever get it working? It looks like it is not quite complete, but is nearly working. Lawrie
I have the node-red heating control node ("hive heating") working now. After installing node-red-contrib-hive, I had to delete node_modules, as the version of this API was out of date, copy across the icons directory, which was missing, and edit package.json to add the heating control node to the node-red section.
I've created a v1.0.4 development branch which should resolve the issue with different thermostat device names please let me know how it goes and I'll re-integrate the change into master. I did get the node-red package working but didn't get it to a point of a full release as it was a bit rough and undocumented but it was a good learning exercise on creating node-red packages and enabled me to test connection handling, making sure the connection didn't get closed before all the tasks had completed. From the sounds of it once I merge back up into trunk and release 1.0.4 changing the dependencies section in the node-red package.json file to to "bg-hive-api":"1.0.x" should get it working.
The new version worked for me - thanks. The node-red package should work when you change the dependency, but I am not sure why you did not include the three nodes (HeatingControl, HotWaterControl, Temperature) in the node-red section of the package.json file. I had to add them so that they appeared in the palette. I only got HeatingControl.js working. I do not need hot water control, and the Temperature.js node gave an exception when I tried to use it, but I did not investigate as I was only really interested in the heating control node.
Hi - I did leave information as Issues against your nodered nodes github. I work with the NodeRed creators - they spotted the package problem for me. I'd like to get this fully working with NodeRed as I can then retire my python app. The are some forums with the apis being discussed here: http://britishgashive.freeforums.org/app-development-and-hive-internals-f6.html
Hi, I've taken another look at the node-red package and updated the package.json as well as implemented some fixes in bg-hive-api to get around some breaking changes that occurred in api. The node-red implementation was largely experimental and totally undocumented but there are quite a few people who would find it useful so I've implemented a fix. In short to control the heating inject a string value into the Heating Controller. Values can be "OFF", "MANUAL", "SCHEDULE", "OVERRIDE" or a number to set the target temperature. Connect the top output to a debug to view the response. The hot water controller is currently still borked due to a change in the async library but it should be able to take a string with the value "ON" or "OFF". I'll look into this next week.
Just looked into the hot water controller issue it looks like the valid string values are in-fact "SCHEDULE", "MANUAL", "BOOST". The api library just isn't handling the error response.
Thanks for that. I have been using the node-red heating control successfully for a while now, mainly to set the target temperature.
thanks for this. Previously, I did notice with the heating controller that it would crash my NodeRed after a while (1hr or more) ( I was just injecting a timestamp to read the current status - maybe that was causing the crash?. How do I get the status without changing anything?) and that Temperature and Water nodes would instantly crash on input. I will try them again! (Water still crashes for me with input ON/OFF or timestamp)
Also, I have been using the top output for debug and controlling other flows (mainly putting data onto MQTT) - what do the other two outputs do? I haven't spotted any data coming out of them.
Hello, can I ask a (hopefully quick!) question, as an utter novice wondering if I need to learn about using node red please?
I've bought a second hand hive 2 thermostat (only) as I'm interested in certain design aspects of it for a masters project I'm doing.
I hoped that I would be able to play with its interfafe without buying the full hive kit as I don't actually want to install it for my heating.
However I've found out that the only thing I can get on the display without buying the hub is the 'searching' timer as it looks for a connection. Would red node (or something else?) help me get past this to access the menu options without them being connected up to anything official? Or am I snookered without the hub and full fitting to connect with boiler etc?
Many thanks
Hi Sorry about the delay in response. Unfortunately I can't really help you much as the Hive thermostat uses a proprietary protocol (based on zigbee) to communicate. This library and by extension the node red modules communicate with a back end server in the same way as the mobile app. This server then sends commands to the hub to control the heating system and other connected devices. Therefore without this hub and associated account provided with the full kit you won't be able to learn much. It's a shame British gas decided to go for a closed walled garden ecosystem instead of the more open approach google has taken with their Nest system. We wont be seeing any official third party support, I believe a more productive approach would be to analyse the packets their back end server is sending to the hub and implementing a mapping layer between an open home automation api like google Weave and the hive hub.
When running the connection example code, I get:
/home/pi/hive/node_modules/bg-hive-api/hubs.js:53 connection.context.hubs[0].devices = GetDevices(deviceId[0].id); ^ TypeError: Cannot read property 'id' of undefined at Object.callback (/home/pi/hive/node_modules/bg-hive-api/hubs.js:53:76) at next (/home/pi/hive/node_modules/bg-hive-api/node_modules/async/lib/async.js:801:43) at /home/pi/hive/node_modules/bg-hive-api/node_modules/async/lib/async.js:32:16 at Request._callback (/home/pi/hive/node_modules/bg-hive-api/Connection.js:63:9) at Request.self.callback (/home/pi/hive/node_modules/bg-hive-api/node_modules/request/request.js:373:22) at Request.emit (events.js:110:17) at Request. (/home/pi/hive/node_modules/bg-hive-api/node_modules/request/request.js:1318:14)
at Request.emit (events.js:129:20)
at IncomingMessage. (/home/pi/hive/node_modules/bg-hive-api/node_modules/request/request.js:1266:12)
at IncomingMessage.emit (events.js:129:20)
Am I doing something wrong, or has the API changed?