Advertisement
FALLINGAWAY38

chicken

Apr 16th, 2025
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.96 KB | None | 0 0
  1. sun:
  2. latitude: xx.0931
  3. longitude: -xx.8054
  4.  
  5. on_sunrise:
  6. - elevation: 0.8°
  7. then:
  8. - if:
  9. condition:
  10. - switch.is_on: automatic_chicken_door
  11. then:
  12. - button.press: button_on_sunrise
  13.  
  14. on_sunset:
  15. - elevation: -6°
  16. then:
  17. - if:
  18. condition:
  19. - switch.is_on: automatic_chicken_door
  20. then:
  21. - button.press: button_on_sunset
  22.  
  23.  
  24. binary_sensor:
  25. - platform: template
  26. id: door_opening
  27. name: "Door Opening"
  28.  
  29. - platform: template
  30. id: door_closing
  31. name: "Door Closing"
  32.  
  33. button:
  34.  
  35. - platform: template
  36. id: stop_while_moving
  37. name: "Stop Mid-Cycle"
  38. on_press:
  39. then:
  40. - if:
  41. condition:
  42. or:
  43. - switch.is_on: relay1
  44. - switch.is_on: relay2
  45. then:
  46. - switch.turn_off: relay1
  47. - switch.turn_off: relay2
  48.  
  49.  
  50. - platform: template
  51. id: manually_close
  52. name: "Manual Close"
  53. on_press:
  54. then:
  55. - switch.toggle: relay2
  56.  
  57. - platform: template
  58. id: manually_open
  59. name: "Manual Open"
  60. on_press:
  61. then:
  62. - switch.toggle: relay1
  63.  
  64.  
  65.  
  66.  
  67.  
  68. ##########################################################################################
  69. # End Stop
  70. ##########################################################################################
  71.  
  72. ##
  73. switch:
  74.  
  75.  
  76.  
  77. - platform: template
  78. id: automatic_chicken_door
  79. name: "Automatic Open/Close"
  80. optimistic: true
  81.  
  82.  
  83. - platform: gpio
  84. id: relay1
  85. # name: 'Relay 1'
  86. pin: GPIO0
  87. internal: true
  88. interlock: [relay2]
  89. on_turn_on:
  90. then:
  91. - if:
  92. condition:
  93. - switch.is_on: automatic_chicken_door
  94. then:
  95. - binary_sensor.template.publish:
  96. id: door_opening
  97. state: ON
  98.  
  99. - delay: 20s
  100. - switch.turn_off: relay1
  101. - binary_sensor.template.publish:
  102. id: door_opening
  103. state: OFF
  104.  
  105.  
  106. on_turn_off:
  107. then:
  108. - binary_sensor.template.publish:
  109. id: door_opening
  110. state: OFF
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118. - platform: gpio
  119. id: relay2
  120. # name: 'Relay 2'
  121. pin: GPIO2
  122. internal: true
  123. interlock: [relay1]
  124. on_turn_on:
  125. then:
  126. - if:
  127. condition:
  128. - switch.is_on: automatic_chicken_door
  129. then:
  130. - binary_sensor.template.publish:
  131. id: door_closing
  132. state: ON
  133. - delay: 20s
  134. - switch.turn_off: relay2
  135.  
  136. on_turn_off:
  137. then:
  138. - binary_sensor.template.publish:
  139. id: door_closing
  140. state: OFF
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement