Jump to content

Welcome to Smart Home Forum by FIBARO

Dear Guest,

 

as you can notice parts of Smart Home Forum by FIBARO is not available for you. You have to register in order to view all content and post in our community. Don't worry! Registration is a simple free process that requires minimal information for you to sign up. Become a part of of Smart Home Forum by FIBARO by creating an account.

 

As a member you can:

  •     Start new topics and reply to others
  •     Follow topics and users to get email updates
  •     Get your own profile page and make new friends
  •     Send personal messages
  •     ... and learn a lot about our system!

 

Regards,

Smart Home Forum by FIBARO Team


  • 0

Nest Thermostat v3 Fibaro Plugin not updating [Workaround found!]


Question

Posted (edited)

Hi,
 
This is an update of the first post which now contains the workaround I created (with code found all over the net). Makes it easier to find what you are looking for when you open this thread :-).
This is more a replacement / edit for the original plugin. I still use the original Plugin, so I have a device that is registered in the system as a Thermometer and an Humidity Sensor (devices 112 and 113, whose values are updatet by the VD). For the moment, I don’t think this can be done with a VD alone.
 
Worth mentioning: don’t make too many calls in a short timeframe to the Nest API, it will just slow down everything.
I did it this way, but you can change whatever you like, this makes programming fun :-) .

Getting started: (For easy first steps to get to your access token, use something like “Postman”)

  • Get a Nest developer account. (documented here:

    Please login or register to see this link.

  • Create a new product with these permissions: 
    • Thermostat read/write v6 (if your Nest thermostat is running the most recent version)
    • Away read/write v2
    • You will eventually get
      • A Product ID
      • A Product Secret
      • An Authorization URL
    • You will get a PIN code when you follow all steps
    • You will eventually get an access token, which is what we’ll be using for everything else ;-)
  • Use your access token to get your ID’s
    • Do a GET to

      Please login or register to see this link.

      using something like Postman (I did it using Fibaro scenes, but Postman is easier).
      • You have to set the Headers
        • “Authorization” with “Bearer <<your access token>>”
        • “Content-Type” “application/json”
    • This will give you all the data you want, including your thermostat(s) ID(s) and your structures ID(s)

I made these Global variables:

  • NESTawaytemp
  • NESThome
  • NESThumidity
  • NESTnewTemp
  • NESTstate
  • NESTtarget
  • NESTtargeteta
  • NESTtemp

I made a VD with some labels and buttons. I also did a VD with a slider to set the temperature, but that didn’t work the way I wanted it to. The slider is always 0 - 100. I edited it to be able to choose a temperature between 10°C and 30°C, but when you move the slider, the value isn’t visible “on the fly”. Changes to the slider are only possible with reload of page, for as far as I know. The new temperature did come in a label, but I found it to sluggish to use. Look at the attached images for more info.
 
The main loop for the VD (I like "," as decimal seperator, not ".", you can delete all that off course):

Please login or register to see this code.

The code for my button Temp +

Please login or register to see this code.

The code for button Temp -

Please login or register to see this code.

The code for button "Instellen" (you eventually have to push that button, to set Nest to your new wanted temp, I did this to limit the API calls) Scene 66 will follow

Please login or register to see this code.

The other buttons are readable in the images.

The Nest Refresh scene, which updates the global variables. Runs once a minute, don’t run it too fast. Just change the << >> values to your own. 

Please login or register to see this code.

The Scene to set Nest to "Home" (scene 65)

Please login or register to see this code.

The scene to set Nest "Away" or "Eco" (scene 64)

Please login or register to see this code.

The scene that sets the new temperature to Nest (scene 66)

Please login or register to see this code.

Hope some more people can be helped by this :-)

 

Please login or register to see this attachment.

Please login or register to see this attachment.

Please login or register to see this attachment.

Please login or register to see this attachment.

Please login or register to see this attachment.

Please login or register to see this attachment.

Please login or register to see this attachment.

Please login or register to see this attachment.

Edited by TW1979
New first post

Recommended Posts

  • 0
Posted

Hi TW1979,

 

I try to build you VD for motion detection, but not works.

Can you export you VD and schare with us.

 

Twan

  • 0
  • Inquirer
  • Posted

    @twanve

    You can’t just copy and paste the VD and I can’t export mine (wouldn’t work), you have to build it yourself. Mine was just an example of how I did it it. I don’t know which part gave you problems, so I’ll explain the whole thing.

     

    This is how it works:

     

    Say you have 3 sensors with ID: 1, 2 and 3, which are in rooms A,B and C.

     

    I do it like this:

     

    First put the “lastBreached” value of sensor 1 into a variable: i.e. “lastBreachedTime”

    I also put the name of the room sensor 1 is in, in a variable: i.e. “lastBreachedLocation”

    And I put the ID of sensor 1 into a variable: i.e. “lastBreachedDeviceId”.

     

    Next I check if sensor 2’s value “lastBreached” is higher than that of sensor 1. If it is, I want those values in the variables.

     

    Next I check if sensor 3’s value “lastBreached” is higher then the value in the variable “lastBreachedTime”.

     

    So eventually I get the values of the most recent breached sensor.

     

    That would be this part:

    Please login or register to see this code.

    The next part just makes the values for the labels in the VD.

    This part makes the string I put into my label “Laatst detectie”

    Please login or register to see this code.

    The last part changes the icons to the one I created and writes the values to the labels “Locatie” and “Detectie”. The location label is just the name for the room with the most recent “lastBreached”. The other one is perhaps a bit more difficult to explain. A sensor’s value “lastBreached” is changed when it is breached (evidently), but as long as the sensor keeps being breached, it doesn’t change anymore until it goes to safe and later is breached again. So “Detectie” simply states that the sensor is still breached, so it doesn’t seem strange that the “Laatst detectie” isn’t 0 seconds.

     

    Most of this isn’t necessary if you just wan’t to use it to set your Nest Thermostat to away or home with your Z-Wave sensors.

     

    To do that, you would still have to add something like this (after 30 minutes).

    I am assuming you have a global variable called “NESThome” which is “away” if your Nest Thermostat is set to “away” and “home” if the Thermostat is set to “home”.

    Please login or register to see this code.

     

    • 0
    Posted

    @TW1979  got a cut down f this runninjust to st the targetemp ofmy heating scene (as I wasusing IFTTT and sometimes it didn't fire).. any idea why it returns so many 307's before the 200?

    • 0
  • Inquirer
  • Posted

    @shaunfrost I don't really know, I normally only get 1 307( redirect) before the 200 (succes). You are not making requests / sending commands too fast, are you ?

    • 0
    Posted
    5 hours ago, TW1979 said:

    @shaunfrost I don't really know, I normally only get 1 307( redirect) before the 200 (succes). You are not making requests / sending commands too fast, are you ?

     

    I will slow it down and see.. thanks

    • 0
    Posted

    does this still work if not migrated to a Google account?

    • 0
    Posted

    Will this still work after "works with nest" shutdown on September 2023?

    Join the conversation

    You can post now and register later. If you have an account, sign in now to post with your account.

    Guest
    Answer this question...

    ×   Pasted as rich text.   Paste as plain text instead

      Only 75 emoji are allowed.

    ×   Your link has been automatically embedded.   Display as a link instead

    ×   Your previous content has been restored.   Clear editor

    ×   You cannot paste images directly. Upload or insert images from URL.

    ×
    ×
    • Create New...