From 745203498fc3291963ad802ad032b23e3126716a Mon Sep 17 00:00:00 2001 From: henk Date: Sat, 1 Oct 2022 15:21:25 +0200 Subject: [PATCH] 2022-10-01 15:21:25 --- homeassistant/esphome/power.yaml | 98 ++++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 homeassistant/esphome/power.yaml diff --git a/homeassistant/esphome/power.yaml b/homeassistant/esphome/power.yaml new file mode 100644 index 0000000..dc285c4 --- /dev/null +++ b/homeassistant/esphome/power.yaml @@ -0,0 +1,98 @@ +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 + domain: .lan + + + # 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); + } + +