Advertisement
boomx

Tür offen/geschlossen

Jan 17th, 2016
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. --[[
  2. %% properties
  3. 55 value
  4. %% globals
  5. --]]
  6.  
  7. doorID = 55
  8. doorlockID = 215
  9.  
  10. local door = fibaro:getValue(doorID, 'value')
  11. local trigger = fibaro:getSourceTrigger()
  12.  
  13. if (tonumber(fibaro:countScenes())>1) then
  14. fibaro:debug('Kill second scene!')
  15. fibaro:abort()
  16. end
  17.  
  18. if (trigger['type']=='property') then
  19. -- TÜR-TRIGGER
  20. if (tonumber(trigger['deviceID'])==tonumber(doorID)) then
  21. -- TÜR GEÖFFNET
  22. if (tonumber(door)==1 and fibaro:getGlobal('danalock') == 'unsecure') then
  23. fibaro:debug('Haustür geöffnet. doorlock war offen.')
  24. while (tonumber(fibaro:getValue(doorID, 'value')) > 0) do
  25. fibaro:debug('Haustür noch geöffnet.')
  26. fibaro:sleep(1*1000)
  27. end
  28. fibaro:setGlobal('danalock', 'secure')
  29. fibaro:call(doorlockID, 'secure')
  30. fibaro:debug('doorlock wieder geschlossen.')
  31. elseif (tonumber(door)==1 and fibaro:getGlobal('danalock') == 'secure') then
  32. fibaro:debug('doorlock ist sicher.')
  33. end
  34. end
  35. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement