Advertisement
Guest User

Untitled

a guest
Mar 17th, 2022
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 1.70 KB | None | 0 0
  1. # Gosund Sp111 (pomiar mocy)
  2. #
  3. esphome:
  4.   name: gn140
  5.   comment: "Przepompownia"
  6.   platform: ESP8266
  7.   board: esp8285
  8.   on_boot:
  9.     priority: 600
  10.     then:
  11.       - script.execute: petla
  12.  
  13. # siecowe ustawienia
  14.  
  15. binary_sensor:
  16.  # toggle relay on/off
  17.   - platform: gpio
  18.     pin:
  19.       number: GPIO13
  20.       mode: INPUT_PULLUP
  21.       inverted: True
  22.     id: "${devicename}_button_state"
  23.     on_press:
  24.       - script.execute: petla
  25.    
  26.   - platform: template
  27.     id: pumping
  28.     name: "Pompowanie"
  29.     lambda: |-
  30.       if (id(power_wattage).state > 2)
  31.         return true;
  32.       else
  33.         return false;
  34.    
  35.  
  36. sensor:
  37.   - platform: hlw8012
  38.     sel_pin:
  39.       number: GPIO12
  40.       inverted: True
  41.     cf_pin: GPIO05
  42.     cf1_pin: GPIO04
  43.     change_mode_every: 4
  44.     current_resistor: ${current_res}
  45.     voltage_divider: ${voltage_div}
  46.     update_interval: 3s
  47.  
  48.     power:
  49.       name: "${devicename} - Watt"
  50.       unit_of_measurement: W
  51.       id: "power_wattage"
  52.       icon: mdi:gauge
  53.  
  54. output:
  55.   - platform: gpio
  56.     pin: GPIO00
  57.     inverted: true
  58.     id: led_red
  59.  
  60. switch:
  61.   - platform: gpio
  62.     name: "${devicename} - Switch"
  63.     icon: mdi:power
  64.     pin: GPIO15
  65.     id: relay
  66.     restore_mode: RESTORE_DEFAULT_ON
  67.  
  68. script:
  69.   - id: iteracja
  70.     mode: restart
  71.     then:
  72.       - switch.turn_on: relay
  73.       - output.turn_on: led_red
  74.       - delay: 5s
  75.       - wait_until:
  76.           binary_sensor.is_off: pumping
  77.       - switch.turn_off: relay
  78.       - output.turn_off: led_red
  79.       - delay: 1min
  80.  
  81.   - id: petla
  82.     mode: restart
  83.     then:
  84.       - while:
  85.           condition:
  86.             lambda: "return true;"
  87.           then:
  88.             - script.execute: iteracja
  89.  
  90.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement