From acc09e63524a569adff501cf52081b877e43277f Mon Sep 17 00:00:00 2001 From: Victor Alexandrovich Tsyrenschikov <77172321+tsyrenschikov@users.noreply.github.com> Date: Sat, 14 Feb 2026 21:21:36 +0500 Subject: [PATCH] Esphome --- node.yaml | 109 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 109 insertions(+) create mode 100644 node.yaml diff --git a/node.yaml b/node.yaml new file mode 100644 index 0000000..1b12a1c --- /dev/null +++ b/node.yaml @@ -0,0 +1,109 @@ +substitutions: + # Modify variables based on your settings + hostname: "heart" + devicename: heart light + +esphome: + name: heart + +esp8266: + board: esp01_1m + +# Enable logging +logger: + +# Enable Home Assistant API +api: + encryption: + key: "Iw7I/llBJ4LsVy28quiL5/imptDeJxix+oUOvF2kAZs=" + +ota: + - platform: esphome + password: "7764e46209332102a3622e6bceb2afba" + +wifi: + ssid: !secret wifi_ssid + password: !secret wifi_password + + # Enable fallback hotspot (captive portal) in case wifi connection fails + # ap: + # ssid: "Heart Fallback Hotspot" + # password: "f2MTBkrPhnmX" + + use_address: 192.168.88.164 + + manual_ip: + static_ip: 192.168.88.164 + gateway: 192.168.88.1 + subnet: 255.255.255.0 + # dns1: 8.8.8.8 + # dns2: 8.8.4.4 + +captive_portal: + +switch: + - platform: gpio + pin: GPIO0 + name: "Heart switch" + inverted: true + + # The following can be omitted + - platform: restart + name: ${devicename} restart + +sensor: + - platform: wifi_signal + name: ${devicename} wifi signal + update_interval: 600s + + # human readable uptime sensor output to the text sensor above + - platform: uptime + name: ${devicename} Uptime in Days + id: uptime_sensor_days + update_interval: 60s + on_raw_value: + then: + - text_sensor.template.publish: + id: uptime_human + state: !lambda |- + int seconds = round(id(uptime_sensor_days).raw_state); + int days = seconds / (24 * 3600); + seconds = seconds % (24 * 3600); + int hours = seconds / 3600; + seconds = seconds % 3600; + int minutes = seconds / 60; + seconds = seconds % 60; + return ( + (days ? String(days) + "d " : "") + + (hours ? String(hours) + "h " : "") + + (minutes ? String(minutes) + "m " : "") + + (String(seconds) + "s") + ).c_str(); + +time: + - platform: homeassistant + id: homeassistant_time + +# Text sensors with general information. +text_sensor: + # Expose ESPHome version as sensor. + - platform: version + name: $devicename Version + # Expose WiFi information as sensors. + - platform: wifi_info + ip_address: + name: $devicename IP + bssid: + name: $devicename BSSID + + # human readable update text sensor from sensor:uptime + - platform: template + name: Uptime Human Readable + id: uptime_human + icon: mdi:clock-start + +web_server: + port: 80 + auth: + username: "silver" + password: "cbvgcjy0" \ No newline at end of file