M_St

ESPHome - sprinkler on 8-relay board

Jul 28th, 2025
468
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 5.18 KB | None | 0 0
  1. esp8266:
  2.   board: esp12e  # d1_mini, esp01_1m, d1_mini_pro, esp12e/esp07s (8 relays)
  3.   restore_from_flash: true
  4.  
  5. # Enable logging
  6. logger:
  7. mqtt:
  8.   broker: !secret mqtt_broker
  9.   port: !secret mqtt_port
  10.   username: !secret mqtt_username
  11.   password: !secret mqtt_password
  12.   discovery_unique_id_generator: mac
  13.    
  14.  
  15. # relays: (H - high at boot: 1+6 at reset, 1+3+4+6 at boot)
  16. # 1 H - main OFF
  17. # 2 - - main ON
  18. # 3 H - terrace
  19. # 4 H - greenhouse
  20. # 5 - - ?
  21. # 6 H - ?
  22. # 7 - - ? heating for pipe under terrace
  23. # 8 - - ? heating for water dispenser for cats
  24.  
  25. switch:
  26.   - platform: gpio
  27.     pin: GPIO16            # high at boot ----> use for OFF
  28.     name: "R1 - Zawór główny OFF"  # pump / main OFF
  29.     id: relay1_main_off
  30.     inverted: false
  31.     icon: mdi:pipe-valve
  32.     restore_mode: ALWAYS_OFF
  33.   - platform: gpio
  34.     pin: GPIO14
  35.     name: "R2 - Zawór główny ON"   # pump / main ON
  36.     id: relay2_main_on
  37.     inverted: false
  38.     icon: mdi:pipe-valve
  39.     restore_mode: ALWAYS_OFF
  40.   - platform: gpio
  41.     pin: GPIO12          # high at boot
  42.     name: "R3 - Zawór taras"         # Valve 1 - terrace
  43.     id: relay3_valve_terrace
  44.     inverted: false
  45.     icon: mdi:sprinkler
  46.     restore_mode: ALWAYS_OFF
  47.   - platform: gpio
  48.     pin: GPIO13          # high at boot
  49.     name: "R4 - Zawór szklarnia"         # Valve 2 - greenhouse
  50.     id: relay4_valve_greenhouse
  51.     inverted: false
  52.     icon: mdi:sprinkler
  53.     restore_mode: ALWAYS_OFF
  54.   - platform: gpio
  55.     pin: GPIO15          # ?
  56.     name: "R5 - ?"        
  57.     id: relay5
  58.     icon: mdi:deactivated
  59.     restore_mode: ALWAYS_OFF
  60.   - platform: gpio
  61.     pin: GPIO00          # high at boot
  62.     name: "R6 - ?"         # ?
  63.     id: relay6
  64.     icon: mdi:deactivated
  65.     restore_mode: ALWAYS_OFF
  66.   - platform: gpio
  67.     pin: GPIO04
  68.     name: "R7 - ?"        # ? heating for pipe under terrace
  69.     id: relay7
  70.     icon: mdi:heating
  71.     restore_mode: ALWAYS_OFF
  72.   - platform: gpio
  73.     pin: GPIO05
  74.     name: "R8 - ?"        # ? heating for water dispenser for cats
  75.     id: relay8
  76.     icon: mdi:radiator
  77.     restore_mode: ALWAYS_OFF
  78. # wirtualny, razem: Relay3 i Relay4
  79.   - platform: template
  80.     name: "TEMP Wszystkie zawory do podlewania"
  81.     id: drain_the_system
  82.     icon: mdi:pipe-leak
  83.     restore_mode: ALWAYS_OFF
  84.     lambda: |-
  85.       return id(relay3_valve_terrace).state && id(relay4_valve_greenhouse).state;
  86.     turn_on_action:
  87.       - switch.turn_on: relay3_valve_terrace
  88.       - switch.turn_on: relay4_valve_greenhouse  
  89.     turn_off_action:
  90.       - switch.turn_off: relay3_valve_terrace
  91.       - switch.turn_off: relay4_valve_greenhouse
  92.  
  93. sprinkler:
  94.   - id: sprinkler_ctrlr
  95.     main_switch: "Uruchom podlewanie - taras i szklarnia"
  96.     auto_advance_switch: "Auto podlewaj kolejne sekcje"
  97.     pump_start_pump_delay: 1sec     # The delay in seconds from when a distribution valve is opened to when the associated pump is activated.
  98.     pump_stop_valve_delay: 5sec     # The delay in seconds from when a pump is deactivated to when the respective distribution valve is closed.  
  99.     pump_pulse_duration: 12sec       # (singal to open/close the valve) The minimum length of the pulse generated to operate a pump in milliseconds.
  100.     valve_overlap: 5sec
  101.     # queue_enable_switch: "Lawn Sprinklers Queue Enable"
  102.     # reverse_switch: "Lawn Sprinklers Reverse"
  103.     standby_switch: "Nie uruchamiaj podlewania"
  104.     repeat_number:
  105.       name: "Liczba powtórzeń"
  106.       initial_value: 0
  107.       min_value: 0
  108.       max_value: 10
  109.     valves:
  110.       - valve_switch: "Podlej taras"
  111.         enable_switch: "Włącz podlewanie tarasu"
  112.         pump_on_switch_id: relay2_main_on
  113.         pump_off_switch_id: relay1_main_off
  114.         valve_switch_id: relay3_valve_terrace
  115.         run_duration_number:
  116.           id: taras_run_duration
  117.           name: "Czas podlewania tarasu"
  118.           unit_of_measurement: min
  119.           initial_value: 10
  120.           min_value: 1
  121.           step: 1
  122.           max_value: 15
  123.           restore_value: true # to/from flash
  124.           retain: true # to/from MQTT
  125.       - valve_switch: "Podlej szklarnię"
  126.         enable_switch: "Włącz podlewanie szklarni"
  127.         pump_on_switch_id: relay2_main_on
  128.         pump_off_switch_id: relay1_main_off
  129.         valve_switch_id: relay4_valve_greenhouse
  130.         run_duration_number:
  131.           id: szklarnia_run_duration
  132.           name: "Czas podlewania szklarni"
  133.           unit_of_measurement: min
  134.           initial_value: 10
  135.           min_value: 1
  136.           step: 1
  137.           max_value: 15
  138.           restore_value: true # to/from flash
  139.           retain: true # to/from MQTT
  140.       # - valve_switch: "Zakończ podlewanie"
  141.       #   enable_switch: "Auto zakończ podlewanie"
  142.       #   # pump_on_switch_id: relay1_main_off  # off, not opening anythin
  143.       #   # pump_off_switch_id: relay1_main_off  # off, not opening anythin
  144.       #   valve_switch_id: drain_the_system
  145.       #   run_duration: 15sec          
  146.   - id: draining_ctrlr
  147.     # main_switch: "Uruchom spuszczanie wody"
  148.     standby_switch: "Nie spuszczaj wody"
  149.     valves:
  150.       - valve_switch: "Spuść wodę"
  151.         valve_switch_id: drain_the_system
  152.         run_duration: 15sec          
  153.  
  154. # end of file
Advertisement
Add Comment
Please, Sign In to add comment