Read British Gas Hive Heating temperature

In this subforum you can show projects you have made, or you are busy with. Please create your own topic.
roadsnail
Posts: 20
Joined: Wednesday 08 November 2017 21:42
Target OS: Raspberry Pi
Domoticz version: 3.8922
Location: The awesome county of Suffolk, UK
Contact:

Re: Read British Gas Hive Heating temperature

Post by roadsnail » Wednesday 28 March 2018 10:53

@Jem101

I have also seen the 'NameError' problem on and off. Sometimes after many minutes or hours, the errors go away, however continuous errors have required a plugin restart. I doubt BG have fundamentally changed the API, as I would guess the plugin polling method would be permanently broken if that was the case. Like yourself, I wondered if the issue is down to the polling interval. I mostly use a polling interval of 2 (20 secs) as it seems more reliable (in terms of 'NameError' issues) than 10 secs.

I have noticed that I frequently get issues with the Hive Android App showing my devices being offline. So I wonder about the resilience of either the App or the whole Hive 'back end' system!

As for the light issue. I have only two hive dimmable lamps in my house, and have not experienced any issues with the current version of the plugin. How many lamps have you got? What types? Mine are just the dimmable white, NOT the dimmable colour temp version.
_______________________________________________________________________________________________
Pi3, Z-Wave: no-name sigma dongle, Danfoss Z-trv's, aeotec hem, d-link siren, heiman door contacts. Hive heating ctrl, esp8266 based sensors, hue hub +Ikea

johnnyutah
Posts: 5
Joined: Wednesday 28 March 2018 16:46
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Read British Gas Hive Heating temperature

Post by johnnyutah » Wednesday 28 March 2018 16:54

peteralm wrote:
Saturday 17 March 2018 14:44
Hi,

Loving being able to link hive again! Thanks!

I notice that I am getting the following in my log and my domoticz crashes after a couple of hours. I have updated the beta in the last day and that might help... But I wonder what is going on here?

2018-03-17 12:39:09.713 Error: (British Gas Hive): Async Read Exception: 335544539, short read

Peter
2018-03-28 15:33:45.452 Error: (Hive) Transport is not connected, write directive to 'Hive Devices' ignored.
2018-03-28 15:33:46.128 Error: (Hive): Async Read Exception: 335544539, short read
2018-03-28 15:33:49.534 Error: (Hive): Async Read Exception: 335544539, short read

Also getting this Async error. On Beta version 3.9117 and using the new.plugin.py from GitHub. After this the log gets FILLED with....

PluginSystem: Restarting I/O service thread.

Jem101
Posts: 95
Joined: Saturday 02 May 2015 21:26
Target OS: Raspberry Pi
Domoticz version: Beta
Location: Bexleyheath, SE London, UK
Contact:

Re: Read British Gas Hive Heating temperature

Post by Jem101 » Thursday 29 March 2018 22:21

@roadsnail

I have three Hive bulbs, just the dimmable white ones same as you and there is just one which seems particularly susceptible to going offline for no obvious reason.

Having said that, it appears to have behaved itself for the past week or so, so possibly it was just 'one of those things!'

I concur entirely with your observations that the errors seem to fix themselves if left alone, (mostly) and that it's unlikely to be an api issue otherwise it's more than likely to stop working entirely, I've also found that setting the polling interval to 20 sec does seem to have improved matters somewhat.
I firmly believe in having an open mind - although not so open that your brain falls out!

- sometimes attributed to Carl Sagan, but the original quote is much older than that

roadsnail
Posts: 20
Joined: Wednesday 08 November 2017 21:42
Target OS: Raspberry Pi
Domoticz version: 3.8922
Location: The awesome county of Suffolk, UK
Contact:

Re: Read British Gas Hive Heating temperature

Post by roadsnail » Friday 30 March 2018 0:13

Jem101 wrote:
Thursday 29 March 2018 22:21
@roadsnail

I have three Hive bulbs, just the dimmable white ones same as you and there is just one which seems particularly susceptible to going offline for no obvious reason.

Having said that, it appears to have behaved itself for the past week or so, so possibly it was just 'one of those things!'

I concur entirely with your observations that the errors seem to fix themselves if left alone, (mostly) and that it's unlikely to be an api issue otherwise it's more than likely to stop working entirely, I've also found that setting the polling interval to 20 sec does seem to have improved matters somewhat.
With regard to polling intervals. Checking out other home automation platforms, I noticed that Home Assistant's Hive polling interval is in units of 1 minute AND defaults to two minutes!

As an experiment, I'm going to try a polling interval factor of 6 (60 seconds) for a few days and see how things go. I can live with the longer reporting delay when my hive devices change state.


UPDATE: 68 hours have passed with plugin polling interval set to 6 (60 secs) and only 6 occurrences of NameError have occurred. Each time the plugin recovered on the subsequent poll without being restarted.
_______________________________________________________________________________________________
Pi3, Z-Wave: no-name sigma dongle, Danfoss Z-trv's, aeotec hem, d-link siren, heiman door contacts. Hive heating ctrl, esp8266 based sensors, hue hub +Ikea

roadsnail
Posts: 20
Joined: Wednesday 08 November 2017 21:42
Target OS: Raspberry Pi
Domoticz version: 3.8922
Location: The awesome county of Suffolk, UK
Contact:

Re: Read British Gas Hive Heating temperature

Post by roadsnail » Sunday 01 April 2018 20:11

@johnnyutah & peteralm

Sorry, cannot comment or add any value on the errors you are seeing with using new.plugin.py

I am running the 'standard' plugin.py (from Iaian's github repo) on V3.9133 on Raspbian Stretch on a Pi3 and seeing the odd 'NameError' as mentioned above.
_______________________________________________________________________________________________
Pi3, Z-Wave: no-name sigma dongle, Danfoss Z-trv's, aeotec hem, d-link siren, heiman door contacts. Hive heating ctrl, esp8266 based sensors, hue hub +Ikea

johnnyutah
Posts: 5
Joined: Wednesday 28 March 2018 16:46
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Read British Gas Hive Heating temperature

Post by johnnyutah » Sunday 01 April 2018 21:18

roadsnail wrote:
Sunday 01 April 2018 20:11
@johnnyutah & peteralm

Sorry, cannot comment or add any value on the errors you are seeing with using new.plugin.py

I am running the 'standard' plugin.py (from Iaian's github repo) on V3.9133 on Raspbian Stretch on a Pi3 and seeing the odd 'NameError' as mentioned above.
Appreciate the response. To be honest I was having a few problems with reliability on Raspbian Stretch so i decided to start a fresh image with Jessie and the ‘old’ Hive plugin. It’s been solid since then.

johnnyutah
Posts: 5
Joined: Wednesday 28 March 2018 16:46
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Read British Gas Hive Heating temperature

Post by johnnyutah » Tuesday 24 April 2018 21:40

2018-04-24 20:33:22.500 Error: (Hive) 'onHeartbeat' failed 'NameError'.
2018-04-24 20:33:22.500 Error: (Hive) ----> Line 592 in /home/pi/domoticz/plugins/Hive/plugin.py, function onHeartbeat
2018-04-24 20:33:22.500 Error: (Hive) ----> Line 139 in /home/pi/domoticz/plugins/Hive/plugin.py, function onHeartbeat
2018-04-24 20:33:22.500 Error: (Hive) ----> Line 382 in /home/pi/domoticz/plugins/Hive/plugin.py, function GetDevices
2018-04-24 20:33:52.584 Error: (Hive) 'onHeartbeat' failed 'NameError'.
2018-04-24 20:33:52.584 Error: (Hive) ----> Line 592 in /home/pi/domoticz/plugins/Hive/plugin.py, function onHeartbeat
2018-04-24 20:33:52.584 Error: (Hive) ----> Line 139 in /home/pi/domoticz/plugins/Hive/plugin.py, function onHeartbeat
2018-04-24 20:33:52.585 Error: (Hive) ----> Line 382 in /home/pi/domoticz/plugins/Hive/plugin.py, function GetDevices


Not sure what’s changed in the last week but the NameError problems have made it unusable for me. Having to restart the plugin every evening at the moment.

Anyone else noticed an increase in these errors?

mark.sellwood
Posts: 55
Joined: Tuesday 04 March 2014 11:33
Target OS: Raspberry Pi
Domoticz version:
Location: Surrey, UK
Contact:

Re: Read British Gas Hive Heating temperature

Post by mark.sellwood » Sunday 29 April 2018 9:58

I get the same errors, sometimes once or twice a day, sometimes the log is full of them.
I've also had the Domoticz web interface become unresponsive and had to restart the service.
I've turned on Debug in the plugin but that doesnt show anything additional.
3 x Pi, 1 Master, 2 Slaves, 1x Aeotec Z-Stick S2, 4xSP103 PIR, 5xPowerNode 1, 1xSmart Energy Switch Gen5, 4xFGSS101 Smoke Sensor, 2xFGD212, 9xFGS212 , 7xFGS221/2, 1xAD142 , 1xTKB TZ68E , 2xAeotec Multi Sensor, 3 x NodOn CRC-3-1-00.

imcfarla
Posts: 51
Joined: Monday 04 December 2017 14:18
Target OS: Linux
Domoticz version:
Contact:

Re: Read British Gas Hive Heating temperature

Post by imcfarla » Monday 30 April 2018 0:02

I have updated the plugin.py in git to hopefully stop the "NameError" log entries.

Please can you all check this and see what happens now?

johnnyutah
Posts: 5
Joined: Wednesday 28 March 2018 16:46
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Read British Gas Hive Heating temperature

Post by johnnyutah » Monday 30 April 2018 17:52

imcfarla wrote:
Monday 30 April 2018 0:02
I have updated the plugin.py in git to hopefully stop the "NameError" log entries.

Please can you all check this and see what happens now?
Hi,

tried the new plugin.py a few hours ago and now have these errors in the log...

2018-04-30 16:36:11.344 Error: (Hive) 'onHeartbeat' failed 'HTTPError'.
2018-04-30 16:36:11.345 Error: (Hive) ----> Line 593 in /home/pi/domoticz/plugins/Hive/plugin.py, function onHeartbeat
2018-04-30 16:36:11.345 Error: (Hive) ----> Line 140 in /home/pi/domoticz/plugins/Hive/plugin.py, function onHeartbeat
2018-04-30 16:36:11.345 Error: (Hive) ----> Line 389 in /home/pi/domoticz/plugins/Hive/plugin.py, function GetDevices
2018-04-30 16:36:11.345 Error: (Hive) ----> Line 153 in /usr/lib/python3.4/urllib/request.py, function urlopen
2018-04-30 16:36:11.346 Error: (Hive) ----> Line 461 in /usr/lib/python3.4/urllib/request.py, function open
2018-04-30 16:36:11.346 Error: (Hive) ----> Line 571 in /usr/lib/python3.4/urllib/request.py, function http_response
2018-04-30 16:36:11.346 Error: (Hive) ----> Line 499 in /usr/lib/python3.4/urllib/request.py, function error
2018-04-30 16:36:11.346 Error: (Hive) ----> Line 433 in /usr/lib/python3.4/urllib/request.py, function _call_chain
2018-04-30 16:36:11.346 Error: (Hive) ----> Line 579 in /usr/lib/python3.4/urllib/request.py, function http_error_default

This does seemed to have cleared itself though, in the previous version the errors would fill the log for hours...

Thanks for your help with this!

mark.sellwood
Posts: 55
Joined: Tuesday 04 March 2014 11:33
Target OS: Raspberry Pi
Domoticz version:
Location: Surrey, UK
Contact:

Re: Read British Gas Hive Heating temperature

Post by mark.sellwood » Monday 30 April 2018 18:02

I'm seeing they same, they come & go, 8 times in 9 hours, I had 2 batches of 4.
Interesting my last lot are very close to the ones above.
2018-04-30 16:36:03.366 Error: (Hive) 'onHeartbeat' failed 'HTTPError'.
2018-04-30 16:36:03.366 Error: (Hive) ----> Line 593 in /home/pi/domoticz/plugins/HivePlug/plugin.py, function onHeartbeat
2018-04-30 16:36:03.366 Error: (Hive) ----> Line 140 in /home/pi/domoticz/plugins/HivePlug/plugin.py, function onHeartbeat
2018-04-30 16:36:03.367 Error: (Hive) ----> Line 389 in /home/pi/domoticz/plugins/HivePlug/plugin.py, function GetDevices
2018-04-30 16:36:03.367 Error: (Hive) ----> Line 161 in /usr/lib/python3.4/urllib/request.py, function urlopen
2018-04-30 16:36:03.367 Error: (Hive) ----> Line 470 in /usr/lib/python3.4/urllib/request.py, function open
2018-04-30 16:36:03.367 Error: (Hive) ----> Line 580 in /usr/lib/python3.4/urllib/request.py, function http_response
2018-04-30 16:36:03.367 Error: (Hive) ----> Line 508 in /usr/lib/python3.4/urllib/request.py, function error
2018-04-30 16:36:03.367 E rror: (Hive) ----> Line 442 in /usr/lib/python3.4/urllib/request.py, function _call_chain
2018-04-30 16:36:03.367 Error: (Hive) ----> Line 588 in /usr/lib/python3.4/urllib/request.py, function http_error_default

Maybe its the Hive server?

Below is the timing of my errors (note I have only listed the 'onHeartbeat' failed 'HTTPError'.) they are all followed by the same 9 lines.
2018-04-30 11:17:40.331 Error: (Hive) 'onHeartbeat' failed 'HTTPError'.
2018-04-30 11:17:49.775 Error: (Hive) 'onHeartbeat' failed 'HTTPError'.
2018-04-30 11:17:59.696 Error: (Hive) 'onHeartbeat' failed 'HTTPError'.
2018-04-30 11:18:09.795 Error: (Hive) 'onHeartbeat' failed 'HTTPError'.
2018-04-30 16:35:33.543 Error: (Hive) 'onHeartbeat' failed 'HTTPError'.
2018-04-30 16:35:44.678 Error: (Hive) 'onHeartbeat' failed 'HTTPError'.
2018-04-30 16:35:59.165 Error: (Hive) 'onHeartbeat' failed 'HTTPError'.
2018-04-30 16:36:03.366 Error: (Hive) 'onHeartbeat' failed 'HTTPError'.
3 x Pi, 1 Master, 2 Slaves, 1x Aeotec Z-Stick S2, 4xSP103 PIR, 5xPowerNode 1, 1xSmart Energy Switch Gen5, 4xFGSS101 Smoke Sensor, 2xFGD212, 9xFGS212 , 7xFGS221/2, 1xAD142 , 1xTKB TZ68E , 2xAeotec Multi Sensor, 3 x NodOn CRC-3-1-00.

dgilbert2
Posts: 53
Joined: Wednesday 16 August 2017 8:08
Target OS: Raspberry Pi
Domoticz version: 4.9728
Location: UK
Contact:

Re: Read British Gas Hive Heating temperature

Post by dgilbert2 » Friday 11 May 2018 19:42

I've ended up staying with the original script but getting errors tonight which start with "KeyError: 'token' "

Either the API has changed or is down? The official hive app is working though. Any ideas, it seems a bigger issue than incorrect node number this time?

dgilbert2
Posts: 53
Joined: Wednesday 16 August 2017 8:08
Target OS: Raspberry Pi
Domoticz version: 4.9728
Location: UK
Contact:

Re: Read British Gas Hive Heating temperature

Post by dgilbert2 » Friday 11 May 2018 22:43

It looks like I cannot get past the API login stage after working for months. I've copied the code below for reference but it looks like the API has changed? Does the newer script from the GitHub still work?

#!/bin/bash
# Sends current and target temperatures to Domoticz

cd "${0%/*}"

login=$(curl -s -k -g -H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{"username":"xxx@xxx.xxx","password":"xxxxxx"}' \
https://beekeeper.hivehome.com/1.0/gateway/login)

sessionId=$(echo $login | python -c 'import sys, json; print json.load(sys.stdin)["token"]')

johnnyutah
Posts: 5
Joined: Wednesday 28 March 2018 16:46
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Read British Gas Hive Heating temperature

Post by johnnyutah » Saturday 12 May 2018 0:05

2018-05-11 23:00:05.435 Error: (Hive) 'onStart' failed 'HTTPError'.
2018-05-11 23:00:05.435 Error: (Hive) ----> Line 572 in /home/pi/domoticz/plugins/Hive/plugin.py, function onStart
2018-05-11 23:00:05.435 Error: (Hive) ----> Line 51 in /home/pi/domoticz/plugins/Hive/plugin.py, function onStart
2018-05-11 23:00:05.436 Error: (Hive) ----> Line 348 in /home/pi/domoticz/plugins/Hive/plugin.py, function GetSessionID
2018-05-11 23:00:05.436 Error: (Hive) ----> Line 153 in /usr/lib/python3.4/urllib/request.py, function urlopen
2018-05-11 23:00:05.436 Error: (Hive) ----> Line 461 in /usr/lib/python3.4/urllib/request.py, function open
2018-05-11 23:00:05.436 Error: (Hive) ----> Line 571 in /usr/lib/python3.4/urllib/request.py, function http_response
2018-05-11 23:00:05.436 Error: (Hive) ----> Line 499 in /usr/lib/python3.4/urllib/request.py, function error
2018-05-11 23:00:05.437 Error: (Hive) ----> Line 433 in /usr/lib/python3.4/urllib/request.py, function _call_chain
2018-05-11 23:00:05.437 Error: (Hive) ----> Line 579 in /usr/lib/python3.4/urllib/request.py, function http_error_default

also having problems today. It's been working well with the (new) version of the old plugin.py too.

dgilbert2
Posts: 53
Joined: Wednesday 16 August 2017 8:08
Target OS: Raspberry Pi
Domoticz version: 4.9728
Location: UK
Contact:

Re: Read British Gas Hive Heating temperature

Post by dgilbert2 » Saturday 12 May 2018 6:44

Oh dear, its starting to look like both the older and newer scripts have now stopped working :-( ???

From what I can tell its the Hive API login that's failing. Fingers crossed that @imcfarla / @MikeF can find a way to resolve this.

I also hope that Hive has NOT started to block us Domoticz users?!

roadsnail
Posts: 20
Joined: Wednesday 08 November 2017 21:42
Target OS: Raspberry Pi
Domoticz version: 3.8922
Location: The awesome county of Suffolk, UK
Contact:

Re: Read British Gas Hive Heating temperature

Post by roadsnail » Sunday 13 May 2018 15:28

imcfarla's latest update to plugin.py (version 0.5.1 Dev found at https://github.com/imcfarla2003/domoticz-hive ) is working pretty well for me.

Have had the occasional 'HTTPError' error burst (as I call it), as reported by johnnyutah two posts above, but the plugin always recovers after one iteration of these: unlike the previous version before Iain improved exception handling. Previously the plugin would fail with the 'NameError' problem mostly requiring a plugin restart in order to recover.

FWIW my heartbeat multiplier is set to 3 in my Hive plugin settings. I noticed that a setting of less than 3 seemed to cause more API login failures with the old plugin.py
_______________________________________________________________________________________________
Pi3, Z-Wave: no-name sigma dongle, Danfoss Z-trv's, aeotec hem, d-link siren, heiman door contacts. Hive heating ctrl, esp8266 based sensors, hue hub +Ikea

dgilbert2
Posts: 53
Joined: Wednesday 16 August 2017 8:08
Target OS: Raspberry Pi
Domoticz version: 4.9728
Location: UK
Contact:

Re: Read British Gas Hive Heating temperature

Post by dgilbert2 » Sunday 13 May 2018 19:19

I'm all rather lost :cry: as I still cannot get the original script to work anymore, ie I cannot get past the login/authorisation stage.

In the script below I have found another url for the login, this now produces a sessionId token again.

BUT, in the nodes part its generating {"errors":[{"code":"NOT_AUTHORIZED"}]}

I hope the experts can help me to resolve this please.

====================================================================

#!/bin/bash
# Sends current and target temperatures to Domoticz

cd "${0%/*}"

login=$(curl -s -k -g -H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{"username":"xxxx@xxxx.xxx","password":"xxxx"}' \
https://beekeeper-uk.hivehome.com/1.0/global/login)

sessionId=$(echo $login | python -c 'import sys, json; print json.load(sys.stdin)["token"]')

nodes=$(curl -s -k --cookie-jar cookie.jar -g -H "Content-Type: application/vnd.alertme.zoo-6.4+json" \
-H "Accept: application/vnd.alertme.zoo-6.4+json" -H "Content-Type: 'application/*+json'" \
-H "X-AlertMe-Client: swagger" -H 'X-Omnia-Access-Token: '"$sessionId" \
https://api.prod.bgchprod.info:443/omnia/nodes)

dgilbert2
Posts: 53
Joined: Wednesday 16 August 2017 8:08
Target OS: Raspberry Pi
Domoticz version: 4.9728
Location: UK
Contact:

Re: Read British Gas Hive Heating temperature

Post by dgilbert2 » Sunday 13 May 2018 22:03

FIXED!!!

The Login side of the script needs updating as below, which is actually Mike's older version, but it works!

(Only applicable if your still using MikeF's original V6 script.)

(Edit 15th May: changed both alertme's to 6.2 and removed duplicate Content-Type)

Code: Select all

login=$(curl  -s -k --cookie-jar cookie.jar -g -H "Content-Type: application/vnd.alertme.zoo-6.2+json" \
	-H "Accept: application/vnd.alertme.zoo-6.2+json" \
	-H "X-AlertMe-Client: Hive Web Dashboard" \
	-d '{"sessions":[{"username":"xxxx@xxxx.xxx", "password":"xxxx"}]}' \
	https://api.prod.bgchprod.info:443/omnia/auth/sessions)

sessionId=$(echo $login | python -c 'import sys, json; print json.load(sys.stdin)["sessions"][0]["sessionId"]')
Last edited by dgilbert2 on Tuesday 15 May 2018 13:31, edited 2 times in total.

imcfarla
Posts: 51
Joined: Monday 04 December 2017 14:18
Target OS: Linux
Domoticz version:
Contact:

Re: Read British Gas Hive Heating temperature

Post by imcfarla » Tuesday 15 May 2018 0:31

Cheers for that - i have updated the plugin in git to use the new session API

dgilbert2
Posts: 53
Joined: Wednesday 16 August 2017 8:08
Target OS: Raspberry Pi
Domoticz version: 4.9728
Location: UK
Contact:

Re: Read British Gas Hive Heating temperature

Post by dgilbert2 » Tuesday 15 May 2018 13:35

@imcfaria as a matter of interest, was your plugin code to get the sessionId still working before these changes?

Also, I have just edited the code in my post above to clean it up a bit (changed both alertme's to 6.2 and removed duplicate Content-Type). Still works though cleaned or not ;)

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest