Created
April 24, 2021 11:55
-
-
Save tubalainen/7d66ba22e6e26fd8d7ba08df889cc897 to your computer and use it in GitHub Desktop.
TTGO - ESPHOME example code
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: ttgotcam01 | |
platform: ESP32 | |
board: esp-wrover-kit | |
wifi: | |
manual_ip: | |
static_ip: 192.168.xx.xx | |
gateway: 192.168.xx.1 | |
subnet: 255.255.255.0 | |
dns1: 192.168.21.xx | |
dns2: 1.1.1.1 | |
ap: | |
ssid: "ttgo-t-cam01 Fallback Hotspot" | |
captive_portal: | |
# Enable logging | |
logger: | |
# Enable Home Assistant API | |
api: | |
ota: | |
web_server: | |
port: 80 | |
binary_sensor: | |
- platform: gpio | |
pin: GPIO33 | |
name: doorbell PIR | |
device_class: motion | |
on_press: | |
then: | |
- lambda: id(doorbell_display).set_brightness(1.0); | |
on_release: | |
then: | |
- lambda: id(doorbell_display).set_brightness(0.1); | |
filters: | |
- delayed_off: 30s | |
- platform: gpio | |
pin: | |
number: GPIO34 | |
mode: INPUT_PULLUP | |
inverted: True | |
name: doorbell button | |
# On press show ding dong page and activate doorbell script in Home Assistant | |
on_press: | |
then: | |
# - lambda: id(doorbell_display).set_brightness(0.1); | |
- display.page.show: ding_page | |
- component.update: doorbell_display | |
- delay: 5s | |
- lambda: id(doorbell_display).set_brightness(1.0); | |
- display.page.show: name_page | |
- component.update: doorbell_display | |
# - homeassistant.service: | |
# service: script.turn_on | |
# data: | |
# entity_id: "script.doorbell" | |
# If front door is opened, show come in page | |
- platform: homeassistant | |
name: "Doorbell Copy Door Relay" | |
entity_id: switch.door_lock_relay | |
id: door_lock | |
on_press: | |
then: | |
- display.page.show: come_in_page | |
- component.update: doorbell_display | |
- delay: 5s | |
- display.page.show: name_page | |
- component.update: doorbell_display | |
- platform: status | |
name: TTGO status | |
sensor: | |
- platform: wifi_signal | |
name: doorbell WiFi Signal | |
update_interval: 10s | |
- platform: uptime | |
name: TTGO Uptime | |
switch: | |
- platform: restart | |
name: "Doorbell Restart" | |
esp32_camera: | |
name: Doorbell Camera | |
external_clock: | |
pin: GPIO32 | |
frequency: 20MHz | |
i2c_pins: | |
sda: GPIO13 | |
scl: GPIO12 | |
data_pins: [GPIO5, GPIO14, GPIO4, GPIO15, GPIO18, GPIO23, GPIO36, GPIO39] | |
vsync_pin: GPIO27 | |
href_pin: GPIO25 | |
pixel_clock_pin: GPIO19 | |
power_down_pin: GPIO26 | |
resolution: 640x480 | |
max_framerate: 5 fps | |
idle_framerate: 0 fps | |
jpeg_quality: 10 | |
vertical_flip: true | |
horizontal_mirror: true | |
i2c: | |
sda: GPIO21 | |
scl: GPIO22 | |
font: | |
- file: "arial.ttf" | |
id: tnr1 | |
size: 20 | |
- file: "arial.ttf" | |
id: tnr2 | |
size: 40 | |
- file: "arial.ttf" | |
id: tnr3 | |
size: 10 | |
- file: 'slkscr.ttf' | |
id: font1 | |
size: 8 | |
glyphs: '!"%()+,-_.:°0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZÅÄÖ abcdefghijklmnopqrstuvwxyzåäöé' | |
- file: 'bebas-neue-regular.ttf' | |
id: font2 | |
size: 48 | |
- file: 'arial.ttf' | |
id: font3 | |
size: 14 | |
glyphs: '!"%()+,-_.:°0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZÅÄÖ abcdefghijklmnopqrstuvwxyzåäöé' | |
# - file: 'bebas-neue-regular.ttf' | |
- file: 'arial.ttf' | |
id: font4 | |
size: 26 | |
glyphs: '!"%()+,-_.:°0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZÅÄÖ abcdefghijklmnopqrstuvwxyzåäöé' | |
- file: 'arial.ttf' | |
id: font5 | |
size: 12 | |
glyphs: '!"%()+,-_.:°0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZÅÄÖ abcdefghijklmnopqrstuvwxyzåäöé' | |
time: | |
- platform: homeassistant | |
id: homeassistant_time | |
display: | |
- platform: ssd1306_i2c | |
model: "SSD1306 128x64" | |
rotation: 180 | |
address: 0x3C | |
id: doorbell_display | |
pages: | |
# Name page | |
- id: name_page | |
lambda: |- | |
it.print(0, 32, id(font4), TextAlign::BASELINE_LEFT, "Family name"); | |
it.print(0, 46, id(font5), TextAlign::BASELINE_LEFT, "Adult 1 - Adult 2"); | |
it.print(0, 61, id(font5), TextAlign::BASELINE_LEFT, "Child 1 - Child 2"); | |
# Ding Dong page | |
- id: ding_page | |
lambda: |- | |
it.print(64, 0, id(tnr2), TextAlign::TOP_CENTER, "DING"); | |
it.print(64, 64, id(tnr2), TextAlign::BASELINE_CENTER, "DONG"); | |
# Welcome in page | |
- id: come_in_page | |
lambda: |- | |
it.print(64, 0, id(tnr2), TextAlign::TOP_CENTER, "Come"); | |
it.print(64, 64, id(tnr2), TextAlign::BASELINE_CENTER, "In"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment