h_tag

Lua-Scene

Jan 31st, 2016
287
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.33 KB | None | 0 0
  1. --[[
  2. %% properties
  3.  
  4. %% globals
  5. --]]
  6.  
  7. -- 180 is the Virtual Device ID
  8. -- 28 is the Process button ID
  9.  
  10. local sid, bid = 180, 28
  11. local temp=tostring(fibaro:getGlobalValue("OWM_Temp"));
  12. fibaro:debug(temp);
  13. tempcurr=string.gsub(temp, "%.", ",", 1);
  14. fibaro:debug(tempcurr);
  15. -- Create TTS params object
  16. local params = {
  17.  
  18. --TTS Message
  19.  
  20. message = "Die aktuelle Temperatur draußen beträgt "..tempcurr.."°Celsius.",  
  21.  
  22. duration = 'auto',  -- Duration: "auto", xx seconds
  23. language = "de-DE", -- Language: see http://www.voicerss.org/api/documentation.aspx to get your language code
  24.  
  25. volume = 35         -- Volume
  26.  
  27. }
  28.  
  29. local _f = fibaro
  30.  
  31. local _x ={root="x_sonos_object",load=function(b)local c=_f:getGlobalValue(b.root)if string.len(c)>0 then local d=json.decode(c)if d and type(d)=="table"then return d else _f:debug("Unable to process data, check variable")end else _f:debug("No data found!")end end,set=function(b,e,d)local f=b:load()if f[e]then for g,h in pairs(d)do f[e][g]=h end else f[e]=d end;_f:setGlobal(b.root,json.encode(f))end,get=function(b,e)local f=b:load()if f and type(f)=="table"then for g,h in pairs(f)do if tostring(g)==tostring(e or"")then return h end end end;return nil end}
  32.  
  33. -- Make a request to the remote to process params object instantly
  34.  
  35. _x:set(tostring(sid), { tts = params })
  36.  
  37. _f:call(sid, "pressButton", bid)
Advertisement
Add Comment
Please, Sign In to add comment