Files
linuxtips/homeassistant/esphome/t-camera.yaml
T
2023-08-17 19:00:19 +02:00

154 lines
2.7 KiB
YAML

esphome:
name: t-camera
platform: ESP32
board: ttgo-t1
# Enable logging
logger:
# Enable Home Assistant API
api:
ota:
password: !secret ota
wifi:
networks:
- ssid: !secret wifi_ssid
password: !secret wifi_password
- ssid: !secret wifi_ssid2
password: !secret wifi_password2
domain: .lan
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: !secret ap_ssid
password: !secret ap_password
web_server:
port: 80
# Sync time with Home Assistant.
time:
- platform: sntp
id: homeassistant_time
mqtt:
broker: mqtt.lan
discovery: true
i2c:
sda: GPIO21
scl: GPIO22
frequency: 500 kHz
scan: true
captive_portal:
# Example configuration entry
esp32_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
vertical_flip: true
horizontal_mirror: true
# Image settings
name: t-Cam
resolution: 800x600
esp32_camera_web_server:
- port: 8080
mode: stream
- port: 8081
mode: snapshot
binary_sensor:
- platform: gpio
pin: 33
name: "TC1"
device_class: motion
sensor:
- platform: homeassistant
id: pwr2
entity_id: sensor.power_usage
internal: true
- platform: wifi_signal
name: WiFi Signal
id: wifi_signal_db
update_interval: 60s
entity_category: "diagnostic"
- platform: copy # Reports the WiFi signal strength in %
source_id: wifi_signal_db
name: "WiFi Signal Percent"
filters:
- lambda: return min(max(2 * (x + 100.0), 0.0), 100.0);
unit_of_measurement: "%"
entity_category: "diagnostic"
- platform: uptime
name: Uptime
text_sensor:
- platform: mqtt_subscribe
name: "mqttp03"
id: mp1
topic: p1/sensor/power/state
font:
- file: 'slkscr.ttf'
id: font1
size: 8
- file: 'BebasNeue-Regular.ttf'
id: font2
size: 42
- file: 'arial.ttf'
id: f3
size: 32
- file: 'ubuntu-r.ttf'
id: tiny
size: 10
- file: 'Comic_Sans_MS.ttf'
id: sans
size: 25
- file: "digital-7.ttf"
id: sseg
size: 30
display:
- platform: ssd1306_i2c
model: "SSD1306 128x64"
address: 0x3C
rotation: 180
#reset_pin: D0
id: my_display
pages:
- id: page1
lambda: |-
if (id(mp1).has_state()) {
it.printf(0, 0, id(f3), TextAlign::TOP_LEFT , "%s k", id(mp1).state.c_str());
}
if (id(pwr2).has_state()) {
it.printf(0, 64, id(f3), TextAlign::BASELINE_LEFT , "%.0f W", id(pwr2).state);
}