Skip to content

Instantly share code, notes, and snippets.

@Vaarlion
Created March 25, 2023 23:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • 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: !secret cp_password
domain: .gdkprod.com
captive_portal:
# Enable logging
logger:
# Enable Home Assistant API
api:
password: !secret API_PASS
ota:
password: !secret OTA_PASS
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
- platform: wifi_signal
name: Portal WiFi Signal
update_interval: 60s
switch:
- platform: restart
name: "Portal Restart"
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