Nest Thermostat Hot Water controlled by Alexa

Share the joy

For anyone that has a Nest thermostat and an Amazon Alexa, they will know there is one feature distinctly lacking. Voice boosting of the hot water. After further investigation, this is not only missing from he Alexa app but is missing from the actual API. I think that this is probably due to the function being UK only.

Initially I took to the community pages to get more information. The first post dates back to Oct ’16 and the official line was “Thanks for letting us know that this is an important feature. Duly noted! We have communicated the extremely strong interest to our development team. The request is in the queue for consideration and will be seriously considered. We value your input, and we do not discuss future schedules or internal planning in this community.” This was mid August some time. Request #1 got closed for comments and so did all other threads. #2, #3 and finally #4. As a result of this I decided to make my own.

If you want to do this, you will need the following:
– Amazon Alexa
– UK Nest Thermostat (and online account)
– IFTTT account
– Webspace to host some php files

The basics of how this works are as follows:
1. Ask Alexa to trigger an IFTTT applet. By saying “Alexa trigger …..” Alexa knows that the following commands will be passed to IFTTT. My phrase was “Alexa trigger hot water boost” Thats the IFT part.
2. Configure the applet to use webhooks that will open a php file on a server. That’s the TT part.
3. The php file calls the class and boosts the hot water for a defined time. My aim was to make this as easy to follow as possible.

The drawback of this in its current state is that there is no feedback from Alexa if it has work or even if you have said the correct thing. Any time you say “Alexa trigger ….” she responds with “sending request to IFTTT” and doesn’t even know if there is an applet that matches you request.

As a bit of a disclaimer, I have only tested on a single UK Nest on my account so cannot guarantee that it will work with any others. Provided as is with no warranty etc. Feedback would be greatly appreciated either in the comments or on GitHub.

I have everything I need, how do I do it?
Step 1: Download the files (or fork) from Github. ->
Step 2: Edit the example files, setting a random key and enter your nest username and password. Then upload them with the class to your webspace and make a note of the url. The key variable is purely for security reasons, so that even if someone knows the url, they cannot do anything without the key, which can be any random character set. (within reason, I would stick to A-Z a-z 0-1)
Step 3: Link Alexa and IFTTT. ->
Step 4: Create the applet. Its pretty easy, screen 6 outlines the options to pass the key to your web page. The example code does output all of the calls to the web pages to a file called test.txt to make it easier to debug.
(1) (2) (3)
(4) (5) (6)

Step 5: Ask Alexa to “trigger hot water boost”!

Technical Information (incase anyone wants to port to different language)
If you ended up here you probably came through the Nest Community pages where you were searching regarding the lack of Hot Water API exposure. I know that not everyone will want to use PHP so I’m going to try and break down the basics of the reverse engineering so that you can port the code to another language / platform. This is only my understanding and could totally be wrong!

So basically I worked backwards. I started by looking at the calls for boosting the hot water and found this.

As highlighted in red, I need several things to boost the hot water. Firstly I need the request url, which is also referred to as the transport url. This was already covered in the library I forked but it can be found when you log in.
Secondly I need to create the payload that can be seen above.
session: From reading this post I worked out that the session variable was not required.
op: MERGE – this is fixed.
hot_water_boost_time_to_end: This is the epooch time that you would like the boost to end.
base_object_revision & object_key: object_key is the id of your nest thermostat, and my understanding is that the website creates a snapshot of the device settings used by the website called base_object_revision. After searching through the requests (for a long time) I found one that looked promising. The website makes the following call which returns the information I need.

From the code you will see that I only request the device bucket meaning I only get the information that I need.

