Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Gosund Sp111 (pomiar mocy)
- #
- esphome:
- name: gn140
- comment: "Przepompownia"
- platform: ESP8266
- board: esp8285
- on_boot:
- priority: 600
- then:
- - script.execute: petla
- # siecowe ustawienia
- binary_sensor:
- # toggle relay on/off
- - platform: gpio
- pin:
- number: GPIO13
- mode: INPUT_PULLUP
- inverted: True
- id: "${devicename}_button_state"
- on_press:
- - script.execute: petla
- - platform: template
- id: pumping
- name: "Pompowanie"
- lambda: |-
- if (id(power_wattage).state > 2)
- return true;
- else
- return false;
- sensor:
- - platform: hlw8012
- sel_pin:
- number: GPIO12
- inverted: True
- cf_pin: GPIO05
- cf1_pin: GPIO04
- change_mode_every: 4
- current_resistor: ${current_res}
- voltage_divider: ${voltage_div}
- update_interval: 3s
- power:
- name: "${devicename} - Watt"
- unit_of_measurement: W
- id: "power_wattage"
- icon: mdi:gauge
- output:
- - platform: gpio
- pin: GPIO00
- inverted: true
- id: led_red
- switch:
- - platform: gpio
- name: "${devicename} - Switch"
- icon: mdi:power
- pin: GPIO15
- id: relay
- restore_mode: RESTORE_DEFAULT_ON
- script:
- - id: iteracja
- mode: restart
- then:
- - switch.turn_on: relay
- - output.turn_on: led_red
- - delay: 5s
- - wait_until:
- binary_sensor.is_off: pumping
- - switch.turn_off: relay
- - output.turn_off: led_red
- - delay: 1min
- - id: petla
- mode: restart
- then:
- - while:
- condition:
- lambda: "return true;"
- then:
- - script.execute: iteracja
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement