Skip to content

Latest commit

 

History

History
329 lines (174 loc) · 16.3 KB

HUBITAT_README.md

File metadata and controls

329 lines (174 loc) · 16.3 KB

device-type-MyNext Hubitat integration

For more details on the extensive features & capabilities of Next Devices, please refer to this Hubitat community thread:

https://community.hubitat.com/t/release-my-next-manager-for-your-nest-tstats-protects-and-sensors-all-nest-attributes-available-home-away-settargethumidity-sethotwaterboost-for-automation-and-no-throttling/58240

My Next devices

Author: Yves Racine

linkedIn profile: www.linkedin.com/in/yracine

Credits: github @gboudreau for the initial Nest APIs discovery

You can now download the code at

http://www.ecomatiqhomes.com/hubitatstore

P.S. Technical support packages are also available.


Setup time: about 15-25 minutes depending on your Hubitat skills.

PREREQUISITES

Some technical skills & manual tasks are required to setup your Nest devices under Hubitat as the Nest Web APIs used are not the "official" ones and don't have an oAuth flow (see LOGIN INFO For NEst or Google Account users below).

  • a) [Nest] Your Nest products fully operational and connected to Nest Home via the internet

    Please note that all Nest thermostat devices are supported except the Nest thermostat E in the UK (with the heat link).
    Next Cams & Door Bells, and the Nest Secure Alarm are not supported.

  • b) [Nest] Nest setup completed for your Nest devices under your Nest Primary account (don't use any Nest secondary accounts for the integation with hubitat!!)

LOGIN INFO REQUIRED FOR NEST ACCOUNT Users (Not migrated to a Google account)

  • Once you log in to your Nest account as described in the steps below, please keep the connection active to avoid any disconnect in Hubitat (i.e., do not log off, but you can close your browser and even turn off your desktop/mobile), don't change your Nest account password or 2FA settings, and do not re-login to keep your cookie valid.

  • Google recently introduced reCAPTCHA when logging to Nest. That means username and password cannot be used directly any more. Instead, you have to obtain user_id and access_token for your account by logging in manually.

  • For some visual guidelines, refer to screenshots in the link below

https://thingsthataresmart.wiki/index.php?title=My_NextServiceMgr#Issue_.2314:_My_Next_devices_are_not_updating_or_my_auth_tokens_are_lost


7 Steps for Nest users who have NOT migrated to a Google account:


  1. [Chrome] To do that, open developer tools in your Chrome browser, switch to the Network tab,

  2. [Chrome] Hit preserve Logs in the Network tab

  3. [Chrome] Log in to home.nest.com and look for the request similar to https://home.nest.com/session?_=157XXXXXX.

  4. [Chrome] You can use the filter "session" to get the exact info needed.

  5. [Chrome] You will find user_id and access_token in the response to the request.

  6. [Chrome->IDE] MyNestManager- Copy over the Nest login information to the corresponding nest_* fields in the header (IDE) for MyNextManager, refer to step 2g) below at https://github.com/yracine/device-type-myNext/blob/master/README.md#2-create-a-new-smartapp-mynextmanagerv2.

In the header (code) section of MyNextManager, you will see "INSERT THE NEST LOGIN INFORMATION BELOW".

FYI,the login info for Nest account users looks like the following (your Nest user id will be different):

nest_user_id=4783742 nest_access_token=b.4783742.xXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

[Hubitat IDE] MyNestManager- header (code) section: After copying and pasting the login info, press "save" to save the code with your Nest login variables. Don't insert anything in the google section. Do not copy the double quotes from the nest login information in the variables.


Notes:


  • If you lose your auth tokens, then you'd need to redo the steps above and copy over the new nest access_token back to the Hubitat IDE. You can then reset the Nest connection by executing MyNextManager under Automation/Smartapps in the Samsung connect app by pressing "Next" till "Done").

  • You don't need to re-install the devices, just reset the Nest connection.

LOGIN INFO REQUIRED FOR GOOGLE ACCOUNT USERS (MIGRATED NEST USERS)


Notes:


  • Once you log in to your Nest account as described in the steps below, please keep the connection active to avoid any disconnect in Hubitat (i.e., do not log off, but you can close your browser and even turn off your desktop/mobile), don't change your Nest account password or 2FA settings, and do not re-login to keep your cookie valid.

  • If you lose your auth tokens, then you'd need to redo the steps below and copy over the new google cookie and issue_token_url back to the Hubitat IDE. You can then reset the Nest connection by executing MyNextManager by pressing "Next" till "Done").

  • You don't need to re-install the devices, just reset the Nest connection.


13 Steps for users who have migrated to a Google account:


Similar as the Nest account user, open developer tools in your Chrome browser,switch to the Network tab, hit preserve Logs. For some visual guidelines, refer to screenshots in the link below

https://thingsthataresmart.wiki/index.php?title=My_NextServiceMgr#Issue_.2314:_My_Next_devices_are_not_updating_or_my_auth_tokens_are_lost

The values of issue_token and cookie are specific to your Google Account. To get them, follow these steps (only needs to be done once, as long as you stay logged into your Google Account).

  1. [Chrome] Open a Chrome browser tab in Incognito Mode (or clear your cache).
  2. [Chrome] Open Developer Tools (View/Developer/Developer Tools).
  3. [Chrome] Click on 'Network' tab.
  4. [Chrome] Make sure 'Preserve Log' is checked.
  5. [Chrome] In the 'Filter' box, enter issueToken
  6. [Chrome] Go to home.nest.com, and click 'Sign in with Google'. Log into your account.
  7. [Chrome] One network call (beginning with iframerpc) will appear in the Dev Tools window. Click on it.
  8. [Chrome] In the Headers tab, under General, copy the entire Request URL (beginning with https://accounts.google.com, ending with nest.com). This is your "google_issue_token_url".
    Refer to https://github.com/yracine/device-type-myNext/blob/master/README.md#2-create-a-new-smartapp-mynextmanagerv2.
  9. [Chrome] In the 'Filter' box, enter oauth2/iframe
  10. [Chrome] Several network calls will appear in the Dev Tools window. Click on the last iframe call.
  11. [Chrome] In the Headers tab, under Request Headers, copy the entire cookie (usually it starts with OCAK=... or SID=... or SMSV=... or with other values - include the whole string which is several lines long and has many field/value pairs - do not include the cookie: name). This google "cookie" needs to be copied over in the code (header) section of the MyNextManager smartapp under the instructions saying 'INSERT GOOGLE LOGIN INFO BELOW'. See https://github.com/yracine/device-type-myNext/blob/master/README.md#2-create-a-new-smartapp-mynextmanagerv2.
  12. [Chrome->IDE] MyNestManager- Make sure that the whole cookie from Google is contained in google_cookiep1. There is no need to split the cookie anymore Please make sure to avoid inserting extra spaces or any other characters when you copy the google cookie as Google will not accept it and the list of devices will be empty.
  13. [Hubitat IDE] MyNestManager header: After copying and pasting the login info in the header, press "save" to save your global variables.

a) go to http://192.168.xx.xx/app/list (insert your own hub's ip address)

b) click on MyNextManager in the list of smartapps.

c) Copy the nest user and auth token into the header as global variables.

Do not copy the doubleotes in the global variables

1) Depending on your contribution, create one or multiple device driver(s) - DTH for My NextTstat or MyNextAlarm (for Protects) or NextSensor

For each device (My NextTstat, My NextAlarm, My NextSensor),

a) Create a new device driver

go to http://192.168.xx.xx/driver/list (insert your own hub's IP address)

b) Hit the "+New Driver" at the top right corner

c) Copy and paste the code from the corresponding txt file in the zip

d) Hit the save button on the right inside of the screen

2) Create a new smartapp (MyNextManager)

go to http://192.168.xx.xx/app/list (insert your own hub's IP address)

a) Hit the "+New App" at the top right corner

b) Copy and paste the code from the corresponding txt file in the zip

c) Hit the save button on the right inside of the screen

d) Make sure to enable OAuth in "Apps Code" is active (click oAuth in the upper right corner)

  • Hit "Update" at the bottom

e) Copy the login information from Nest or Google under the right global variables (see instructions above)

f) Click on the "save" button at the right corner to save your login information from Nest/Google as global variables

If the instructions above are not clear enough, you can refer to the troubleshooting section below with some pictures:

http://thingsthataresmart.wiki/index.php?title=My_NextServiceMgr#Issue_.231:_I_don.27t_know_how_to_create_a_custom_smartapp

3) Go to the installed apps section of hubitat, execute MyNextManager

http://192.168.xx.xx/installedapp/list (insert your own hub's IP address)

a) Click on "Add User app" in the right corner of the window

4) Connect Hubitat to the Nest web APIs

[Hubitat IDE] Check the logs for any installation errors. Your login info may not have been copied correctly in the MyNextManagerV2's App Settings section.

http://192.168.xx.xx/logs (insert your own hub's IP address)


N.B. If you have any errors:

If you get a blank screen after pressing 'Next or you get the following error: "Java.lang.NullPointerException: Cannot execute null+1"' on null object" in the IDE', you'd need to enable oAuth as specified in step 2d) above.

At the end of the authorization flow, if you have the following error message: "Unexpected error" even if you press several times, this probably means that you have not "saved" one of the drivers (MyNextTstat, MyNextAlarm, MyNextSensor). Refer to step 1 for more details.


5) Your device(s) should now be created among your installed devices

After about 1 minute, You should see your newly Next devices instantiated under:

[Hubitat IDE] go to http://192.168.xx.xx/device/list (insert your own hub's IP address)

6) (Optional) Set device's preferences

a) Click on the My Next devices that you just created

http://192.168.xx.xx/device/edit/"device number" (Device number can vary from one location to the next)

b) Edit the preferences in the middle section of the screen)

You only need to edit the following parameters

(a) <trace> when needed, set to true to get more tracing (no spaces)
(b) <logFilter:1..5> Values=[Level 1=ERROR only,2=<Level 1+WARNING>,3=<2+INFO>,4=<3+DEBUG>,5=<4+TRACE>]

And, press "save preferences" at the end.

N.B. The detailed logging will be set for the next 15 minutes only (deactivated after to avoid performance issues)

7) Use some of my smartapps (optional) - For all Nest users

Some complimentary smartapps at my github, refer to:

https://github.com/yracine/device-type-myNext/tree/master/smartapps

/****************************************************

a) NestChangeMode

/****************************************************

Change your Nest Away/Home settings according to your Hubitat location or hello home mode.

/****************************************************

b) NestGetTips/b>

/****************************************************

The smartapp allows the user to get comfort & energy tips based on his/her indoor/outdoor conditions at home.

/****************************************************

c) TstatStateTriggerHA

/****************************************************

The above smartapp allows a Hubitat user to trigger some switch(es) (turn on/off or flash) and/or trigger a hello phrase routine when the thermostat is cooling/heating/running the fan/or idle.

/****************************************************

d) MonitorAndSetNestHumdity

/****************************************************

The above smartapp allows a Hubitat user to trigger the humidifier/dehumidifier connected to Nest or some humdifier/dehumidifier switch(es) based on the indoor/outdoor conditions at your home in order to reach the target humidity level.

/****************************************************

e) Zoning smartapps

/****************************************************

The following zoned Heating/cooling smartapps have many features to leverage your Nest Thermostat.

  • User friendly Dashboard and workflow pages for easier setup (i.e. Dashboard->GeneralSetup->RoomsSetup->ZonesSetup->SchedulesSetup-> NotificationSettings).
  • Flexible schedule definition: you can define up to 12 schedules for your zones (mornings, weekdays, evenings, nights, weekends, etc.)
  • Remote Sensors: choice of temp calculation method (Average, Median, Minimum, Maximum, Heat/Min-Cool/Max) based on all room temp sensors inside the zone so that your heat/cool settings are adjusted at the main thermostat even if your rooms are far away. The average calculation is similar to the ecobee3's follow me feature with its remote sensors.
  • For each schedule, Hubitat users can define the start & end times, the thermostat's heating/cooling setpoints (or climates for ecobee), the max temp adjustment based on the chosen calculation method (avg, median, min, max, etc.)
  • You can set your schedules to run only for some routines/ST hello modes (ex. 'Away', 'Home', 'Night', or your own customized ones )
  • For each schedule, you can assign the included zone(s) according to your own requirements (ex. Upstairs bedrooms, 1st level, basement, etc)
  • You can define up to 8 zones for your home which can include up to 16 rooms
  • Ability to set your smart thermostat to 'Away' or 'Present' based on all rooms' motion sensors
  • Ability to set the thermostat's fanMode ('on', 'auto', 'circulate') during a specific schedule
  • Ability to trigger the thermostat's fan based on some indoor temp differential. The temp differential can be customized for each schedule.
  • Ability to adjust your main thermostat's settings (every 5 minutes) based on an outdoor temp sensor (optional)
  • and many more features...
http://www.ecomatiqhomes.com/hubitatstore

/****************************************************

ScheduleTstatZones

/****************************************************

For more details:

http://thingsthataresmart.wiki/index.php?title=ScheduleTstatZones

The smartapp that enables Multi Zoned Heating/Cooling Solutions based on any connected thermostats/sensors- - coupled with smart vents (optional, can be any Flair, Keen Home, EcoVent, EcoNet smart vents) for better temp settings control throughout your home".

The smartapp will use the thermostat's setpoints as baselines for targeted heating/cooling based on the concept of virtual/physical zones.

The smartapp can also control multiple Minisplit/Windows unit and portable heaters/coolers inside your scheduled zones (based on the Flair HVACUnit device, see http://thingsthataresmart.wiki/index.php?title=My_Flair_HVac_Unit).

/****************************************************

ScheduleRoomTempControl

/****************************************************

For more details:

http://thingsthataresmart.wiki/index.php?title=ScheduleRoomTempControl

The smartapp allows you to define some rooms' thresholds for better control of hotter/colder rooms in your premises. Smart vents are required for creating the physical zones.