Advertisement
Guest User

Untitled

a guest
Jul 17th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.48 KB | None | 0 0
  1. 1
  2. --[[
  3. 2
  4. %% autostart
  5. 3
  6. %% properties
  7. 4
  8. %% weather
  9. 5
  10. %% events
  11. 6
  12. %% globals
  13. 7
  14. --]]
  15. 8
  16.  
  17. 9
  18. local sourceTrigger = fibaro:getSourceTrigger();
  19. 10
  20. function tempFunc()
  21. 11
  22. local currentDate = os.date("*t");
  23. 12
  24. local startSource = fibaro:getSourceTrigger();
  25. 13
  26. if (
  27. 14
  28. ( ((currentDate.wday == 1 or currentDate.wday == 2 or currentDate.wday == 3 or currentDate.wday == 4 or currentDate.wday == 5 or currentDate.wday == 6 or currentDate.wday == 7) and string.format("%02d", currentDate.hour) .. ":" .. string.format("%02d", currentDate.min) == fibaro:getValue(1, "sunsetHour")) )
  29. 15
  30. )
  31. 16
  32. then
  33. 17
  34. fibaro:call(43, "close");
  35. 18
  36. fibaro:call(98, "close");
  37. 19
  38. fibaro:call(162, "close");
  39. 20
  40. fibaro:call(55, "close");
  41. 21
  42. fibaro:call(108, "close");
  43. 22
  44. fibaro:call(117, "close");
  45. 23
  46. fibaro:call(114, "close");
  47. 24
  48. fibaro:call(111, "close");
  49. 25
  50. end
  51. 26
  52.  
  53. 27
  54. setTimeout(tempFunc, 60*1000)
  55. 28
  56. end
  57. 29
  58. if (sourceTrigger["type"] == "autostart") then
  59. 30
  60. tempFunc()
  61. 31
  62. else
  63. 32
  64.  
  65. 33
  66. local currentDate = os.date("*t");
  67. 34
  68. local startSource = fibaro:getSourceTrigger();
  69. 35
  70. if (
  71. 36
  72. startSource["type"] == "other"
  73. 37
  74. )
  75. 38
  76. then
  77. 39
  78. fibaro:call(43, "close");
  79. 40
  80. fibaro:call(98, "close");
  81. 41
  82. fibaro:call(162, "close");
  83. 42
  84. fibaro:call(55, "close");
  85. 43
  86. fibaro:call(108, "close");
  87. 44
  88. fibaro:call(117, "close");
  89. 45
  90. fibaro:call(114, "close");
  91. 46
  92. fibaro:call(111, "close");
  93. 47
  94. end
  95. 48
  96.  
  97. 49
  98. end
  99. 50
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement