Skip to content

Instantly share code, notes, and snippets.

@Vaarlion
Last active August 30, 2024 19:04
Show Gist options
  • Save Vaarlion/ff12ad41e5393ff28e4e2932e95faab2 to your computer and use it in GitHub Desktop.
Save Vaarlion/ff12ad41e5393ff28e4e2932e95faab2 to your computer and use it in GitHub Desktop.
Old ESPHome gate controller extention for a FAAC E045
esphome:
name: portal_controler
platform: ESP8266
board: nodemcuv2
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Portal_Controler"
password: "XXXXXXXXX"
domain: .iot.home.arpa
captive_portal:
safe_mode:
boot_is_good_after: 1min
reboot_timeout: 5min
# Enable logging
logger:
# Enable Home Assistant API
api:
encryption:
key: "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
ota:
- platform: esphome
password: !secret OTA_PASS
button:
- platform: safe_mode
name: "Portal Safe Mode Boot"
entity_category: diagnostic
- platform: restart
name: "Portal Restart"
cover:
- platform: template
name: "Portal"
device_class: gate
lambda: |-
if (id(state_open).state) {
return COVER_OPEN;
} else {
return COVER_CLOSED;
}
open_action:
- output.turn_on: open_close_portal_full
close_action:
- output.turn_on: open_close_portal_full
stop_action:
- output.turn_on: stop_portal
sensor:
- platform: duty_cycle
id: input_state
update_interval: 1s
pin:
number: D2
mode: input_pullup
inverted: true
- platform: uptime
name: Portal Uptime
icon: mdi:clock-time-four-outline
entity_category: "diagnostic"
- platform: wifi_signal
name: Portal WiFi Signal
update_interval: 60s
unit_of_measurement: "dBm"
device_class: "signal_strength"
state_class: "measurement"
entity_category: "diagnostic"
binary_sensor:
# - platform: gpio
# pin:
# number: D2
# mode: input_pullup
# id: input_state
- platform: template
name: "Portal State"
id: state_open
filters:
- delayed_off: 1200ms
lambda: |-
if (id(input_state).state > 0) {
// portal is open.
return true;
} else {
// Portal is close.
return false;
}
- platform: template
name: "Portal closing"
id: state_closing
filters:
- delayed_on_off: 1200ms
lambda: |-
if ( id(input_state).state > 1 and id(input_state).state < 99) {
// portal is closing.
return true;
} else {
// Portal is idle.
return false;
}
output:
- platform: gpio
pin: D5
id: relay1
inverted: True
- platform: gpio
pin: D6
id: relay2
inverted: True
- platform: gpio
pin: D7
id: relay3
inverted: True
# Pulse generator
- platform: template
type: binary
id: open_close_portal_full
write_action:
- output.turn_on: relay2
- delay: 500ms
- output.turn_off: relay2
- platform: template
type: binary
id: open_close_portal_half
write_action:
- output.turn_on: relay1
- delay: 500ms
- output.turn_off: relay1
- platform: template
type: binary
id: stop_portal
write_action:
- output.turn_on: relay3
- delay: 500ms
- output.turn_off: relay3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment