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.

Read Data from Table
#3
Thanks for your answer, but it doesn't work, I think my script is bad I've only paste your answer after an other script from you about nest thermostat:


"
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)

alarms = data['smoke_co_alarms']['sgUHZf.....APJP7e2-z........Y']

co_alarm_ok = alarms['co_alarm_state'] == 'ok'
grp.update('1/1/1', co_alarm_ok, dt.bool)
"

But I think it's not the good way .. I have to create an other script ? or an other variable ?
Reply


Messages In This Thread
Read Data from Table - by Alphaplasti - 28.11.2017, 08:12
RE: Read Data from Table - by admin - 28.11.2017, 09:14
RE: Read Data from Table - by Alphaplasti - 28.11.2017, 10:53
RE: Read Data from Table - by admin - 28.11.2017, 11:45
RE: Read Data from Table - by Alphaplasti - 28.11.2017, 13:58
RE: Read Data from Table - by admin - 28.11.2017, 14:28
RE: Read Data from Table - by Alphaplasti - 28.11.2017, 15:10
RE: Read Data from Table - by toujour - 14.02.2020, 07:47
RE: Read Data from Table - by AlexD - 11.10.2022, 09:02
RE: Read Data from Table - by admin - 11.10.2022, 09:24

Forum Jump: