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

98 lines
1.6 KiB
YAML

esphome:
name: power
esp8266:
board: nodemcuv2
# 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
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: !secret ap_ssid
password: !secret ap_password
captive_portal:
web_server:
port: 80
mqtt:
broker: mqtt.lan
discovery: true
time:
- platform: homeassistant
id: time1
timezone: Europe/Amsterdam
i2c:
sda: GPIO2
scl: GPIO14
frequency: 300 kHz
scan: true
sensor:
text_sensor:
- platform: mqtt_subscribe
name: "mqttp02"
id: mp1
topic: p1/sensor/power/state
internal: true
# zet de inhoud van fonts in je huidige dir
font:
- file: 'slkscr.ttf'
id: font1
size: 8
- file: 'BebasNeue-Regular.ttf'
id: font2
size: 42
- file: 'arial.ttf'
id: font3
size: 27
- file: 'ubuntu-r.ttf'
id: tiny
size: 10
- file: 'Comic_Sans_MS.ttf'
id: sans
size: 22
- file: "digital-7.ttf"
id: sseg
size: 26
# dit is een 1.3 inch display te kopen via amazon.nl zoek op azdelivery
display:
- platform: ssd1306_i2c
model: "SH1106 128x64"
address: 0x3C
reset_pin: GPIO0
lambda: |-
if (id(mp1).has_state()) {
it.printf(0, 5, id(font3), TextAlign::TOP_LEFT , "%s kW", id(mp1).state.c_str());
}
if (id(power2).has_state()) {
it.printf(0, 60, id(font3), TextAlign::BASELINE_LEFT , "TB7 %.2f°c", id(power2).state);
}