Created
August 1, 2019 14:47
-
-
Save Snipercaine/a59d08ef2ce1737302b1f8af346ce6a1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
esphome: | |
name: mountain_windows_left | |
platform: ESP8266 | |
board: d1_mini | |
wifi: | |
ssid: !secret wifi | |
password: !secret wifi_pw | |
# Enable logging | |
logger: | |
# Disable UART logging (pins GPIO1/3 are used for endstops) | |
baud_rate: 0 | |
# Enable Home Assistant API | |
api: | |
ota: | |
output: | |
- platform: gpio | |
id: 'mwl_1' | |
pin: D1 | |
- platform: gpio | |
id: 'mwl_2' | |
pin: D2 | |
- platform: gpio | |
id: 'mwl_3' | |
pin: D5 | |
- platform: gpio | |
id: 'mwl_4' | |
pin: D6 | |
switch: | |
- platform: output | |
name: "mwl1" | |
output: 'mwl_1' | |
id: mwl1 | |
- platform: output | |
name: "mwl2" | |
output: 'mwl_2' | |
id: mwl2 | |
- platform: output | |
name: "mwl3" | |
output: 'mwl_3' | |
id: mwl3 | |
- platform: output | |
name: "mwl4" | |
output: 'mwl_4' | |
id: mwl4 | |
binary_sensor: | |
- platform: gpio | |
pin: | |
number: D7 | |
mode: INPUT_PULLUP | |
inverted: True | |
name: "Left Bottom Shade Closed" | |
id: lb_closed | |
on_press: | |
then: | |
- switch.turn_off: mwl3 | |
- switch.turn_off: mwl4 | |
- platform: gpio | |
pin: | |
number: D0 | |
mode: INPUT_PULLUP | |
inverted: True | |
name: "Left Bottom Shade Open" | |
id: lb_open | |
on_press: | |
then: | |
- switch.turn_off: mwl3 | |
- switch.turn_off: mwl4 | |
- platform: gpio | |
pin: | |
number: TX | |
mode: INPUT_PULLUP | |
inverted: True | |
name: "Left Upper Shade Closed" | |
id: lu_closed | |
on_press: | |
then: | |
- switch.turn_off: mwl1 | |
- switch.turn_off: mwl2 | |
- platform: gpio | |
pin: | |
number: RX | |
mode: INPUT_PULLUP | |
inverted: True | |
name: "Left Upper Shade Open" | |
id: lu_open | |
on_press: | |
then: | |
- switch.turn_off: mwl1 | |
- switch.turn_off: mwl2 | |
- platform: gpio | |
pin: D3 | |
name: "mwl Upper Button" | |
filters: | |
invert: | |
on_press: | |
then: | |
- lambda: | | |
if (id(mw_left_upper).position == cover::COVER_OPEN) { | |
if (id(mwl1).state){ | |
// shade is closing | |
id(mw_left_upper).stop(); | |
} else { | |
// shade is open and not moving | |
id(mw_left_upper).close(); | |
} | |
} else { | |
if (id(mwl2).state){ | |
// shade is opening | |
id(mw_left_upper).stop(); | |
} else { | |
// shade is closed and not moving | |
id(mw_left_upper).open(); | |
} | |
} | |
- platform: gpio | |
pin: D4 | |
name: "mwl Lower Button" | |
filters: | |
invert: | |
on_press: | |
then: | |
- lambda: | | |
if (id(mw_left_lower).position == cover::COVER_OPEN) { | |
if (id(mwl3).state){ | |
// shade is opening | |
id(mw_left_lower).stop(); | |
} else { | |
// shade is open and not moving | |
id(mw_left_lower).close(); | |
} | |
} else { | |
if (id(mwl4).state){ | |
// shade is closing | |
id(mw_left_lower).stop(); | |
} else { | |
// shade is closed and not moving | |
id(mw_left_lower).open(); | |
} | |
} | |
cover: | |
- platform: template | |
name: "MW Left Upper" | |
id: mw_left_upper | |
optimistic: true | |
open_action: | |
- switch.turn_off: mwl2 | |
- switch.turn_on: mwl1 | |
- delay: 95s | |
- switch.turn_off: mwl1 | |
close_action: | |
- switch.turn_off: mwl1 | |
- switch.turn_on: mwl2 | |
- delay: 95s | |
- switch.turn_off: mwl2 | |
stop_action: | |
- switch.turn_off: mwl1 | |
- switch.turn_off: mwl2 | |
- platform: template | |
name: "MW Left Lower" | |
id: mw_left_lower | |
optimistic: true | |
open_action: | |
- switch.turn_off: mwl4 | |
- switch.turn_on: mwl3 | |
- delay: 95s | |
- switch.turn_off: mwl3 | |
close_action: | |
- switch.turn_off: mwl3 | |
- switch.turn_on: mwl4 | |
- delay: 95s | |
- switch.turn_off: mwl4 | |
stop_action: | |
- switch.turn_off: mwl3 | |
- switch.turn_off: mwl4 | |
- platform: template | |
name: "mwl Upper Control" | |
id: mwl_upper_control | |
assumed_state: true | |
open_action: | |
- switch.turn_off: mwl2 | |
- switch.turn_on: mwl1 | |
close_action: | |
- switch.turn_off: mwl1 | |
- switch.turn_on: mwl2 | |
stop_action: | |
- switch.turn_off: mwl1 | |
- switch.turn_off: mwl2 | |
- platform: template | |
name: "mwl Lower Control" | |
id: mwl_lower_control | |
assumed_state: true | |
open_action: | |
- switch.turn_off: mwl4 | |
- switch.turn_on: mwl3 | |
close_action: | |
- switch.turn_off: mwl3 | |
- switch.turn_on: mwl4 | |
stop_action: | |
- switch.turn_off: mwl3 | |
- switch.turn_off: mwl4 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment