Advertisement
Guest User

Untitled

a guest
Jun 30th, 2020
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
JSON 3.74 KB | None | 0 0
  1. {
  2.   "id": 17,
  3.   "name": "Licht Wohnzimmer",
  4.   "roomID": 294,
  5.   "type": "virtual_device",
  6.   "visible": true,
  7.   "enabled": true,
  8.   "properties": {
  9.     "categories": ["other"],
  10.     "deviceIcon": 0,
  11.     "ip": "\"\"",
  12.     "port": 81,
  13.     "categories": "[\"other\"]",
  14.     "currentIcon": "0",
  15.     "log": "",
  16.     "logTemp": "",
  17.     "mainLoop": "RASP = Net.FHttp(\"192.168.100.110\", \"81\") \nRASP:setBasicAuthentication(\"daniel\", \"XXX\")\nlocal thisdevice = fibaro:getSelfId();\n\nlocal name = \"XXX\"\n\nlocal check = false\nwhile check == false do\n  response = RASP:GET('/api/variables/'..name..'.state');\n  check = pcall(function() return json.decode(response) end)\n  if check == false then\n    fibaro:debug(check)\n    fibaro:sleep(10000)\n  end\nend \n\nresponse = RASP:GET('/api/variables/'..name..'.state');\nresponse = json.decode(response)\nresponse = response.variable.value;\nif response == true then\n  response = RASP:GET('/api/variables/'..name..'.dimlevel');\n  response = json.decode(response);\n  response = response.variable.value;\n  response = math.floor(response+0.5);\n  fibaro:call(thisdevice, \"setProperty\", \"ui.dimm.value\", response);\nelse\n\tfibaro:call(thisdevice, \"setProperty\", \"ui.dimm.value\", 0);\nend\n\nresponse = RASP:GET('/api/variables/'..name..'.ct');\nresponse = json.decode(response);\n--response = pcall(function() return json.decode(response) end)\nresponse = response.variable.value;\nresponse = math.floor(response + 0.5);\nif response > 100 then\n  response = 100\nend\nif response < 0 then\n  response = 0\nend\nfibaro:call(thisdevice, \"setProperty\", \"ui.color.value\", response);\nfibaro:sleep(30000)",
  18.     "ui.color.value": 71,
  19.     "ui.dimm.value": 10,
  20.     "visible": "true",
  21.     "rows": [
  22.       {
  23.         "type": "slider",
  24.         "elements": [
  25.           {
  26.             "id": 1,
  27.             "lua": true,
  28.             "waitForResponse": false,
  29.             "caption": "Color",
  30.             "name": "color",
  31.             "msg": "RASP = Net.FHttp(\"192.168.100.110\", \"81\") \nRASP:setBasicAuthentication(\"daniel\", \"XXX\")\nlocal name = \"XXX\"\n\nlocal thisdevice = fibaro:getSelfId();\nlocal level = fibaro:getValue(thisdevice, \"ui.color.value\")\n--level = 153 + (level*3.47)\n\nresponse, status, errorCode = RASP:GET('/api/device/'..name..'/setCT?colorCode='..level)\n\ntime = os.date(\" - %H:%M Uhr\")\nfibaro:log(\"Dimm Set: \"..level..\"%\")\nfibaro:debug(\"Dimm Set: \"..level..\"%\"..\" \"..time) ",
  32.             "buttonIcon": 0,
  33.             "value": 34,
  34.             "favourite": false,
  35.             "main": false
  36.           }
  37.         ]
  38.       },
  39.       {
  40.         "type": "slider",
  41.         "elements": [
  42.           {
  43.             "id": 2,
  44.             "lua": true,
  45.             "waitForResponse": false,
  46.             "caption": "Dimm",
  47.             "name": "dimm",
  48.             "msg": "RASP = Net.FHttp(\"192.168.100.110\", \"81\") \nRASP:setBasicAuthentication(\"daniel\", \"XXX\")\nlocal name = \"XXX\"\n\nlocal thisdevice = fibaro:getSelfId();\nlocal level = tonumber(fibaro:getValue(thisdevice, \"ui.dimm.value\"))\n\nif level <= 0 then\n\tresponse, status, errorCode = RASP:GET('/api/device/'..name..'/turnOff')\nelse\n  \tresponse, status, errorCode = RASP:GET('/api/device/'..name..'/turnOn')\n\tresponse, status, errorCode = RASP:GET('/api/device/'..name..'/changeDimlevelTo?dimlevel='..level)\nend\n\ntime = os.date(\" - %H:%M Uhr\")\nfibaro:log(\"Dimm Set: \"..level..\"%\")\nfibaro:debug(\"Dimm Set: \"..level..\"%\"..\" \"..time) ",
  49.             "buttonIcon": 0,
  50.             "value": 0,
  51.             "favourite": false,
  52.             "main": true
  53.           }
  54.         ]
  55.       }
  56.     ]
  57.   },
  58.   "actions": { "pressButton": 1, "setSlider": 2 },
  59.   "created": 1593535947,
  60.   "modified": 1593535947,
  61.   "sortOrder": 9
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement