---
substitutions:
devicename: "nodemcu-14"
id_name: nodemcu_14
Device_Location: Study Display
update_interval: !secret d1-update_interval
ipaddress: 10.0.0.24
unique_id: "nodemcu-14"
deep_sleep_interval: !secret deep_sleep_interval
logger:
level: WARN
esp8266:
board: nodemcuv2
wifi:
ssid: !secret mogwai_wifi_name
password: !secret mogwai_wifi_password
<<: !include common/network.yaml
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "$devicename Fallback Hotspot"
password: !secret mogwai_ap_key
api:
encryption:
key: !secret mogwai_api_key
ota:
platform: esphome
password: !secret mogwai_ota_key
captive_portal:
esphome:
name: $devicename
friendly_name: "NodeMCU-14 - Study Info Screen"
on_boot:
then:
- switch.turn_off: led_onboard1
- switch.turn_off: led_onboard2
<<: !include common/nodemcu-led-onboard-both-mqtt.yaml
<<: !include common/website.yaml
<<: !include common/time-sntp.yaml
switch:
- <<: !include common/nodemcu-led-onboard1.yaml
- <<: !include common/nodemcu-led-onboard2.yaml
- <<: !include common/nodemcu-led-onboard1-2-shuffle.yaml
- <<: !include common/restart.yaml
interval:
- interval: 5s
then:
- display.page.show_next: my_display
- component.update: my_display
# - interval: 30s
# then:
# - http_request.post:
# url: !lambda |-
# return ((std::string) "http://10.0.0.61/win&T=1&A=128&FX=" + esphome::to_string(id(random_sensor).state) + "&SX=255&R=255&G=255&B=255");
# headers:
# Content-Type: text/plain
# on_response:
# then:
# - lambda: |-
# int status_code = response->status_code;
# ESP_LOGI("http_post", "HTTP POST Response status: %d", status_code);
#
# if (status_code == 200) {
# ESP_LOGI("http_post", "HTTP POST successful");
# } else {
# ESP_LOGI("http_post", "HTTP POST failed");
# }
- <<: !include common/version-interval.yaml
- <<: !include common/whatami.yaml
<<: !include common/external-heapmon.yaml
sensor:
- <<: !include common/wifi2.yaml
- <<: !include common/uptime.yaml
- <<: !include common/free_space.yaml
text_sensor:
- <<: !include common/version.yaml
sun:
latitude: !secret latitude
longitude: !secret longitude
i2c:
sda: D5
scl: D6
scan: True
id: bus_a
frequency: 400kHz
font:
- file: "slkscr.ttf"
id: slkscr8
size: 8
- file: "slkscr.ttf"
id: slkscr16
size: 16
- file: 'BebasNeue-Regular.ttf'
id: font2
size: 48
- file: 'arial.ttf'
id: font5
size: 20
display:
- platform: ssd1306_i2c
model: "SSD1306 128x64"
address: 0x3C
rotation: 180
id: my_display
pages:
- id: page1
lambda: |-
it.printf(0, 0, id(slkscr8), "Time :");
// Print time in HH:MM format
it.strftime(0, 60, id(font2), TextAlign::BASELINE_LEFT, "%l:%M", id(sntp_time).now());
// Print AM/PM
it.strftime(127, 60, id(font5), TextAlign::BASELINE_RIGHT, "%P", id(sntp_time).now());