Advertisement
Azuria

esphome oil furnice fuel pump

Jan 4th, 2024 (edited)
1,208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 3.27 KB | Source Code | 0 0
  1. esphome:
  2.   name: sonoff-basic-05
  3.   platform: ESP8266
  4.   board: sonoff_basic
  5.   on_loop:
  6.     then:
  7.       - if:
  8.           condition:
  9.             not:
  10.               script.is_running: cycle_pump
  11.           then:
  12.             - script.execute: cycle_pump
  13.  
  14. # Enable logging
  15. logger:
  16. globals:
  17.   - id: pump_enabled
  18.     type: bool
  19.     restore_value: no
  20.     initial_value: 'false'
  21.  
  22.   - id: pump_interval
  23.     type: int
  24.     restore_value: yes
  25.     initial_value: '12'  
  26.  
  27.   - id: pump_on_time
  28.     type: int
  29.     restore_value: yes
  30.     initial_value: '6'  
  31.  
  32. # Enable Home Assistant API
  33. api:
  34. web_server:
  35.   port: 80
  36.  
  37. ota:
  38.   password: "c0f858446b950758eb0d433b50ae73e4"
  39.  
  40. wifi:
  41.   ssid: !secret iot_ssid
  42.   password: !secret iot_pass
  43.  
  44.   # Enable fallback hotspot (captive portal) in case wifi connection fails
  45.   ap:
  46.     ssid: "Sonoff-Basic-05 Fallback Hotspot"
  47.     password: !secret iot_pass
  48.  
  49. captive_portal:
  50. binary_sensor:
  51.   - platform: gpio
  52.     pin:
  53.       number: GPIO0
  54.       mode:
  55.         input: true
  56.         pullup: true
  57.       inverted: true
  58.     name: "Sonoff Basic Button"
  59.     on_press:
  60.       - switch.toggle: pump_relay
  61.  
  62.   - platform: homeassistant
  63.     name: "Hydro Pump Enable"
  64.     internal: false
  65.     entity_id: input_boolean.hydro_pump_enable
  66.     on_state:
  67.       then:
  68.         - lambda: |-
  69.             id(pump_enabled) = x;
  70.  
  71. switch:
  72.   - platform: gpio
  73.     name: "Pump Relay"
  74.     id: pump_relay
  75.     pin: GPIO12
  76.  
  77.   - platform: restart
  78.     name: Restart
  79.  
  80.   - platform: template
  81.     name: "Template Switch"
  82.     optimistic: true
  83.     id: template_swi
  84.     #lambda: 'return id(pump_enabled);'
  85.  
  86.  
  87.  
  88. status_led:
  89.   pin:
  90.     number: GPIO13
  91.     inverted: yes
  92.  
  93. number:
  94.   - platform: template
  95.     name: "hydro_pump_interval_set"
  96.     optimistic: true
  97.     initial_value: 9
  98.     min_value: 0
  99.     max_value: 60
  100.     step: 1
  101.     on_value:
  102.       then:
  103.         - globals.set:
  104.             id: pump_interval
  105.             value: !lambda 'return x;'
  106.  
  107.  
  108.   - platform: template
  109.     name: "hydro_pump_on_time_set"
  110.     optimistic: true
  111.     min_value: 0
  112.     max_value: 25
  113.     step: 0.25
  114.     on_value:
  115.       then:
  116.         - globals.set:
  117.             id: pump_on_time
  118.             value: !lambda 'return x;'
  119.  
  120. sensor:
  121.   - platform: homeassistant
  122.     name: Hydro Pump Interval
  123.     entity_id: input_number.hydro_pump_interval
  124.     internal: false
  125.     on_value:
  126.       then:
  127.         - lambda: |-
  128.             id(pump_interval) = x;
  129.  
  130.   - platform: homeassistant
  131.     name: Hydro Pump On Time
  132.     internal: false
  133.     entity_id: input_number.hydro_pump_on_time
  134.     on_value:
  135.       then:
  136.         - lambda: |-
  137.             id(pump_on_time) = x;
  138.  
  139.  
  140.  
  141. script:
  142.   - id: cycle_pump
  143.     then:
  144.       - if:
  145.           condition:
  146.            #lambda: |-
  147.             #   return id(pump_enabled) = true;
  148.             switch.is_on: template_swi
  149.  
  150.           then:
  151.               - logger.log: "Started First (Interval-run time) Delay"
  152.               - delay: !lambda |-
  153.                   return (id(pump_interval) - id(pump_on_time)) * 1000;
  154.               - switch.turn_on: pump_relay
  155.               - logger.log: "Started second (run time) Delay"
  156.               - delay: !lambda |-
  157.                   return id(pump_on_time) * 1000;
  158.               - switch.turn_off: pump_relay
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement