Hi,
On HC2 I used to have one virtual device to control all LED lights in room.
Turning On and Off should be no problem. But how to handle slider?
Assuming QA is working how to post action from HA Bridge to set appropriate value?
HC2 device:
and LUA:
Slider:
local slider = _sliderValue_
local jT = json.decode(fibaro:getGlobalValue("HomeTable")) -- REFERENCE TO DECODE TABLE
fibaro:debug('Slider value: ' .. slider)
-- Set both LED dim value
if tonumber(slider) == 0 then -- turn Off
fibaro:call(jT.hall.Light_LED_switch, 'turnOff');
fibaro:sleep(100);
fibaro:call(jT.hall.Light_LED_entrance, 'turnOff');
fibaro:sleep(100);
fibaro:call(jT.hall.Light_LED_dummy, 'turnOff')
else
fibaro:call(jT.hall.Light_LED_switch, 'setValue', slider);
fibaro:sleep(100);
fibaro:call(jT.hall.Light_LED_entrance, 'setValue', slider);
fibaro:sleep(100);
fibaro:call(jT.hall.Light_LED_dummy, 'turnOn')
end
OFF:
-- Set LED Off
local jT = json.decode(fibaro:getGlobalValue("HomeTable")) -- REFERENCE TO DECODE TABLE
selfId = fibaro:getSelfId();
fibaro:call(jT.hall.Light_LED_switch, 'turnOff');
fibaro:sleep(100);
fibaro:call(jT.hall.Light_LED_entrance, 'turnOff');
fibaro:sleep(100);
fibaro:call(jT.hall.Light_LED_dummy, 'turnOff')
fibaro:call(selfId, "setProperty", "ui.Slider1.value", 0);
MAX:
-- Set LED Max
local jT = json.decode(fibaro:getGlobalValue("HomeTable")) -- REFERENCE TO DECODE TABLE
selfId = fibaro:getSelfId();
fibaro:call(jT.hall.Light_LED_switch, 'setValue', 100);
fibaro:sleep(100);
fibaro:call(jT.hall.Light_LED_entrance, 'setValue', 100);
fibaro:sleep(100);
fibaro:call(jT.hall.Light_LED_dummy, 'turnOn')
fibaro:call(selfId, "setProperty", "ui.Slider1.value", 100);
In HA Bridge to set slider value I used for example:
http://
[email protected]:
[email protected]/api/callAction?deviceID=281&name=setSlider&arg1=6&arg2=${intensity.percent}
to click button:
http://
[email protected]:
[email protected]/api/callAction?deviceID=348&name=pressButton&arg1=1
Anyone can help on this or already have QA and can share so I can adopt it?
Is HA bridge command still the same as on HC2 or needs to be changes?