I tried to make the code as simple as possible, so it will be easy to use or replicate/port. Any questions please ask.


  • hey there. great post, something I’ve been wanting for over a year!

    I’m trying to convert to python. My first request works fine and I get the userID etc, but the second request to get the bucket data fails with a 401 unauthorized. You don’t appear to be using an authenticated connection when you do it? any ideas whay might be going wrong? I don’t know PHP – you’re posting a json payload aren’t you?

  • Jon Andrews

    excuse the simple question…but I love that someone has been able to take what NEST cant be bothered to do and brought the much-needed functionality to the system

    I personally don’t have any web space open to me so was wondering if it is possible to host these files on a local computer, specifically an Rpi as I already have one running HA Bridge that is both running 24/7 AND a low-cost small device taking up no room

    Thnks in advance


    • rdiver

      Hi Jon, from a quick read I think the ha-bridge may do it for you without IFTTT. But I could be wrong.
      You could in theory, put the PHP files onto the raspberry pi so that they are accessible from a url. such as and then add it as a custom device.
      From it says:
      “The Add/Edit Tab

      Another way to add a device is through the Manual Add Tab. This allows you to manually enter the name, the on and off URLs and select if there are custom handling with the type of call that can be made. This allows for control of anything that has a distinct request that can be executed so you are not limited to the Vera, Harmony, Nest or other Hue.”

      So my understanding is you could get it to call he local php files on the pi and execute through Alexa that way. Does that make sense? I’ve never used ha-bridge so the info is the result of a quick google. Hope it helps.

      • Jon Andrews

        in the process of getting this to work with HAB, I’ve installed the required files and also created the required boost.php module.

        Im not sure if I’m doing something wrong but I cannot work out how to trigger the PHP module from a command line (within my rPi) to make sure it’s working (before progressing). When I try to execute it, It responds saying access denied if I don’t append the preset key onto the command….but if I put the key on the end it doesn’t recognise the module to be run.

        Im sure Im doing something silly wrong, but as programming, in general, isn’t really my thing Im happy to put my hands up and ask for some assistance.

  • slicker55

    I have tried to follow these instructions very carefully but sadly, after several attempts I cannot get things to work. Alexa refers the trigger to IFTTT but the thermostat does not respond. I suspect it’s down to where my files are being hosted. Can anyone recommend a tried and tested on-line service which is free?

  • A BIG thanks to rdiver for sharing your expertise and taking the time to explain everything so clearly.
    I followed your instructions very carefully and now I can control my hot water boost using voice commands via Alexa – FANTASTIC WORK!

    • rdiver

      Glad it worked. Mines still going strong, I’m assuming that if they can be bothered to implement this, it’s unlikely they will fix my way.

  • Robert Bradley

    Fantastic implementation

    My use case is a little different, I use Home Assistant with this api to display current status and a switch to boost when needed.

    I have a bash script that invoked the call to php.

    The issue comes in that home assistant regularly checks the boost time remaining and the on off status. Nest are wise to us hammering the website and block you temporarily.

    I have witnessed this while using the api and have the error. You could test it by asking Alexa the status of the hot water a few times in a row, or running the php script a few times – though a browser probably has some sort of cookie or session persistence.

    My question: is it possible to reuse the cookie / auth key from the initial request between script calls.

    Eg a check to see if a valid cookie exists if not generate a new one

    Maybe the blocking is not the cookie and maybe it’s done on connection(DDOS protection), just a thought

    • rdiver

      Hi Rob, if you could keep the php call open then I don’t see why you couldn’t just keep calling the methods using the initial auth. PHP isn’t really suited to this though as it will timeout.

      $nest = new Nest($uname,$pwrd);
      while(1) {
      $status = getHotWaterStatus();

      This would constantly poll.

  • Will P

    Hi rdiver – many thanks for this guide.

    A quick question, I’ve managed to get this set up and can hit the URL’s and receive a HTTP 200 response.

    The thing is, the boost doesn’t always come on. The same happens with my cancel boost command, I’ll get the HTTP 200 response but it didn’t actually cancel it.

    I’ve got IFTTT but at the moment I am just hitting the url in a browser to see if I can get it working but its only working now and again.

    My set up is a little different in that I have 2 nests set up on the account, one for downstairs and hot water and one for upstairs.

    On some occasions this error is thrown:

    [01-Sep-2018 16:36:16 UTC] PHP Fatal error: Uncaught exception ‘Exception’ with message ‘Error during GET of ‘/v2/mobile/user.’: malformed’ in /home/anotheri/public_html/nest/nest-php-api.php:117
    Stack trace:
    #0 /home/anotheri/public_html/nest/nest-php-api.php(84): Nest->curlGet(‘/v2/mobile/user…’)
    #1 /home/anotheri/public_html/nest/nest-php-api.php(63): Nest->getHotWaterStatus()
    #2 /home/anotheri/public_html/nest/cancel_hot_water.php(19): Nest->setHotWaterBoost(0)
    #3 {main}
    thrown in /home/anotheri/public_html/nest/nest-php-api.php on line 117

    Any ideas?? I should caveat all of this by saying I’m not an engineer or a dev!

    • rdiver

      Hi Will, when writing I do remember noting that I was not sure how it would work with 2 nests. I think you could get round this by fixing the device id.
      If you add print_r($response); to line 41 of nest-php-api.php file, and post it I might be able to offer some advice.

  • Adam

    Hi all,

    I’ve found a way to do this without using IFTTT or hosting anything. Might be an alternative to some?

    First purchase the Sonoff Basic – ​

    Now you’ll need to give the relay a permanent supply on the input terminals but your heatlink has this already.​ Then if you follow the cable from terminal 6 of your heatlink you should find that this will connect onto the brown conductor of your hot water pump. We want to install a cable from the output of the relay to this brown core on the hot water pump (you need to keep the cable from terminal 6 installed to this core as well). This then enables the relay to energise the motor within the pump and close the connection required to turn on your hot water.

    You’ll need to install the Ewelink app and set the device up within the app, which is very simple (please note that the Sonoff connects to the 2.4ghz frequency of your router). I of course named the relay Hot Water.

    Once the app is installed you need to go into the loop timer on the bottom right​. Untick “after” and then set the time to your desired boost time in my case 1hour.

    At this stage you can test the cabling and the device are working by manually turning the relay on and off within the app. I set my boost time to 2 minutes whilst testing to ensure the relay was turned off.

    Lastly you’ll need to go into your Alexa app and install the Ewelink skill and link your account. Then add devices within the Alexa app and hey presto! “Alexa, turn on the Hot Water” and it will turn off after your pre-defined time.

    As above the Boost won’t register on the Nest as we are bypassing it.

    If anyone needs any help just let me know!

    • rdiver

      Yes this would also work. I thought about something similar for my bathroom lights as they have a fan so hue bulbs wouldn’t work. The caveat with this is it requires knowledge of (and competency with) mains electricity and this is very different to a coding solution.

  • Alan


    I have php 5.6.0 running in IIS on an old windows home server.
    When running the script, I get the below error in the php log (and 500 error in browser) – any idea what the problem is?

    php-api.php(63): Nest->getHotWaterStatus()
    #2 C:\example_boost_hot_water.php(18): Nest->setHotWaterBoost(60)
    #3 {main}
    thrown in C:\nest-php-api.php on line 117

    [16-Sep-2018 15:08:36 Europe/Minsk] PHP Notice: Trying to get property of non-object in C:\Program Files\Windows Server\Bin\WebApps\Site\Water\nest-php-api.php on line 30
    [16-Sep-2018 15:08:36 Europe/Minsk] PHP Notice: Trying to get property of non-object in C:\Program Files\Windows Server\Bin\WebApps\Site\Water\nest-php-api.php on line 31
    [16-Sep-2018 15:08:36 Europe/Minsk] PHP Notice: Trying to get property of non-object in C:\Program Files\Windows Server\Bin\WebApps\Site\Water\nest-php-api.php on line 32
    [16-Sep-2018 15:08:36 Europe/Minsk] PHP Notice: Trying to get property of non-object in C:\Program Files\Windows Server\Bin\WebApps\Site\Water\nest-php-api.php on line 32

    [16-Sep-2018 15:08:36 Europe/Minsk] PHP Fatal error: Uncaught exception ‘Exception’ with message ‘Error during GET of ‘/v2/mobile/user.’: malformed’ in C:\nest-php-api.php:117
    Stack trace:

    #0 C:\nest-php-api.php(84): Nest->curlGet(‘/v2/mobile/user…’)

    #1 C:\nest-php-api.php(63): Nest->getHotWaterStatus()

    #2 C:\example_boost_hot_water.php(18): Nest->setHotWaterBoost(60)

    #3 {main}
    thrown in C:\nest-php-api.php on line 117

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.