Advertisement
boomx

Fibaro KeyFob v.01

Mar 15th, 2017
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.85 KB | None | 0 0
  1. --[[
  2. %% properties
  3. %% events
  4. 614 CentralSceneEvent
  5. %% globals
  6. --]]
  7.  
  8. function call_action1()
  9. if (fibaro:getGlobal('PresentState') == 'Home') then
  10. fibaro:debug('Jemand zu Hause. Öffne Tür.')
  11. fibaro:call(531, "unsecure")
  12. end
  13. end
  14.  
  15. function call_action2()
  16. end
  17.  
  18. function call_action3()
  19. end
  20.  
  21. function call_action4()
  22. end
  23.  
  24. function call_action5()
  25. end
  26.  
  27. function call_action6()
  28. end
  29.  
  30. Debug = function ( color, message )
  31. fibaro:debug(string.format('<%s style="color:%s;">%s', "span", color, message, "span"))
  32. end
  33.  
  34. fibaro:debug('Fibaro KeyFob - Szene gestartet...')
  35.  
  36. Debug( 'green', '- siio.de - Dein Smart Home Blog -')
  37.  
  38. local swipe_source = fibaro:getSourceTrigger()["event"]["data"] --Obtain data about the event
  39. --fibaro:debug("Key " .. swipe_source["keyId"] .. " Attr " .. swipe_source["keyAttribute"])
  40.  
  41. if (swipe_source["keyId"] == 1 and swipe_source["keyAttribute"] == 'Pressed') then
  42. fibaro:debug('Taste 1 gedrückt')
  43. call_action1()
  44. elseif (swipe_source["keyId"] == 2 and swipe_source["keyAttribute"] == 'Pressed') then
  45. fibaro:debug('Taste 2 gedrückt')
  46. call_action2()
  47. elseif (swipe_source["keyId"] == 3 and swipe_source["keyAttribute"] == 'Pressed') then
  48. fibaro:debug('Taste 3 gedrückt')
  49. call_action3()
  50. elseif (swipe_source["keyId"] == 4 and swipe_source["keyAttribute"] == 'Pressed') then
  51. fibaro:debug('Taste 4 gedrückt')
  52. call_action4()
  53. elseif (swipe_source["keyId"] == 5 and swipe_source["keyAttribute"] == 'Pressed') then
  54. fibaro:debug('Taste 5 gedrückt')
  55. call_action5()
  56. elseif (swipe_source["keyId"] == 6 and swipe_source["keyAttribute"] == 'Pressed') then
  57. fibaro:debug('Taste 6 gedrückt')
  58. call_action6()
  59. end
  60.  
  61. --[[
  62. while (swipe_source["keyId"] == 1 and swipe_source["keyAttribute"] == 'HeldDown') do
  63. fibaro:debug('WallMote Taste 1 gedrückt gehalten')
  64. fibaro:sleep(2*1000)
  65. end
  66. --]]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement