Welcome to Smart Home Forum by FIBARO
Dear Guest,
as you can notice parts of Smart Home Forum by FIBARO is not available for you. You have to register in order to view all content and post in our community. Don't worry! Registration is a simple free process that requires minimal information for you to sign up. Become a part of of Smart Home Forum by FIBARO by creating an account.
As a member you can:
- Start new topics and reply to others
- Follow topics and users to get email updates
- Get your own profile page and make new friends
- Send personal messages
- ... and learn a lot about our system!
Regards,
Smart Home Forum by FIBARO Team
Search the Community
Showing results for tags 'lua scene'.
-
Challenge : LUA scene for KeyFob volume buttons
peterburgering posted a question in Scenes and Interface
Hi all, I have a HC2 and I am trying to connect my KeyFob to my Sonos Playbar to set the volume. I already have it working but now I am finetuning and cannot get to the end. I have programmed my "+" and "-" button on the KeyFob so that they set the volume up and down. But I want to have it more sophisticated. My goal is when I push "+" the volume goes up by 1 on every click. And goes down by 1 when clicking the "-" button. But I need some help with this. Does someone here know how I can create the correct LUA code for this?? Here below the current situation in the scene for the KeyFob: --[[ %% properties %% events 263 CentralSceneEvent %% globals --]] local sa = fibaro:getSourceTrigger()["event"]["data"] --fibaro:debug(json.encode(sa)) if ((sa['keyId'] == 1) and (sa['keyAttribute'] == 'Pressed')) then fibaro:debug('key1') end if ((sa['keyId'] == 1) and (sa['keyAttribute'] == 'Pressed2')) then fibaro:debug('key1 double') end if ((sa['keyId'] == 1) and (sa['keyAttribute'] == 'Pressed3')) then fibaro:debug('key1 triple') end if ((sa['keyId'] == 1) and (sa['keyAttribute'] == 'HeldDown')) then fibaro:debug('key1 held') end if ((sa['keyId'] == 1) and (sa['keyAttribute'] == 'Released')) then fibaro:debug('key1 release') end if ((sa['keyId'] == 2) and (sa['keyAttribute'] == 'Pressed')) then --fibaro:debug('key2') fibaro:call(348, "setMute", "1") end if ((sa['keyId'] == 2) and (sa['keyAttribute'] == 'Pressed2')) then --fibaro:debug('key2 double') fibaro:call(348, "setMute", "0") end if ((sa['keyId'] == 2) and (sa['keyAttribute'] == 'Pressed3')) then fibaro:debug('key2 triple') end if ((sa['keyId'] == 2) and (sa['keyAttribute'] == 'HeldDown')) then fibaro:debug('key2 held') end if ((sa['keyId'] == 2) and (sa['keyAttribute'] == 'Released')) then fibaro:debug('key2 release') end if ((sa['keyId'] == 3) and (sa['keyAttribute'] == 'Pressed')) then fibaro:debug('key3') end if ((sa['keyId'] == 3) and (sa['keyAttribute'] == 'Pressed2')) then fibaro:debug('key3 double') end if ((sa['keyId'] == 3) and (sa['keyAttribute'] == 'Pressed3')) then fibaro:debug('key3 triple') end if ((sa['keyId'] == 3) and (sa['keyAttribute'] == 'HeldDown')) then fibaro:debug('key3 held') end if ((sa['keyId'] == 3) and (sa['keyAttribute'] == 'Released')) then fibaro:debug('key3 release') end if ((sa['keyId'] == 4) and (sa['keyAttribute'] == 'Pressed')) then fibaro:debug('key4') end if ((sa['keyId'] == 4) and (sa['keyAttribute'] == 'Pressed2')) then fibaro:debug('key4 double') end if ((sa['keyId'] == 4) and (sa['keyAttribute'] == 'Pressed3')) then fibaro:debug('key4 triple') end if ((sa['keyId'] == 4) and (sa['keyAttribute'] == 'HeldDown')) then fibaro:debug('key4 held') end if ((sa['keyId'] == 4) and (sa['keyAttribute'] == 'Released')) then fibaro:debug('key4 release') end if ((sa['keyId'] == 5) and (sa['keyAttribute'] == 'Pressed')) then --fibaro:debug('key5') fibaro:call(348, "setVolume", "10") end if ((sa['keyId'] == 5) and (sa['keyAttribute'] == 'Pressed2')) then --fibaro:debug('key5 double') fibaro:call(348, "setVolume", "5") end if ((sa['keyId'] == 5) and (sa['keyAttribute'] == 'Pressed3')) then fibaro:debug('key5 triple') end if ((sa['keyId'] == 5) and (sa['keyAttribute'] == 'HeldDown')) then fibaro:debug('key5 held') end if ((sa['keyId'] == 5) and (sa['keyAttribute'] == 'Released')) then fibaro:debug('key5 release') end if ((sa['keyId'] == 6) and (sa['keyAttribute'] == 'Pressed')) then --fibaro:debug('key6') fibaro:call(348, "currentVolume", "12") end if ((sa['keyId'] == 6) and (sa['keyAttribute'] == 'Pressed2')) then --fibaro:debug('key6 double') fibaro:call(348, "setVolume", "15") end if ((sa['keyId'] == 6) and (sa['keyAttribute'] == 'Pressed3')) then --fibaro:debug('key6 triple') fibaro:call(348, "setVolume", "17") end if ((sa['keyId'] == 6) and (sa['keyAttribute'] == 'HeldDown')) then fibaro:debug('key6 held') end if ((sa['keyId'] == 6) and (sa['keyAttribute'] == 'Released')) then fibaro:debug('key6 release') end-
- lua scene
- sonos volume
-
(and 1 more)
Tagged with:
-
Hello, I need trigger my scene with event from ZIPATO keypad device even if the device doesn't change their value. Can anybody help me with using this option? I cannot find informations about this setting. Thanks --[[ %% autostart %% properties %% events %% globals --]]
-
Hi I would like to know the best practises to map a device id (based upon the known 'hometable' and another variable)? For example, see partial scene below. Each device has a specific timeout. The way I did in the main scene doesn't seems to be a best practise since I'm repeating again the device id, gathered from the hometable. Using the name (for example local BuzzerId = (jT.Woongedeelte.Buzzer)) neither (I think). But how should you do it in a way you can link the device id with a timeout value in your configuration setting of a scene so you an use it in a loop. Hope it's clear. Thanks. -- Main scene ---- -- loop through DevicesID's for i, id in ipairs(DevicesIDs) do -- Mapping between ID's and timeout if id == 76 then timeout = TimeOutBuzzer else if id == 91 then timeout = TimeOutFonteinSwitch else if id == 97 then timeout = TimeOutFontein else if id == 120 then timeout = TimeOutStroomBuiten else if id == 138 then timeout = TimeoutAlarmRGB end end end end end -- Check if the device is on, else end if (( tonumber(fibaro:getValue(id, "value")) > 0 )) then log("Device "..fibaro:getName(id).." With Id " ..id.." is active (On)") local tempDeviceState0, deviceLastModification0 = fibaro:get(id, "value"); -- Check if the device is on for longer then timeOuts, the switch off device. if (( tonumber(fibaro:getValue(id, "value")) > 0 ) and (os.time() - deviceLastModification0) >= timeout) then fibaro:call(id, "turnOff"); local Message = "Device " ..fibaro:getName(id).." With Id " ..id.." on for too long. Stopped." info("[INFO] Message is "..Message) fibaro:startScene(SMsgHsceneID, {Message, targetMail}) -- send SmMsg e-mail end end end
-
- mapping variables and device id
- lua scene
-
(and 1 more)
Tagged with:
-
disarm Alarm with a Scene when alarm is triggered
jcilissen posted a question in Scenes and Interface
Hi I have created 2 lua scenes to arm and disarm the alarm and this is triggered by a switch The intention is to replace the switch afterwards with a RFID keypad to trigger the 2 scenes I can arm and disarm the alarm with the switch So this is working .. no,problem so far But when the alarm is triggered to go off I can not start any scene any more So I can not disarm the alarm with the swicth anymore as the scene does not start anymore "Do not allow to stop Scene while alarm is running" is on But it not the same as "do allow to start Scene while alarm is running" The only way I found to disarm the alarm is via the PC, tablet or smartphone after giving the pincode I want also to disarm the alarm with the scene triggered by the switch ( RFID Keypad) Any ideas how to do it Thanks- 1 reply
-
- alarm
- RFID Keypad
-
(and 1 more)
Tagged with: