Azuria

Sonoff 4CH Pro R3

Nov 28th, 2021 (edited)
664
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 1.81 KB | None | 0 0
  1. substitutions:
  2.   device_name: sonoff4ch_genny
  3.   friendly_name: Sonoff 4CH Pro Genny
  4.   ignition: GPIO12 #Relay1
  5.   crank: GPIO5 #Relay2
  6.   power_good: GPIO4 #Relay 3
  7.   shutoff: GPIO15 #Relay4
  8.   sensor_temp: GPIO0 # DHT11
  9.  
  10. esphome:
  11.   name: sonoff4chpror3
  12.   platform: ESP8266
  13.   board: nodemcuv2
  14.  
  15. # Enable logging
  16. logger:
  17. # Enable Home Assistant API
  18. api:
  19. ota:
  20.   password: "1ea575456fb1d95ecd2cb71f67fb65c1"
  21.  
  22. wifi:
  23.   ssid: !secret iot_ssid
  24.   password: !secret iot_pass
  25.  
  26.   # Enable fallback hotspot (captive portal) in case wifi connection fails
  27.   ap:
  28.     ssid: "Nocemcu Fallback Hotspot"
  29.     password: "gQSbSS5bC4HZ"
  30.  
  31. captive_portal:
  32. sensor:
  33.   - platform: dht
  34.     pin: ${sensor_temp}
  35.     temperature:
  36.       name: "Generator Temperature"
  37.     humidity:
  38.       name: "Generator Humidity"
  39.     update_interval: 60s
  40.  
  41. switch:
  42.   - platform: gpio
  43.     pin: ${ignition}
  44.     name: "ignition"
  45.     id: IN1
  46.   - platform: gpio
  47.     pin: ${crank}
  48.     name: "crank"
  49.     id: IN2
  50.   - platform: gpio
  51.     pin: ${power_good}
  52.     name: "power_good"
  53.     id: IN3
  54.   - platform: gpio
  55.     pin: ${shutoff}
  56.     name: "shutoff"
  57.     id: IN4
  58.   - platform: template
  59.     name: "Generator"
  60.     id: Generator
  61.     turn_on_action:
  62.       - then:
  63.         - switch.turn_on: IN1
  64.         - delay: 2s
  65.         - switch.turn_on: IN2
  66.         - delay: 2s
  67.         - switch.turn_off: IN2
  68.         - delay: 10s
  69.         - switch.turn_on: IN3
  70.         - delay: 1s
  71.         - switch.turn_off: IN3
  72.         - switch.template.publish:
  73.             id: Generator
  74.             state: ON
  75.     turn_off_action:
  76.       - then:
  77.         - switch.turn_on: IN4
  78.         - delay: 1s
  79.         - switch.turn_off: IN4
  80.         - delay: 15s
  81.         - switch.turn_off: IN1
  82.         - switch.template.publish:
  83.             id: Generator
  84.             state: OFF
Add Comment
Please, Sign In to add comment