How do you control a Nexia thermostat with a SmartThings hub

Ok so just to close the loop @randomguy and I went through his setup. We got him working - but we had to do some strange stuff. So here’s the solution just in case we need to make some changes.

@trentfoley He could not get through the initialization of the Smartapp with the code currently in your GitHub linked from the top of this thread. we had to use the version posted by @edk208 here:

Tl;dr @edk208’s code was updated to adapt to adjustments by Nexia’s login page. Do we know if those adjustments made it into the trentfoley version?

Once he was in, he initialized properly (the child device was created) but that child device didn’t show properly in his app (ST Classic BTW, in case anyone is watching those threads)

@randomguy then used the DTH posted here by @synfinatic and everything locked in: https://github.com/synfinatic/SmartThingsPublic/blob/master/devicetypes/trentfoley/nexia-thermostat.src/nexia-thermostat.groovy

So, it looks like he used a combination of the @edk208 app and the @synfinatic DTH both based off the @trentfoley code. (please correct me if I’m wrong @randomguy)

Is it possible to compare / contrast all the versions and push/pull all the good stuff into one working GitHub and call it working as of today’s date? (No my git is busted and I’m not very good with it, cant use mine, you would not like the result :slight_smile: )

After multiple installs and reinstalls of the Device Handler and SmartApp noted in the above post, I finialy got the Nexia-SmartThings bridge working. Here is a step-by-step of what I did:

  1. Log into your SmartThings account.

— Add Device Handler —
2. Go to https://github.com/synfinatic/SmartThingsPublic/blob/master/devicetypes/trentfoley/nexia-thermostat.src/nexia-thermostat.groovy from above and copy the Device Type Handler code.
3. Go back to the SmartThings site. Go to the My Device Handlers page.
4. Click Create New Device Handler. Click ‘From Code’. Paste the code you just copied.
5. Click ‘Save’. Click ‘Publish’. Click ‘For Me’.

— Add SmartApp —
6. . Go to https://github.com/edk208/SmartThingsPublic/blob/master/smartapps/trentfoley/nexia-thermostat-manager.src/nexia-thermostat-manager.groovy from above and copy the SmartApps code.
7. Go back to the SmartThings site. Go to the My SmartApps page.
8. Click Create New SmartApp. Click ‘From Code’. Paste the code you just copied.
9. Click ‘Save’. Click ‘Publish’. Click ‘For Me’.

— Set up the bridge to your Nexia account
10. On the My SmartApps page, click ‘Simulator’ on the upper-right.
11. Select your location (mine was Home). Click ‘Save’ or ‘Update’.
12. Enter your Nexia user name, password and select an Update Frequency from the drop down list.
13. Click ‘Save’ or ‘Update’.

— Update the Device —
14. Go to the My Devices page.
15. You should see Nexia Thermostat. Select it.
16. Update the Hub and Location if they are not already set.

I hope these detailed instructions save you hours I spent trying to get it set up. I was hung up entering the Nexia account preferences and stumbled on to it when I clicked My SmartApps>Simulator. Once I did that, everything worked. There is no way to access the preferences from the My Devices page or the Settings button on the SmartThings app. Use the Simulator>Preferences page to make changes to them.

What would now be great is to publish the thermostat settings on every poll via an MQTT bridge if there is one also set up in SmartThings.

1 Like

Alexa see the thermastat, she doesn’t like my commands. Such as, “Alexa, turn Upstairs Off.”

Any sample phrases that work?

The instructions worked great. Thanks for taking the time to help us beginners.

1 Like

So, who else’s device controlls stopped working yesterday with the Media “update”?

[name:error, descriptionText:Caught exception requesting thermostats: groovy.lang.GroovyRuntimeException: Cannot compare groovy.util.slurpersupport.NodeChildren with value ‘’ and java.lang.Integer with value ‘1’, displayed:true]

This is the error Im getting. Anyone else?

1 Like

I had to add a call to refreshAuthToken() in requestThermostats() just before the call to httpGet(). Without it, it looks like they are returning a 200 to the http get, but the contents of the response is the login page and not the thermostat data as the app is expecting.

Can you post a snip of your code? Ive added it, and Im still getting the same error.

private requestThermostats(Closure closure) {
debugEvent(“requestThermostats(${state.thermostatsPath})”)

def thermostatsParams = [
    uri: serverUrl,
    path: state.thermostatsPath,
    headers: defaultHeaders
]

debugEvent("Thermostat Params: ${thermostatsParams}")

// Added 5/25/2018
refreshAuthToken()

try {
    httpGet(thermostatsParams) { resp ->
        if (resp.status == 200) {
            // Added 5/25/2018
            debugEvent("requestThermostats resp.status == 200: ${resp.data}")
            closure(resp)
        } else if (resp.status == 302) { // Redirect to login page due to session expiration
            refreshAuthToken()
            requestThermostats(closure)
        } else {
            throw new Exception("Unexpected status while requesting thermostats: ${resp.status}")
        }
    }
}
catch(Exception e) {
    errorEvent("Caught exception requesting thermostats: ${e}")
}

}

Sorry, that paste didn’t turn out very well. I just added the 2 lines - the call to refreshAuthToken() and the debugEvent that dumps the response to the Live Log.

I added it. Still not getting setpoints sent to Nexia despite the fact that Smartthings thinks it is.

@nathancu Any ideas on this one? I haven’t been able to set temp via the ST app since the 26th. If I try to set a temp the temp reverts to what is set at the thermostat. If I look at ST live logging I see the error shown here.

af142a47-1d1b-4da6-b1ad-1f7f595773ff 12:00:57 AM: error [name:error, descriptionText:Caught exception requesting thermostats: java.lang.SecurityException: Creating new class java.lang.Exception is not allowed, displayed:true]

I also see in the Nexia logs that no request has been received from ‘user portal’ since the 26th at 12:48 PM. I have made no changes in ST for months and it was working fine until the 26th, then it just stopped. I tried the solution given by @larrywho but that did not resolve the issue. Any help would be greatly appreciated.

Anyone had any luck solving this and getting it working again?

I’m looking at it, but it’s slow going (my daughter graduates this weekend and getting the house ready for the inlaws is higher priority)

Here’s what I know.

Nexia changed something on thier website PAST the login and therefore the smartapp doesn’t enumerate thermostats correctly anymore. This will take reengineering the part of the smartapp that creates the virtual device and reads/writes status. Once we figure out how Nexia modified the web interface it can be done - but it will take time.

@trentfoley - you have time to take a crack at it… It’s going to be at least a week before I can take a shot.

@nathancu Congrats on your daughter graduation. That’s defiantly a higher priority!

1 Like

@nathancu, I did some digging in this over the weekend and I don’t see where there was previously thermostat data on the Nexia side, and I’m wondering if that’s why we are getting an exception.

So, based on what I can tell tonight, theyve changed something downstream of the path variable. I dont recall having /houses/ in the url previously either.

You know something interesting I just noticed? My actiontiles/Smartthings app is still getting thermostat data, but trying to chance setpoints doesn’t work.

Hey Guys, I have a solution that works. I use IFTTT applets. IFTTT works with Smartthings and Nexia. First you create two automatons on the Nexia website, One to adjust the thermostat when you leave and the other when you arrive. Next on Smartthings create a virtual switch. Then create a Smartthings routine to turn the switch on when you arrive (using your presence sensor) and off when you leave. Now go to IFTTT and create two appllets 1) when Smatthings virtual switch is On run Nexia arrive routine. The other is when Smarttings virtual switch is off, run the Nexia leave automation.

I tried it and it works!

Hadn’t thought of that one. That wouldn’t require reworking my entire climate control piston in Webcore either. Thanks!