esphome-config/shutter.yaml

101 lines
2.0 KiB
YAML

esphome:
name: esp-shutter
friendly_name: ESP-SHUTTER
esp32:
board: esp32dev
framework:
type: arduino
# Enable logging
logger:
level: verbose
# Enable Home Assistant API
api:
encryption:
key: !secret api_key
mqtt:
broker: mqtt.hadow.fr
port: 18832
username: fire
password: !secret mqtt_password
topic_prefix: "esp_shutter"
ota:
- platform: esphome
password: !secret ota_password
wifi:
networks:
- ssid: !secret wifi_ssid3
password: !secret wifi_password3
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Esp32S3N16R8 Fallback Hotspot"
password: "v41VUZA7A1VA"
output:
- platform: gpio
pin: GPIO18
id: transistor_1
- platform: gpio
pin: GPIO17
id: transistor_2
- platform: gpio
pin: GPIO5
id: transistor_3
script:
- id: shutter_up
then:
- output.turn_on: transistor_1
- delay: 500ms
- output.turn_off: transistor_1
- id: shutter_down
then:
- output.turn_on: transistor_2
- delay: 500ms
- output.turn_off: transistor_2
- id: shutter_stop
then:
- output.turn_on: transistor_3
- delay: 500ms
- output.turn_off: transistor_3
- id: script_open_mid
then:
- script.execute: shutter_up
- delay: 12000ms
- script.execute: shutter_stop
- id: script_close_mid
then:
- script.execute: shutter_down
- delay: 5500ms
- script.execute: shutter_stop
button:
- platform: template
name: "Shutter Up"
on_press:
- script.execute: shutter_up
- platform: template
name: "Shutter Down"
on_press:
- script.execute: shutter_down
- platform: template
name: "Shutter Stop"
on_press:
- script.execute: shutter_stop
- platform: template
name: "Shutter open mid"
on_press:
- script.execute: script_open_mid
- platform: template
name: "Shutter close mid"
on_press:
- script.execute: script_close_mid