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.
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 » Wednesday 14 February 2018 21:18

Have you built domoticz from scratch or downloaded the beta?

peteralm
Posts: 16
Joined: Saturday 08 August 2015 0:12
Target OS: Raspberry Pi
Domoticz version: beta
Location: Oxfordshire, UK
Contact:

Re: Read British Gas Hive Heating temperature

Post by peteralm » Wednesday 14 February 2018 21:31

I am running the ./updatebeta

but I also tried ./updaterelease

Both seemed to have the identical problem.

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 14 February 2018 22:50

imcfarla wrote:
Wednesday 31 January 2018 16:49
I have pushed the latest copy of the plugin into a git repository as requested

https://github.com/imcfarla2003/domoticz-hive

This includes the fixes supplied today
Firstly, thanks imcfarla and MikeF for all your hard work

I have downloaded the latest copy of plugin.py from your repository and it mostly worked first time! I am running beta 3.8922 and I have Hive CH/HW White bulbs and a Mains switch.

I noticed the plugin had not detected the hot water device, and the Domoticz error log reported an error... 'UnboundLocalError':'local variable 'foundHotWaterDevice' referenced before assignment

So I added the line
foundHotWaterDevice = False
at line 113 immediately after 4 other assignments - namely foundInsideDevice = False thru to foundThermostatDevice = False

The assignments now look like this;
foundInsideDevice = False
foundTargetDevice = False
foundHeatingDevice = False
foundThermostatDevice = False
foundHotWaterDevice = False




After restarting Domoticz, the error went away and the hot water switch appeared in devices. Also - my two Hive light bulb devices appeared in devices. Previously the bug referred to above caused the Hive lights to be missing.

I think I have added a correction in the correct place.. apologies if not ;)


ALSO

A bit of a heads up for anyone having an issue adding Hive to 'Setup' , 'Hardware' and they are seeing an error message relating to the plugin
not getting recognised at startup. The following error
PluginSystem: Failed dynamic library load, install the latest libpython3.x library that is available for your platform
appears in the Domoticz log.

I fixed error on my Rasp pi 3 , latest Raspian Stretch installation running V3.8922 by installing libpython3.4-dev ... So
sudo apt-get install libpython3.4-dev

Hope that helps anyone.
_______________________________________________________________________________________________
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 » Wednesday 14 February 2018 23:09

peteralm wrote:
Wednesday 14 February 2018 21:31
I am running the ./updatebeta

but I also tried ./updaterelease

Both seemed to have the identical problem.
Hi Peter, your issue appears similar to an issue someone else had with a plugin... the errors seem similar.
See viewtopic.php?f=65&t=16859#p125879

Maybe that will shed some light on your problem?
_______________________________________________________________________________________________
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

Jem101
Posts: 93
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 » Wednesday 14 February 2018 23:18

I just wanted to add to what roadsnall posted above, I was having no luck at all with this plugin with the beta versions of domoticz, even compiling from source didn't fix the issue, the Pi would crash with a rather blunt 'segmentation fault' error every time. Reverting to the stable release did work however.

What I did find though was that if I built a new sd-card using Raspbian Jessie instead of Stretch, then it did work perfectly even if I was running the beta releases. The difference, of course was that Jessie uses Python 3.4 whereas Stretch (which I was using before) was Python 3.5. I had this crash with a couple of python plugins so I don't think the issue is restricted to just this one though.

I tried removing python 3 from a fresh Stretch install and manually installing 3.4, and the plugins still work (admittedly I hadn't tried just installing the 3.4-dev package, but it certainly seems to be worth a shot), so it definitely seems that the domoticz python plugin system is a bit unstable with python 3.5 but OK with 3.4 - or at least for me.

What concerns me though is that if I do all this on a Stretch installation, will a subsequent apt-get upgrade put python 3.5 back on and break the system? So for now at least, until I've done some more testing, and I'm fortunate in having a spare Pi2 I can mess round with), I'm going to leave my 'production' system running Jessie. To date I've updated the beta version of domoticz about six or seven times, just using the pre-compiled packages, since first install and so far both the python plugins I use, have worked perfectly.

Longer term though, Raspbian Jessie is going to be depreciated in favour of Stretch, so I will need to upgrade it at some point - I need to do some more testing to make sure that it is stable and survives any routine updates.
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

peteralm
Posts: 16
Joined: Saturday 08 August 2015 0:12
Target OS: Raspberry Pi
Domoticz version: beta
Location: Oxfordshire, UK
Contact:

Re: Read British Gas Hive Heating temperature

Post by peteralm » Wednesday 14 February 2018 23:41

Ok,

My brain hurts!

I am also on Stretch and my Domoticz looks to load python3.5 as part of the plugins - the links suggested by roadsnail all seem to have the same problems with potentially different installs....
I'm going to give up for the night and have another look tomorrow

Peter

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 » Wednesday 14 February 2018 23:57

roadsnail - Thanks for the fix I have committed it to github now.

Can you run the collect_json.py script and send me the output - I would like to see what the mains switch looks like to get that working.

Anyone with some of the more complex bulbs fancy doing the same would be helpful.

Cheers

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 » Thursday 15 February 2018 0:47

FWIW here is a link to my latest build of domoticz:
https://drive.google.com/file/d/1RsBHIJ ... sp=sharing

It is built for armhf on an odroid xu3 running debian stretch - no openzwave and not sure how it will run in raspbian.

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 » Thursday 15 February 2018 12:14

imcfarla wrote:
Wednesday 14 February 2018 23:57
roadsnail - Thanks for the fix I have committed it to github now.

Can you run the collect_json.py script and send me the output - I would like to see what the mains switch looks like to get that working.

Anyone with some of the more complex bulbs fancy doing the same would be helpful.

Cheers
Hi imcfarla

Didn't spend much time on the collect_json.py script in the end.. your coding is really easy to read, so I just amended the GetActivePlugs function
in plugin.py (around about line number 354). It looks like you copy and pasted part of the GetLights function but didn't change a couple of lines. I changed lights = x to be activeplugs = x AND return plugs changed to return activeplugs. That did the trick!

Re-starting Domoticz causes my one active plug to show up in devices...(rssi reports correctly too in devices). Obviously you missed the bugs as you do not have an activeplug... Nice coding... thanks!

I do not have any fancy lamps, just the dimmable whites, so cannot help further.

Hope this helps :)


EDIT:
In my haste, didn't check that active plug can be switched (on/off) from Domoticz switch device. (Note my plug is named Bedside Light). Switching on/off with Domoticz switch causes an HTTP error in onCommand
The debug shows....
2018-02-15 11:15:40.479 User: Admin initiated a switch command (196/Hive - Bedside Light/Off)
2018-02-15 11:15:40.502 (Hive) Calling message handler 'onCommand'.
2018-02-15 11:15:40.502 (Hive) onCommand called for Unit 9: Parameter 'Off', Level: 0
2018-02-15 11:15:40.502 (Hive) 244
2018-02-15 11:15:40.502 (Hive) 73
2018-02-15 11:15:40.502 (Hive) 5e068cb3-8ede-4f0f-bcbc-0b123456789a
2018-02-15 11:15:40.502 (Hive) Off
2018-02-15 11:15:40.502 (Hive) {8, 7}
2018-02-15 11:15:40.734 (Hive) HTTP Error 400: Bad Request

2018-02-15 11:15:44.357 User: Admin initiated a switch command (196/Hive - Bedside Light/On)
2018-02-15 11:15:44.392 (Hive) Calling message handler 'onCommand'.
2018-02-15 11:15:44.392 (Hive) onCommand called for Unit 9: Parameter 'On', Level: 0
2018-02-15 11:15:44.392 (Hive) 244
2018-02-15 11:15:44.392 (Hive) 73
2018-02-15 11:15:44.392 (Hive) 5e068cb3-8ede-4f0f-bcbc-0b123456789a
2018-02-15 11:15:44.392 (Hive) Off
2018-02-15 11:15:44.392 (Hive) {8, 7}
2018-02-15 11:15:44.616 (Hive) HTTP Error 400: Bad Request
I will take a look at this if time allows. I am presuming that the smart plug off/on command is formatted incorrectly.. Note that as stated previously, smart plug status reporting appears to be working okay


LATEST EDIT:

Have fixed the smart plug switch bug, so now smart plugs report correct status and work properly as a Domoticz switch device.

imcfarla - FYI the modifications made are:

In def onCommand replace
elif self.isActivePlug(Unit):
payload = self.CreateActivePlugPayload(Level)
with
elif self.isActivePlug(Unit):
Domoticz.Log("Setting ActivePlug State")
if str(Command) == "On":
payload = self.CreateActivePlugPayload("ON")
if str (Command) == "Off":
payload = self.CreateActivePlugPayload("OFF")
(Indentation required - obviously).
Last edited by roadsnail on Thursday 15 February 2018 19:01, edited 1 time in total.
_______________________________________________________________________________________________
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 » Thursday 15 February 2018 15:37

peteralm wrote:
Wednesday 14 February 2018 23:41
Ok,

My brain hurts!

I am also on Stretch and my Domoticz looks to load python3.5 as part of the plugins - the links suggested by roadsnail all seem to have the same problems with potentially different installs....
I'm going to give up for the night and have another look tomorrow

Peter
Hope the brain recovered :lol:

It looks like you are correct with regard to Beta Domoticz/Plugins/Python Versions... see https://github.com/domoticz/domoticz/issues/2073
FWIW, My Raspberry Pi 3 setup is Raspbian Stretch Lite (downloaded some time ago, but updated regularlywith apt-get...)
Then I installed Domoticz (release version) using the easy 1 line install method, as user Pi
I seem to recall I then moved straight to the beta release by running updatebeta. I then went ahead and set up my Domoticz devices, z-wave, esp8266 blah blah over time. Only when I downloaded and tried to run the Hive plugin did I have a problem requiring installing libpython3.4-dev

Maybe that helps.. however looking at the issues thread it appears that there is something very odd going on with plugins/domoticz/python versions?

Maybe I have been lucky?
_______________________________________________________________________________________________
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

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 » Friday 16 February 2018 0:47

I've updated git - can you check that I have it right?

Cheers

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 16 February 2018 1:05

imcfarla wrote:
Friday 16 February 2018 0:47
I've updated git - can you check that I have it right?

Cheers
Just downloaded from your git, stopped then restarted Domoticz. All appears good, active plugs report status and switch okay. Thanks for that. Your plugin is really useful
_______________________________________________________________________________________________
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 » Friday 16 February 2018 18:55

I've been using the script from @MikeF since April 2017, thank you :)

Yesterday afternoon though it stopped updating the Temperature in Domoticz. It turns out that out of the blue the Node number changed from 8 to 9.

Got me going for a while but sorted now :)

peteralm
Posts: 16
Joined: Saturday 08 August 2015 0:12
Target OS: Raspberry Pi
Domoticz version: beta
Location: Oxfordshire, UK
Contact:

Re: Read British Gas Hive Heating temperature

Post by peteralm » Friday 16 February 2018 20:58

roadsnail wrote:
Thursday 15 February 2018 15:37
peteralm wrote:
Wednesday 14 February 2018 23:41
Ok,

My brain hurts!

I am also on Stretch and my Domoticz looks to load python3.5 as part of the plugins - the links suggested by roadsnail all seem to have the same problems with potentially different installs....
I'm going to give up for the night and have another look tomorrow

Peter
Hope the brain recovered :lol:

It looks like you are correct with regard to Beta Domoticz/Plugins/Python Versions... see https://github.com/domoticz/domoticz/issues/2073
FWIW, My Raspberry Pi 3 setup is Raspbian Stretch Lite (downloaded some time ago, but updated regularlywith apt-get...)
Then I installed Domoticz (release version) using the easy 1 line install method, as user Pi
I seem to recall I then moved straight to the beta release by running updatebeta. I then went ahead and set up my Domoticz devices, z-wave, esp8266 blah blah over time. Only when I downloaded and tried to run the Hive plugin did I have a problem requiring installing libpython3.4-dev

Maybe that helps.. however looking at the issues thread it appears that there is something very odd going on with plugins/domoticz/python versions?

Maybe I have been lucky?

It looks like it is making other, more clever, people's brains hurt, and the culprit seems to be urllib.request

viewtopic.php?f=6&t=22012

Peter

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 17 February 2018 1:33

dgilbert2 wrote:
Friday 16 February 2018 18:55
I've been using the script from @MikeF since April 2017, thank you :)

Yesterday afternoon though it stopped updating the Temperature in Domoticz. It turns out that out of the blue the Node number changed from 8 to 9.

Got me going for a while but sorted now :)
Stopped again :x Does anyone know what's happening?

So I'm trying the python script from @imcfarla now. Sorry for a basic question, is it possible to just download plugin.py ?

Have tried to copy the raw data into a blank file but Hive does not appear in the pull down after a reboot.

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 17 February 2018 9:50

I've made some progress.

1) The original script needed ANOTHER node change to 11 for the heating and now it works again. Its gone from 8 to 9 to 11 in the last couple of days after no changes at all since April 17. Something must be happening at the API end ??

2) For the "new" plugin.py I have downloaded it now and "Hive Plugin" appears in the hardware setup pull down list. However the only extra field that has appeared is "Data timeout" and nothing happens when I press ADD? I'm running Domoticz 3.8153 and Python version '3.5.3'.
Last edited by dgilbert2 on Saturday 17 February 2018 15:16, edited 1 time in total.

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 17 February 2018 10:32

More progress :-)

It turns out my problem with the ADD button and missing fields above is a Chrome issue! Used edge and then it worked :D

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 17 February 2018 19:15

Well I've managed to get the new Hive Python plugin working after some basic errors on my side. Devices appeared with the correct temperatures etc. :D I have learnt;

1) To download plugin.py just right click the RAW button in github and save link as...
3) Needed to run "sudo apt-get install libpython3.4-dev" to get the plugin system to work (on a Stretch PI3 running Domoticz 3.8153)
2) Not to use Chrome as is does not show all the fields when adding the Hive Plugin as new hardware.

Easy when you know :D

BUT, I quickly ran into the Domoticz crashes mentioned above probably to do with libpython issues with Stretch. Has anyone found a way around this as its currently not stable enough for me and I've had to disable the Hive plugin :(

Jem101
Posts: 93
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 » Saturday 17 February 2018 20:18

I honestly don't think that the current python plugin system is stable enough on Raspbian Stretch to be usable in a production system. After a great deal of messing about with various permutations, I've just kept my 'production' system on Raspbian Jessie and hence python 3.4 and the Hive plugin has been quite stable even running the beta version of domoticz.

Having said that, it did stop working abruptly on Thursday afternoon, not a crash but just a communication failure. Restarting the domoticz service fixed it so I'm thinking it's probably a similar issue to what you describe with the node number changing and the restart forced a refresh.
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

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 19 February 2018 0:17

I have tried switching to use the internal transport mechanism but it gives me an sslv3 handshake error when trying to talk to https://beekeeper-uk.hivehome.com which is required to create the sessionid.

Code: Select all

Error: Plugin: TLS Handshake Exception: 'handshake: sslv3 alert handshake failure' connecting to 'beekeeper-uk.hivehome.com:443'

running openssl s_client -connect beekeeper-uk.hivehome.com:443

Code: Select all

CONNECTED(00000003)
3069920192:error:14094410:SSL routines:ssl3_read_bytes:sslv3 alert handshake failure:../ssl/record/rec_layer_s3.c:1399:SSL alert number 40
---
no peer certificate available
---
No client certificate CA names sent
---
SSL handshake has read 7 bytes and written 176 bytes
Verification: OK
---
New, (NONE), Cipher is (NONE)
Secure Renegotiation IS NOT supported
Compression: NONE
Expansion: NONE
No ALPN negotiated
SSL-Session:
    Protocol  : TLSv1.2
    Cipher    : 0000
    Session-ID: 
    Session-ID-ctx: 
    Master-Key: 
    PSK identity: None
    PSK identity hint: None
    SRP username: None
    Start Time: 1518993932
    Timeout   : 7200 (sec)
    Verify return code: 0 (ok)
    Extended master secret: no
---

Any ideas?

Post Reply

Who is online

Users browsing this forum: No registered users and 6 guests