Created
March 6, 2019 03:26
-
-
Save Snipercaine/1a27384fbe7e5cd013d47cb917c2aa03 to your computer and use it in GitHub Desktop.
This file contains 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: shade | |
platform: ESP8266 | |
board: d1_mini | |
wifi: | |
ssid: !secret wifi | |
password: !secret wifi_pw | |
# Enable logging | |
logger: | |
# Enable Home Assistant API | |
api: | |
ota: | |
output: | |
- platform: gpio | |
id: 'shade1' | |
pin: D1 | |
- platform: gpio | |
id: 'shade2' | |
pin: D2 | |
switch: | |
- platform: output | |
name: "shade1" | |
output: 'shade1' | |
id: shade_s1 | |
- platform: output | |
name: "shade2" | |
output: 'shade2' | |
id: shade_s2 | |
binary_sensor: | |
- platform: gpio | |
pin: D3 | |
name: "Button" | |
filters: | |
invert: | |
on_press: | |
then: | |
- lambda: | | |
if (id(kitchen_window).state == cover::COVER_OPEN) { | |
if (id(shade_s1).state){ | |
// shade is opening | |
id(kitchen_window).stop(); | |
} else { | |
// shade is open and not moving | |
id(kitchen_window).close(); | |
} | |
} else { | |
if (id(shade_s2).state){ | |
// shade is closing | |
id(kitchen_window).stop(); | |
} else { | |
// shade is closed and not moving | |
id(kitchen_window).open(); | |
} | |
} | |
# END STOP EXAMPLES | |
# - platform: gpio | |
# pin: D7 | |
# name: "Kitchen Top Stop" | |
# filters: | |
# invert: | |
# on_press: | |
# then: | |
# - switch.turn_off: shade_s1 | |
# - switch.turn_off: shade_s2 | |
# id: kitchen_top_stop | |
# - platform: gpio | |
# pin: D8 | |
# name: "Kitchen Top Bottom" | |
# filters: | |
# invert: | |
# on_press: | |
# then: | |
# - switch.turn_off: shade_s1 | |
# - switch.turn_off: shade_s2 | |
# id: kitchen_bottom_stop | |
cover: | |
- platform: template | |
name: "Kitchen Window Full" | |
id: kitchen_window | |
optimistic: true | |
open_action: | |
- switch.turn_off: shade_s2 | |
- switch.turn_on: shade_s1 | |
- delay: 99s | |
- switch.turn_off: shade_s1 | |
close_action: | |
- switch.turn_off: shade_s1 | |
- switch.turn_on: shade_s2 | |
- delay: 99s | |
- switch.turn_off: shade_s2 | |
stop_action: | |
- switch.turn_off: shade_s1 | |
- switch.turn_off: shade_s2 | |
- platform: template | |
name: "Kitchen Window Control" | |
id: kitchen_control | |
assumed_state: true | |
# TEMPLATE FOR END STOP SWITCHES | |
# lambda: |- | |
# if (id(shade_1_t).state) { | |
# return cover::COVER_OPEN; | |
# } else { | |
# return cover::COVER_CLOSED; | |
# } | |
open_action: | |
- switch.turn_off: shade_s2 | |
- switch.turn_on: shade_s1 | |
close_action: | |
- switch.turn_off: shade_s1 | |
- switch.turn_on: shade_s2 | |
stop_action: | |
- switch.turn_off: shade_s1 | |
- switch.turn_off: shade_s2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi how would we add pwm to this so that the motor won't jerk.