{"name":"IR MODULE","type":"virtual_device","properties":{"deviceIcon":1127,"categories":"[\"other\"]","currentIcon":"0","log":"","logTemp":"","mainLoop":"","ui.Slider1.value":28,"ui.hSwing.value":"МИН","ui.mode.value":"ОХЛ","ui.speed.value":"МИН","ui.temp.value":"21","ui.vSwing.value":"МИН","visible":"true","rows":[{"type":"label","elements":[{"id":1,"lua":false,"waitForResponse":false,"caption":"РЕЖИМ:","name":"mode","favourite":false,"main":false}]},{"type":"button","elements":[{"id":2,"lua":true,"waitForResponse":false,"caption":"ВЫКЛ","name":"Button11","empty":false,"msg":"fibaro:call(fibaro:getSelfId(), \"setProperty\", \"ui.mode.value\", \"ВЫКЛ\");\nfibaro:call(fibaro:getSelfId(), \"pressButton\", \"25\");\n","buttonIcon":0,"favourite":false,"main":false},{"id":3,"lua":true,"waitForResponse":false,"caption":"ОХЛ","name":"Button12","empty":false,"msg":"fibaro:call(fibaro:getSelfId(), \"setProperty\", \"ui.mode.value\", \"ОХЛ\");\nfibaro:call(fibaro:getSelfId(), \"pressButton\", \"25\");\n","buttonIcon":0,"favourite":false,"main":false},{"id":4,"lua":true,"waitForResponse":false,"caption":"НАГР","name":"Button13","empty":false,"msg":"fibaro:call(fibaro:getSelfId(), \"setProperty\", \"ui.mode.value\", \"НАГР\");\nfibaro:call(fibaro:getSelfId(), \"pressButton\", \"25\");","buttonIcon":0,"favourite":false,"main":false},{"id":5,"lua":true,"waitForResponse":false,"caption":"ВЕНТ","name":"Button14","empty":false,"msg":"fibaro:call(fibaro:getSelfId(), \"setProperty\", \"ui.mode.value\", \"ВЕНТ\");\nfibaro:call(fibaro:getSelfId(), \"pressButton\", \"25\");","buttonIcon":0,"favourite":false,"main":false}]},{"type":"label","elements":[{"id":6,"lua":false,"waitForResponse":false,"caption":"ТЕМПЕРАТУРА:","name":"temp","favourite":false,"main":false}]},{"type":"slider","elements":[{"id":7,"lua":true,"waitForResponse":false,"caption":"","name":"Slider1","msg":"function map_range( a1, a2, b1, b2, s )\n  return math.floor(b1 + (s-a1)*(b2-b1)/(a2-a1))\nend\n\nlocal value = map_range(0, 100, 18, 30, _sliderValue_ );\n\nfibaro:call(fibaro:getSelfId(), \"setProperty\", \"ui.temp.value\", value);\nfibaro:call(fibaro:getSelfId(), \"pressButton\", \"25\");","buttonIcon":0,"value":28,"favourite":false,"main":false}]},{"type":"label","elements":[{"id":8,"lua":false,"waitForResponse":false,"caption":"СКОРОСТЬ ВЕНТ:","name":"speed","favourite":false,"main":false}]},{"type":"button","elements":[{"id":9,"lua":true,"waitForResponse":false,"caption":"АВТО","name":"Button21","empty":false,"msg":"fibaro:call(fibaro:getSelfId(), \"setProperty\", \"ui.speed.value\", \"АВТО\");\nfibaro:call(fibaro:getSelfId(), \"pressButton\", \"25\");","buttonIcon":0,"favourite":false,"main":false},{"id":10,"lua":true,"waitForResponse":false,"caption":"МИН","name":"Button22","empty":false,"msg":"fibaro:call(fibaro:getSelfId(), \"setProperty\", \"ui.speed.value\", \"МИН\");\nfibaro:call(fibaro:getSelfId(), \"pressButton\", \"25\");","buttonIcon":0,"favourite":false,"main":false},{"id":11,"lua":true,"waitForResponse":false,"caption":"СРЕД","name":"Button23","empty":false,"msg":"fibaro:call(fibaro:getSelfId(), \"setProperty\", \"ui.speed.value\", \"СРЕД\");\nfibaro:call(fibaro:getSelfId(), \"pressButton\", \"25\");","buttonIcon":0,"favourite":false,"main":false},{"id":12,"lua":true,"waitForResponse":false,"caption":"ВЫС","name":"Button24","empty":false,"msg":"fibaro:call(fibaro:getSelfId(), \"setProperty\", \"ui.speed.value\", \"ВЫС\");\nfibaro:call(fibaro:getSelfId(), \"pressButton\", \"25\");","buttonIcon":0,"favourite":false,"main":false}]},{"type":"label","elements":[{"id":13,"lua":false,"waitForResponse":false,"caption":"ЛОПАСТИ ВЕРТ:","name":"vSwing","favourite":false,"main":false}]},{"type":"button","elements":[{"id":14,"lua":true,"waitForResponse":false,"caption":"АВТ","name":"Button31","empty":false,"msg":"fibaro:call(fibaro:getSelfId(), \"setProperty\", \"ui.vSwing.value\", \"АВТО\");\nfibaro:call(fibaro:getSelfId(), \"pressButton\", \"25\");","buttonIcon":0,"favourite":false,"main":false},{"id":15,"lua":true,"waitForResponse":false,"caption":"МИН","name":"Button32","empty":false,"msg":"fibaro:call(fibaro:getSelfId(), \"setProperty\", \"ui.vSwing.value\", \"МИН\");\nfibaro:call(fibaro:getSelfId(), \"pressButton\", \"25\");","buttonIcon":0,"favourite":false,"main":false},{"id":16,"lua":true,"waitForResponse":false,"caption":"СРЕ","name":"Button33","empty":false,"msg":"fibaro:call(fibaro:getSelfId(), \"setProperty\", \"ui.vSwing.value\", \"СРЕД\");\nfibaro:call(fibaro:getSelfId(), \"pressButton\", \"25\");","buttonIcon":0,"favourite":false,"main":false},{"id":17,"lua":true,"waitForResponse":false,"caption":"ВЫС","name":"Button34","empty":false,"msg":"fibaro:call(fibaro:getSelfId(), \"setProperty\", \"ui.vSwing.value\", \"ВЫС\");\nfibaro:call(fibaro:getSelfId(), \"pressButton\", \"25\");","buttonIcon":0,"favourite":false,"main":false},{"id":18,"lua":true,"waitForResponse":false,"caption":"ВЫК","name":"Button35","empty":false,"msg":"fibaro:call(fibaro:getSelfId(), \"setProperty\", \"ui.vSwing.value\", \"ВЫК\");\nfibaro:call(fibaro:getSelfId(), \"pressButton\", \"25\");","buttonIcon":0,"favourite":false,"main":false}]},{"type":"label","elements":[{"id":19,"lua":false,"waitForResponse":false,"caption":"ЛОПАСТИ ГОРИЗ:","name":"hSwing","favourite":false,"main":false}]},{"type":"button","elements":[{"id":20,"lua":true,"waitForResponse":false,"caption":"АВТ","name":"Button41","empty":false,"msg":"fibaro:call(fibaro:getSelfId(), \"setProperty\", \"ui.hSwing.value\", \"АВТ\");\nfibaro:call(fibaro:getSelfId(), \"pressButton\", \"25\");","buttonIcon":0,"favourite":false,"main":false},{"id":21,"lua":true,"waitForResponse":false,"caption":"МИН","name":"Button42","empty":false,"msg":"fibaro:call(fibaro:getSelfId(), \"setProperty\", \"ui.hSwing.value\", \"МИН\");\nfibaro:call(fibaro:getSelfId(), \"pressButton\", \"25\");","buttonIcon":0,"favourite":false,"main":false},{"id":22,"lua":true,"waitForResponse":false,"caption":"СРЕ","name":"Button43","empty":false,"msg":"fibaro:call(fibaro:getSelfId(), \"setProperty\", \"ui.hSwing.value\", \"СРЕД\");\nfibaro:call(fibaro:getSelfId(), \"pressButton\", \"25\");","buttonIcon":0,"favourite":false,"main":false},{"id":23,"lua":true,"waitForResponse":false,"caption":"ВЫС","name":"Button44","empty":false,"msg":"fibaro:call(fibaro:getSelfId(), \"setProperty\", \"ui.hSwing.value\", \"ВЫС\");\nfibaro:call(fibaro:getSelfId(), \"pressButton\", \"25\");","buttonIcon":0,"favourite":false,"main":false},{"id":24,"lua":true,"waitForResponse":false,"caption":"ВЫК","name":"Button45","empty":false,"msg":"fibaro:call(fibaro:getSelfId(), \"setProperty\", \"ui.hSwing.value\", \"ВЫК\");\nfibaro:call(fibaro:getSelfId(), \"pressButton\", \"25\");","buttonIcon":0,"favourite":false,"main":false}]},{"type":"button","elements":[{"id":25,"lua":true,"waitForResponse":false,"caption":"ОТПРАВИТЬ","name":"Button51","empty":false,"msg":"local mode\t\t= fibaro:getValue(fibaro:getSelfId(), \"ui.mode.value\");\nlocal temp\t\t= fibaro:getValue(fibaro:getSelfId(), \"ui.temp.value\");\nlocal speed\t\t= fibaro:getValue(fibaro:getSelfId(), \"ui.speed.value\");\nlocal vSwing\t= fibaro:getValue(fibaro:getSelfId(), \"ui.vSwing.value\");\nlocal hSwing\t= fibaro:getValue(fibaro:getSelfId(), \"ui.hSwing.value\");\n\nfibaro:debug(\"Mode: \" .. mode);\nfibaro:debug(\"Temp: \" .. temp);\nfibaro:debug(\"Speed: \" .. speed);\nfibaro:debug(\"vSwing: \" .. vSwing);\nfibaro:debug(\"hSwing: \" .. hSwing);\n\nlocal selfId\t = fibaro:getSelfId();\nlocal ip\t\t = fibaro:get(selfId, 'IPAddress');\nlocal port\t\t = fibaro:get(selfId, 'TCPPort');\nlocal connection = Net.FHttp(ip, port);\n\nlocal login = \"admin\";\nlocal password = \"admin\";\n\nlocal params\t= {};\nparams.Vendor\t= \"Whirlpool_ac\";\nparams.Temp\t\t= temp;\n\n\tif (mode == \"ВЫКЛ\")\n \t then\n  \t\tparams.Power = \"off\";\n  \t\tparams.Mode = \"off\";\n\n\telseif (mode == \"ОХЛ\")\n  \t then\n  \t\tparams.Power = \"on\";\n  \t\tparams.Mode = \"cool\";\n  \t\t\n\telseif (mode == \"НАГР\")\n  \t then\n  \t\tparams.Power = \"on\";\n  \t\tparams.Mode = \"heat\";\n\telseif (mode == \"ВЕНТ\")\n  \t then\n  \t\tparams.Power = \"on\";\n  \t\tparams.Mode = \"fan\";\n  \t end\n\n\n\tif (speed == \"АВТО\")\n \t then\n  \t\tparams.FanSpeed = \"auto\";\n\n\telseif (speed == \"МИН\")\n  \t then\n  \t\tparams.FanSpeed = \"min\";\n  \t\t\n\telseif (speed == \"СРЕД\")\n  \t then\n  \t\tparams.FanSpeed = \"medium\";\n\n\telseif (speed == \"ВЫС\")\n  \t then\n  \t\tparams.FanSpeed = \"high\";\n  \t end\n\n\n\tif (vSwing == \"АВТ\")\n \t then\n  \t\tparams.SwingV = \"auto\";\n\n\telseif (vSwing == \"МИН\")\n  \t then\n  \t\tparams.SwingV = \"lowest\";\n  \t\t\n\telseif (vSwing == \"СРЕД\")\n  \t then\n  \t\tparams.SwingV = \"middle\";\n\n\telseif (vSwing == \"ВЫС\")\n  \t then\n  \t\tparams.SwingV = \"high\";\n  \n  \telseif (vSwing == \"ВЫК\")\n  \t then\n  \t\tparams.SwingV = \"off\";\n  \t end\n\n\n\t\tif (hSwing == \"АВТ\")\n \t then\n  \t\tparams.SwingH = \"auto\";\n\n\telseif (hSwing == \"МИН\")\n  \t then\n  \t\tparams.SwingH = \"lowest\";\n  \t\t\n\telseif (hSwing == \"СРЕД\")\n  \t then\n  \t\tparams.SwingH = \"middle\";\n\n\telseif (hSwing == \"ВЫС\")\n  \t then\n  \t\tparams.SwingH = \"high\";\n  \n  \telseif (hSwing == \"ВЫК\")\n  \t then\n  \t\tparams.SwingH = \"off\";\n  \t end\n\nlocal s\t\t\t= json.encode(params);\n--fibaro:debug(s);\n\nlocal command \t= \"/cm?user=\" .. login .. \"&password=\" .. password .. \"&cmnd=irhvac%20\" .. s;\nfibaro:debug(command);\n\n\nlocal response, statusCon, err = connection:GET(command);\nfibaro:debug(response);\n--connection:disconnect();","buttonIcon":0,"favourite":false,"main":false}]}]},"actions":{"pressButton":1,"setSlider":2,"setProperty":2}}