Hive Integration

It looks like Hive have introduced a SSO system and no longer use the /login call to get a token.
Looks like this integration will need work if possible to integrate with hive sso

iā€™ll take a quick look now, see if there is anything obvious

3 Likes

its not looking good.
I dont think it will be a simple thing to fix.
as MagicalTrev89 said, it looks like they have switched the authentication method to include SSO, so the old authentication method no longer works.

I am not sure I fully understand it, but it looks like the authentication destination is different, plus the password is encrypted before sending. After that it all looks to be pretty much the same.

It will need someone much more knowledgeable in this new authentication method than me to fix this unfortunately

If it canā€™t be fixed has anyone tried Hive via Alexa or Google Home? I already control my garage door via SmartThings as there was no native HA integration and it works a treat.

Thanks for having a look at this. :slight_smile:

Once again its kinda poor that Hive made this change and yet another company that couldnā€™t care less about opensource :frowning:

Iā€™m assuming this will break the default Hive integration from HA also right? Wondering if we could get some help from someone from the core? Just an idea, I would love to help, but this way of my expertise, sorryā€¦

Yes it will impact the default hive integration (the custom component just replaces the sensors entities with more sensors that were not allowed in the core hive platform)

Tried to use Alexa through node red to control it but that doesnt seem to be working either. I guess their skill has broken too.

Actually it does look like its still working just takes a few minutes to update, might be able to use that as a work around.

So hopefully just a matter of figuring out the auth methodā€¦

1 Like

Hi, Iā€™m no expert but I have been boosting my hive heating via sh script for a while now and when I noticed that hive integration no longer worked this morning I realised my boost script did still work. I then have just tweaked the url Iā€™m posting to turn on my hive light and it worked. Iā€™ll post as much as I can and answer any questions. Hope it helpsā€¦

#!/bin/bash
INSTANCE_REGION="$(curl -H ā€˜Host: beekeeper.hivehome.comā€™ -H ā€˜Content-Type: application/jsonā€™ -H ā€˜Accept: /ā€™ -H ā€˜User-Agent: HiveRNApp/10.16.2 Mozilla/5.0 (iPhone; CPU iPhone OS 13_1_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148ā€™ -H ā€˜Accept-Language: en-gbā€™ --data-binary ā€˜{ā€œusernameā€:ā€œmyemailā€,ā€œpasswordā€:ā€œmypasswordā€,ā€œdevicesā€:true,ā€œproductsā€:true,ā€œactionsā€:true,ā€œhomesā€:true}ā€™ --compressed ā€˜https://beekeeper.hivehome.com/1.0/cognito/loginā€™ | python -c ā€œimport sys, json; print json.load(sys.stdin)[ā€˜tokenā€™]ā€)"
echo $INSTANCE_REGION
curl -H ā€˜Host: beekeeper-uk.hivehome.comā€™ -H ā€˜accept: /ā€™ -H ā€˜content-type: application/jsonā€™ -H ā€˜accept-language: en-gbā€™ -H ā€˜user-agent: HiveRNApp/10.16.2 Mozilla/5.0 (iPhone; CPU iPhone OS 13_1_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148ā€™ -H ā€œauthorization: ${INSTANCE_REGION}ā€ --data-binary ā€˜{ā€œstatusā€: ā€œONā€}ā€™ --compressed ā€˜https://beekeeper-uk.hivehome.com/1.0/nodes/colourtuneablelight/709cc3e4-0b04-4cc4-8e26-b15ec455766f?homeId=myhomeidā€™

1 Like

Interesting, @bradderzā€¦ you are using cognito and the pyhiveapi currently uses global
Iā€™ve just changed my version of pyhiveapi to see if it works ā€¦

@bradderz @rendili
Fix to get this working is to change the following in pyhiveapi:

 HIVE_API.urls.global_login = "https://beekeeper.hivehome.com/1.0/global/login"

Change the above to:

 HIVE_API.urls.global_login = "https://beekeeper.hivehome.com/1.0/cognito/login"

I can confirm this gets the HA Hive integration going again, so we just need this change made in pyhiveapi

1 Like

Nice one guys, I will test on my system later tonight then release a new pyhiveapi version with the change. Will need to then create a PR with the updated version, this could take a while.

1 Like

Iā€™ve changed the url to incognito in my version of pyhiveapi.py in my custom_components folder and also installed pyhiveapi via pip3 and changed the url in that file in site-packages but still donā€™t get my hive devices. Any advice what I might be doing wrong please?

@bradderz As a hack on mine ā€¦ i have edited the init.py file within custom_components/hive

ā€œā€ā€œfrom pyhiveapi import Pyhiveapiā€"" ---- Original line
from .pyhiveapi import Pyhiveapi

I have a copy of the pyhiveapi file in the custom_components/hive directory
The copy of the pyhiveapi file has the changes i mentioned in previous post for the url with cognito in.

Once you have made the changes remember to restart hass to reload the integrationsā€¦ lovelace now showing the climate devices

1 Like

Hi. I did exactly the same thing but whenever I restart HA I get a text from Hive with a verification code and still nothing works. Suggests some sort of 2FA in play?

hmm, possibly i havenā€™t got any 2fa on my account (didnā€™t know you could). Not sure what to suggest :no_mouth:

I tried to enable Hive 2FA a while back and it broke HA integration so I needed to disable it again. Iā€™ve now got Hive and HA working again - I just had to rename the folder to pyhiveapi rather than pyhive in custom_component folder.

Yep, I had 2FA enabled on my account. Disabled through the Hive app, restarted HA and all works! Thanks all. Now just need to wait for the ā€œofficialā€ fix.