This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Nest Thermostat
#1
Hi,

Does anyone tried to link LM to Google's Nest thermostat?

If yes, can you post scripting to connect to the (online/cloud) API?

Thanks!

BR,

Erwin van der Zwart
Reply
#2
First, you need to get auth token, after that it's pretty simple with HTTP requests.
Nest docs:
https://developer.nest.com/documentation...ick-guide/

Here's a short code sample:
Code:
function request()
  local auth, url, res, stat, hdrs

  require('json')
  require('ssl.https')

  auth = '...'

  url = 'https://developer-api.nest.com/devices.json?auth=' .. auth
  res, stat, hdrs = ssl.https.request(url)

  if stat == 307 then
    res = ssl.https.request(hdrs.location)
  end

  return json.decode(res)
end

res, data = pcall(request)
log(data)
Reply
#3
Hi,

Thanks for the info, i have a fully working connection with the REST APIĀ (read and write)

Going to add Firebase now to bypass the API call maximum (:

BR,

Erwin

Attached Files
.lua   Nest thermostat with bidirectional communication.lua (Size: 14.56 KB / Downloads: 73)
Reply


Forum Jump: