Advertisement
Guest User

VD

a guest
Sep 29th, 2015
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. -- Setting up the connection data
  2. FHTE = Net.FHttp("PHP_SERVER_IP")
  3.  
  4. -- geting netatmo data
  5. response = FHTE:GET("/netatmo/welcome.php")
  6.  
  7. if response ~= "" then
  8.  
  9. -- decoding json string to table
  10. result = json.decode(response)
  11.  
  12. time = result.body.homes[1].events[1].time;
  13. message = result.body.homes[1].events[1].message;
  14.  
  15. time_current = result.body.homes[1].cameras[1].time_server;
  16.  
  17. time = (os.date("%x - %X",time))
  18. time_current = (os.date("%x - %X",time_current))
  19.  
  20. message = string.gsub(message, "<b>", "")
  21. message = string.gsub(message, "</b>", "")
  22.  
  23. fibaro:call(705, "setProperty", "ui.time.value", time);
  24. fibaro:call(705, "setProperty", "ui.message.value", message);
  25. fibaro:call(705, "setProperty", "ui.timeserver.value", time_current);
  26.  
  27. fibaro:setGlobal("Seen", message);
  28.  
  29. if fibaro:getGlobalValue("Seen") == "NAME1 seen" then
  30. fibaro:call(705, "setProperty", "ui.name1.value", time);
  31. --fibaro:call(705, "setProperty", "currentIcon", 657)
  32. end
  33.  
  34. --if fibaro:getGlobalValue("Seen") == "NAME2 seen" then
  35. -- fibaro:call(705, "setProperty", "ui.name2.value", time);
  36. -- --fibaro:call(705, "setProperty", "currentIcon", 658)
  37. --end
  38.  
  39. fibaro:debug(time);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement