Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {
- "id": 17,
- "name": "Licht Wohnzimmer",
- "roomID": 294,
- "type": "virtual_device",
- "visible": true,
- "enabled": true,
- "properties": {
- "categories": ["other"],
- "deviceIcon": 0,
- "ip": "\"\"",
- "port": 81,
- "categories": "[\"other\"]",
- "currentIcon": "0",
- "log": "",
- "logTemp": "",
- "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)",
- "ui.color.value": 71,
- "ui.dimm.value": 10,
- "visible": "true",
- "rows": [
- {
- "type": "slider",
- "elements": [
- {
- "id": 1,
- "lua": true,
- "waitForResponse": false,
- "caption": "Color",
- "name": "color",
- "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) ",
- "buttonIcon": 0,
- "value": 34,
- "favourite": false,
- "main": false
- }
- ]
- },
- {
- "type": "slider",
- "elements": [
- {
- "id": 2,
- "lua": true,
- "waitForResponse": false,
- "caption": "Dimm",
- "name": "dimm",
- "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) ",
- "buttonIcon": 0,
- "value": 0,
- "favourite": false,
- "main": true
- }
- ]
- }
- ]
- },
- "actions": { "pressButton": 1, "setSlider": 2 },
- "created": 1593535947,
- "modified": 1593535947,
- "sortOrder": 9
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement