Jump to content

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 'WallSwitch'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • FIBARO Community
    • FIBARO Portal and Forum policy
    • FIBARO
    • Say hello!
    • Off-topics
  • FIBARO Update
    • FIBARO System Update
    • FIBARO Mobile Update
  • FIBARO Community Support
    • Scenes and Interface
    • FIBARO Products
    • FIBARO Mobile
    • FIBARO HomeKit
    • FIBARO Assistant Integrations
    • Other Devices / Third-party devices
    • Tutorials and Guides
    • Home Automation
    • Suggestions
  • FIBARO Społeczność
    • FIBARO
    • Przywitaj się!
    • Off-topic
  • FIBARO Aktualizacja
    • FIBARO System Aktualizacja
    • FIBARO Mobile Aktualizacja
  • FIBARO Wsparcie Społeczności
    • Sceny i Interfejs
    • FIBARO Urządzenia
    • FIBARO Mobilnie
    • FIBARO HomeKit
    • Integracja z Amazon Alexa i Google Home
    • Urządzenia Firm Trzecich
    • Poradniki
    • Automatyka Domowa
    • Sugestie

Categories

  • Scenes
  • Virtual Devices
  • Quick Apps
  • Icons

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Facebook


Google+


Skype


Website URL


WhatsApp


Country


Gateway/s


Interests

Found 1 result

  1. Hi there, I just started to explore LUA. Last week i bought a NoDon WallSwitch (4 buttons, 4 functions per button: SinglePress, DoublePress, Hold, Release). I needed to program it to start separate scenes (this was the easy part) and also be able to use the Hold/Release option to set 2 dimmers separately to a specific level. I could not find any samples, so i decided to write my own (actually by first own LUA script). Please have a look (reuse it for your own is much appreciated). Any comments or feedback is appreciated. --[[ %% properties 166 sceneActivation %% globals --]] -- Change the value below to match the ID of the wall switch of your choice local WallSwitch = 166 -- NOTE : Change the value also in the header to match the ID of the wallswitch -- LUA code for NoDON WallSwitch (4 buttons, 4 triggers each : SinlgePress, DoublePress, HoldPress, HoldRelease) -- Hans Somers , v0.6 , 14AUG2016 -- v0.1 Button 1,2,3,4 are programmed to start a separate scene with Single or Double press -- v0.3 Button 2 and 4 are programmed for PressHold to set a dimmer to desired level -- Button layout (this is for NoDon Wall Switch) -- Button SP DP HP HR -- Button 1 10 13 12 11 -- Button 2 20 23 22 21 -- Button 3 30 33 32 31 -- Button 4 40 43 42 41 local ButtonPressed = tonumber(fibaro:getValue(WallSwitch, 'sceneActivation')) -- Declare button values (change this for other switches) local Button1_SP = 10 local Button1_DP = 13 local Button1_HP = 12 local Button1_HR = 11 local Button2_SP = 20 local Button2_DP = 23 local Button2_HP = 22 local Button2_HR = 21 local Button3_SP = 30 local Button3_DP = 33 local Button3_HP = 32 local Button3_HR = 31 local Button4_SP = 40 local Button4_DP = 43 local Button4_HP = 42 local Button4_HR = 41 -- Scene IDs for scenes to trigger with Single Press or Double Press local SC_Scene01 = 9 local SC_Scene02 = 10 local SC_Scene03 = 17 local SC_Scene04 = 19 local SC_Scene05 = 12 local SC_Scene06 = 11 local SC_Scene07 = 20 local SC_Scene08 = 21 -- Dimmer 1 to be set using HoldPress, change this to your Dimmer device local ID_Dimmer01 = 157 -- Start level for dimmer 1 local LV_Dimmer01 = 0 -- Increment value for dimmer 1 local IN_Dimmer01 = 5 -- Max value for dimmer 1 local MX_Dimmer01 = 100 -- Dimmer 2 to be set using HoldPress, change this to your Dimmer device local ID_Dimmer02 = 161 -- Start level for dimmer local LV_Dimmer02 = 0 -- Increment value for dimmer local IN_Dimmer02 = 5 -- Max value for dimmer local MX_Dimmer02 = 100 if ButtonPressed == Button1_SP then -- Start scene for Single Press Button 1 fibaro:startScene(SC_Scene01) elseif ButtonPressed == Button1_DP then -- Start scene for Double Press Button 1 fibaro:startScene(SC_Scene02) elseif ButtonPressed == Button2_SP then -- Start scene for Single Press Button 2 fibaro:startScene(SC_Scene03) elseif ButtonPressed == Button2_HP then -- Press and Hold Button 2 to set the Dimmer level -- Turn Lamp on at current dimm level fibaro:call(ID_Dimmer01,'turnOn') while ButtonPressed == Button2_HP do -- if Max level reached reset to 0 if LV_Dimmer01 >= MX_Dimmer01 then LV_Dimmer01 = 0 end -- Set lamp to desired level fibaro:call(ID_Dimmer01,'setValue',LV_Dimmer01) -- Increase LampLevel with IN_Dimmer01 % LV_Dimmer01 = LV_Dimmer01 + IN_Dimmer01 -- wait 0,5 sec fibaro:sleep(300) -- Check again for Button Pressed ButtonPressed = tonumber(fibaro:getValue(WallSwitch, 'sceneActivation')) end elseif ButtonPressed == Button2_HR then -- Do Nothing elseif ButtonPressed == Button2_DP then -- Start scene for Double Press Button 2 fibaro:startScene(SC_Scene04) elseif ButtonPressed == Button3_SP then -- Start scene for Single Press Button 3 fibaro:startScene(SC_Scene05) elseif ButtonPressed == Button3_DP then -- Start scene for Double Press Button 3 fibaro:startScene(SC_Scene06) elseif ButtonPressed == Button4_SP then -- Start scene for Single Press Button 4 fibaro:startScene(SC_Scene07) elseif ButtonPressed == Button4_HP then -- Section for Press and hold Button 4 to set dimmer to specified level by holding the button -- Turn Lamp on fibaro:call(ID_Dimmer02,'turnOn') while ButtonPressed == Button4_HP do -- if Max level reached reset to 0 if LV_Dimmer02 == MX_Dimmer02 then LV_Dimmer02 = 0 end -- Set lamp to desired level fibaro:call(ID_Dimmer02,'setValue',LV_Dimmer02) -- Increase LampLevel with IN_Dimmer01 % LV_Dimmer02 = LV_Dimmer02 + IN_Dimmer02 -- wait 0,5 sec fibaro:sleep(300) ButtonPressed = tonumber(fibaro:getValue(WallSwitch, 'sceneActivation')) end elseif ButtonPressed == Button4_HR then -- Do Nothing elseif ButtonPressed == Button4_DP then -- Start scene for Double Press Button 4 fibaro:startScene(SC_Scene08) else fibaro:debug('Error, unknown button pressed:' .. ButtonPressed) if ShowDebug == 1 then fibaro:debug(ButtonPressed) end end
×
×
  • Create New...