[OBSOLETE] - Hive (Connect) V3.2c (British Gas Hive)

It still the same for me. In Simulation I can see list of my devices but in app there is “Tap to refresh authenticaton”.

When you are in the app and tap the area that says ‘Tap to refresh Authentication’ make sure you have Live Logging open and let me know if you see any error messages that appear in there. Make sure that you don’t post any tokens in this public forum.

When I create the HiveToken file (step 10), the file is created but it is blank with no token string shown.
Any ideas what I’ve done wrong.

Any help is greatly appreciated.

You probably have 2 factor authentication enabled on your account. Turn it off in your Hive mobile app. Then generate tokens.

Thanks Alex but 2FA was already off.

When running ‘node index.js > HiveToken.json’
Even though it is creating the file, I am getting the following:

c:\Users\glenb\node_modules\amazon-user-pool-srp-client>node index.js > HiveTokens.json
const userPoolId = process.env.CognitoUserPoolUsers.split(’_’)[1]

TypeError: Cannot read property ‘split’ of undefined
at login (c:\Users\glenb\node_modules\amazon-user-pool-srp-client\index.js:144:55)
at Object. (c:\Users\glenb\node_modules\amazon-user-pool-srp-client\index.js:179:1)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
at Object.Module._extensions…js (internal/modules/cjs/loader.js:1092:10)
at Module.load (internal/modules/cjs/loader.js:928:32)
at Function.Module._load (internal/modules/cjs/loader.js:769:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
at internal/main/run_main_module.js:17:47

I see Andrew (post 353) had the same issue but resolved it with a reboot. But that did not work for me.

The environment variables in step 9 haven’t been defined properly. If using Windows 10, you need the commands
$env:CognitoUserPoolUsers = ‘eu-west-1_SamNfoWtf’ and then
$env:CognitoUserPoolClientWeb = ‘3rl4i0ajrmtdm8sbre54p9dvd9’

If that fails, you can always edit the index.js to hardcode these values.
replace all occurrences of process.env.CognitoUserPoolClientWeb (appears twice) with '3rl4i0ajrmtdm8sbre54p9dvd9'

and all occurrences of process.env.CognitoUserPoolUsers (appears once) with 'eu-west-1_SamNfoWtf'

so for example the line (appears twice in index.js)
ClientId: process.env.CognitoUserPoolClientWeb
ClientId: '3rl4i0ajrmtdm8sbre54p9dvd9'

and the line (appears once in index.js)
const userPoolId = process.env.CognitoUserPoolUsers.split('_')[1]
const userPoolId = 'eu-west-1_SamNfoWtf'.split('_')[1]

Alex, that has worked and I now have a token string.
Thanks so much for your help.
British Gas should be paying you for this!!

Please post an update if you get this working. Need to get an indication on the number of successes versus number of issues.

I know people are more likely to post if they have an issue and keep quiet if it works as expected.

All seems to be working well. I can control my Hive devices (Heating, bulbs and smart plugs) from Smartthings/ActionTiles, with feed back received from all devices as well.
Again, thanks so much for your help.

1 Like

For me is still the same. When i started whole process again i had “Tap to refresh authentication” and after some time it changes to “Authenticated as null. Tap to refresh authentication” (I’m doing that on Linux (debian 10) and on Windows 10) .

That is my log from Simulation when I’m pressing “updateDevices”: https://pastebin.com/qmQKh6M6 (ofc. i hid all tokens)
And log from " Live Logging" on IDE when I’m opening Hive (Connect) app and pressing “Done” in SmartThigs: https://pastebin.com/DRWjQvew

I think your integration might be working. Check your devices. The username isn’t actually being populated from an API like I thought, it’s just a value I had hanging around from an old value I had typed in with the older version of the smart app (doh!).

Will look to update this in the code, but I think you’re actually up and running.

EDIT: Update code to 3.2c from Github. Removed username reference as it’s redundant. Should now say AUTHENTICATED if working or NOT AUTHENTICATED.

Remember when you update from GitHub, you will have to paste in HiveTokens.json content again. You probably shouldn’t have to regenerate again though. Just copy the last value generated.

Now in Hive (Connect) I can see “AUTHENTICATED. Tap to refresh authentication” but when I want to click “Devices” I have nothing to select (only black screen with “Next” on the bottom). When I press “Next” I’m getting “We.re having trouble connection. Check your network connection and try agian.”

Log from “Live Logging” of that process: https://pastebin.com/jYcLGd37

Ah. There was a missing def on that line from when I was playing about with some code. I’ve updated GitHub but you can quickly fix by changing line 1197 as below:

resp = apiGET("/products") to
def resp = apiGET("/products")

Save, publish and try again.

1 Like

Now I can see all of my devices buy when I’m pressing “Done” after select all of them there is a Error “We’re having trouble connection. Check your network connection and try again.”

But! Some devices has added (about 4 or 5). After repeat that process i had the same error but again has been added 4 or 5 devices. I was repeating that few times until all devices has been added. Everything is working now <3

Error Log: 16:47:40: error java.util.concurrent.TimeoutException: Execution time exceeded 20 app execution seconds: 422751915047418 @line -1 (doCall)

You are the best! :wink:

Thanks Alex, all working now for me in the ST Cloud.

I did try porting the app back into HE, but received the error

‘Error: No signature of method: user_app_alyc100_Hive__Connect__289.findChildAppByName() is applicable for argument types: (org.codehaus.groovy.runtime.GStringImpl) values: [Hive (Connect)]’

after hitting ‘Next’ following successful authentication. Not sure if it’s an obvious issue with the porting of the app (before Hive messed around with the authentication there wasn’t any problem using the previous SmartApp code).

Thanks for all your help!

I’m finding the devices go offline after a while, can’t quite work out the timings yet.

It’s odd, as I log the temperature data to Grafana via a Google Sheets smart app, and that’s still pulling the data.

So seems they are updating, just showing as offline, so can’t control directly through SmartThings.

Changing and reading data through webcore works fine though…

I was being dumb.

I hadn’t realised that you had updated the Hive Heating DTH back in mid-October, to reflect a URL change. So I was running an older version of that DTH.

I have now updated the Hive Heating DTH to the latest from your GitHub, as well as updated the Hive (Connect) smartapp to the latest v3.2c.

Regenerated the HiveTokens.json file again and pasted its contents into the smartapp in ST IDE at the appropriate line.

Now my new ST app reads the thermostat data AND the controls work again (thanks to updating the DTH) :blush:

I see AUTHENTICATED in the smartapp and all looks to be working as expected again.

Thanks again for all your work and help on this, always appreciated. I just hope BG doesn’t decide to mess things up for us again anytime soon :face_with_symbols_over_mouth:

Thanks again, Alex.

I had this issue even before the authentication change in the new ST app where it initially says it’s offline.

I find I have to pull down the screen to refresh the device in the new ST app to ‘wake it up’ so all the controls appear.

Just to report after todays update Connect has authenticated, my hive thermostat is detected & can make changes.

Thank you.

Seeing odd behaviour within the smartapp though. Cannot switch Thermostat Mode state back to ‘Automatic’ (enables hive/boiler scheduling). The option has disappeared. I say disappeared as it was there earlier when testing, and I did notice the Mode shown was “auto” rather than the “Automatic” of earlier. So when I changed it to off to change it back, the option is no longer in the list; I have cool, emergency, heat & off but no Automatic.

All the other Modes work as intended, but when enabling schedule in Hive app, Connect would not reflect this & continue to report last state with no refresh, despite force closing, clearing cache on ST app & restarting phone.

Only difference between now & when problems started, hive had run through the evening heating schedule: probably not significant but I’m no judge…

It could well be something on my side, although I successfully made it to the end of the crash course on node.js, that’s about as far as I go!

Using Connect 3.2c, Hive heating handler 3.2, Android 10 ST app.

Plot thickens: I left it be to post this 15mins after setting Hive app to schedule: Mode is now “auto” again, but if I change it, it does not appear in the list of selectable modes & behaviour reverts to what’s described above.

Yes it seems to be a bug with the default Smartthings app device type for thermostats UI.

It’s being set to auto because your hive app is setting it back to scheduled which is a valid state in Smartthings and shows up as Auto. For some reason they have removed this mode from the ST app UI but it can be set to auto using WebCore if you’re using that.

UPDATE: Playing around with custom UI configurations so hopefully I should be posting a code update later on with Auto mode enabled.