esphome:
name: "rolladen-test"
friendly_name: "rolladen-test"
#turn wifi off, set (api: --> reboot_timeout: 0s) to prevent bootloop
# on_boot:
# then:
# - delay: 300s
# - wifi.disable:
#external_components:
# - source: github://ssieb/esphome@wifioff
# components: [ wifi ]
# refresh: 1min
#esp8266 1MB flash
esp8266:
board: esp8285
restore_from_flash: false
# Enable logging
logger:
# Enable Home Assistant API
api:
#turn wifi off, set (api: --> reboot_timeout: 0s) to prevent bootloop
reboot_timeout: 0s
encryption:
key: "xxxxxxxx"
ota:
password: "xxxxxxxx"
wifi:
#wifi powersafe mode: NONE,LIGHT,HIGH
power_save_mode: HIGH
# fast_connect: true
ssid: !secret wifi_ssid
password: !secret wifi_password
manual_ip:
static_ip: 192.168.1.x
gateway: 192.168.1.x
subnet: 255.255.255.0
dns1: 192.168.1.x
# Enable fallback hotspot (captive portal) in case wifi connection fails, http:192.168.4.1
# ap:
# ssid: "Esphome-Web-xxxxxx"
# password: "xxxxxx"
#captive_portal:
# reduce write frequency to flash to avoid wearing it out, adjust it as needed
preferences:
flash_write_interval: 24h
substitutions:
device_name: 'Rolladen test'
# for hard restart
button:
- platform: restart
id: restart_button
name: 'Restart ${device_name}'
entity_category: diagnostic
status_led: # onboard LED
pin:
number: 3
inverted: true
# relays
switch:
- platform: gpio
id: open_relay
name: open ${device_name}
pin: 12
# interlock: [close_relay]
- platform: gpio
id: close_relay
name: close ${device_name}
pin: 14
# interlock: [open_relay]
script:
- id: open_script
mode: restart
then:
- switch.turn_off: close_relay
- delay: 500ms
- switch.turn_on: open_relay
- delay: 30s
- switch.turn_off: open_relay
- id: open_halt_script
then:
- switch.turn_off: open_relay
- id: close_script
mode: restart
then:
- switch.turn_off: open_relay
- delay: 500ms
- switch.turn_on: close_relay
- delay: 30s
- switch.turn_off: close_relay
- id: close_halt_script
then:
- switch.turn_off: close_relay
# external switches
binary_sensor:
- platform: gpio
id: open_button
pin:
number: 4
inverted: true
on_click:
- min_length: 50ms # Short press
max_length: 500ms
then:
- script.execute: open_script
- min_length: 1000ms # Medium press / long
max_length: 30000ms
then:
- script.execute: open_halt_script
- script.stop: open_script
- script.stop: close_script
- platform: gpio
id: close_button
pin:
number: 5
inverted: true
on_click:
- min_length: 50ms # Short press
max_length: 500ms
then:
- script.execute: close_script
- min_length: 1000ms # Medium press / long
max_length: 30000ms
then:
- script.execute: close_halt_script
- script.stop: open_script
- script.stop: close_script
- platform: gpio
id: stop_button
pin:
number: 13
inverted: true
on_click:
then:
- script.execute: open_halt_script
- script.execute: close_halt_script
- script.stop: open_script
- script.stop: close_script
#on_click:
# - min_length: 50ms # Short press
# max_length: 500ms
# then:
# # Some action
# - min_length: 500ms # Medium press
# max_length: 3000ms
# then:
# # Some other action
# - min_length: 3000ms # Long press
# max_length: 10000ms
# then:
# # Some other action