-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #519 from kylegordon/garage-doors
Garage door display, sensing and reporting
- Loading branch information
Showing
1 changed file
with
154 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,154 @@ | ||
--- | ||
substitutions: | ||
device_name: garage_door_left | ||
device_description: Garage Door Control - Left | ||
friendly_name: Garage Door - Left | ||
|
||
esphome: | ||
name: ${device_name} | ||
comment: ${device_description} | ||
platform: ESP8266 | ||
board: d1_mini | ||
|
||
wifi: | ||
# ssid: !secret wifi_ssid | ||
ssid: Glasgownet | ||
# password: !secret wifi_pass | ||
password: always32 | ||
|
||
# Enable logging | ||
logger: | ||
|
||
# Enable Home Assistant API | ||
api: | ||
|
||
ota: | ||
|
||
web_server: | ||
|
||
# D0 == GPIO16 == Optional internal PullDOWN | ||
# D1 == GPIO5 == Optional internal Pullup | ||
# D2 == GPIO4 == Optional internal Pullup | ||
# D3 == GPIO0 == Optional internal Pullup | ||
# D4 == GPIO2 == Optional internal Pullup | ||
# D5 == GPIO14 == Optional internal Pullup | ||
# D6 == GPIO12 == Optional internal Pullup | ||
# D7 == GPIO13 == Optional internal Pullup | ||
# D8 == GPIO15 == Optional internal Pullup | ||
|
||
|
||
binary_sensor: | ||
# Reports if this device is Connected or not | ||
- platform: status | ||
id: connection_status | ||
name: ${friendly_name} Status | ||
- platform: gpio | ||
# Seems to be working on D8 as expected | ||
name: "${friendly_name} Lower Sensor" | ||
# https://community.home-assistant.io/t/adding-binary-sensors-to-d1-mini-are-there-any-pullup-pins/354155/2 | ||
pin: | ||
# number: D0 | ||
number: D6 | ||
inverted: true | ||
mode: | ||
input: true | ||
# pulldown: true | ||
pullup: true | ||
icon: "mdi:window-shutter" | ||
id: lower_sensor | ||
- platform: gpio | ||
name: "${friendly_name} Upper Sensor" | ||
# notworking on D7. Pull up or down is failing, even with external resistor | ||
pin: | ||
# number: D8 | ||
number: D7 | ||
inverted: true | ||
mode: | ||
input: true | ||
pullup: true | ||
icon: "mdi:window-shutter-open" | ||
id: upper_sensor | ||
|
||
|
||
text_sensor: | ||
# Reports the ESPHome Version with compile date | ||
- platform: version | ||
name: ${friendly_name} ESPHome Version | ||
# Expose WiFi information as sensors. | ||
- platform: wifi_info | ||
ip_address: | ||
id: ip_address | ||
name: ${friendly_name} IP | ||
|
||
|
||
button: | ||
- platform: restart | ||
name: "${friendly_name} Restart" | ||
|
||
switch: | ||
- platform: gpio | ||
name: "${friendly_name} Relay 1" | ||
pin: D1 | ||
icon: "mdi:valve" | ||
id: relay_1 | ||
|
||
time: | ||
- platform: homeassistant | ||
id: esptime | ||
|
||
font: | ||
- file: 'slkscr.ttf' | ||
id: font1 | ||
size: 8 | ||
|
||
i2c: | ||
frequency: 800kHz | ||
sda: D2 | ||
scl: D5 | ||
scan: true | ||
|
||
display: | ||
- platform: ssd1306_i2c | ||
model: "SH1106 128x64" | ||
# reset_pin: D0 | ||
address: 0x3C | ||
lambda: |- | ||
// Print "viewpoint.house" in top center. | ||
static int yorigin = 0; | ||
static int lineheight = 9; | ||
//it.line(0, 0, 128, 0); // Top line | ||
//it.line(0, 0, 0, 128); // Left line | ||
//it.line(127, 0, 127, 64); // Right line | ||
//it.line(0, 63, 127, 63); // Bottom line | ||
int y = yorigin; | ||
it.printf(64, y, id(font1), TextAlign::TOP_CENTER, "Viewpoint.House"); | ||
y = y+lineheight; | ||
it.line(25, y-1, it.get_width()-25, y-1); | ||
it.printf(0, y, id(font1), TextAlign::TOP_LEFT, "IP: %s", id(ip_address).state.c_str()); | ||
y = y+lineheight; | ||
it.printf(0, y, id(font1), TextAlign::TOP_LEFT, "HA: %s", id(connection_status).state ? "Connected" : "Disconnected"); | ||
y = y+lineheight; | ||
it.printf(0, y, id(font1), TextAlign::TOP_LEFT, "Relay state: %s", id(relay_1).state ? "Open" : "Closed"); | ||
y = y+lineheight; | ||
it.printf(0, y, id(font1), TextAlign::TOP_LEFT, "Lower Sensor: %s", id(lower_sensor).state ? "Open" : "Closed"); | ||
y = y+lineheight; | ||
it.printf(0, y, id(font1), TextAlign::TOP_LEFT, "Upper Sensor: %s", id(upper_sensor).state ? "Open" : "Closed"); | ||
// Print time in HH:MM format | ||
it.strftime(0, 60, id(font1), TextAlign::BASELINE_LEFT, "%H:%M", id(esptime).now()); | ||
output: | ||
# Register the blue LED as a dimmable output .... | ||
- platform: esp8266_pwm | ||
id: blue_led | ||
pin: D4 | ||
inverted: true | ||
|
||
light: | ||
# ... and then make a light out of it. | ||
- platform: monochromatic | ||
name: "Wemos Blue LED" | ||
output: blue_led |