mirror of
https://github.com/boneIO-eu/esphome.git
synced 2026-04-10 20:50:02 +02:00
fix display installation
This commit is contained in:
@@ -27,6 +27,14 @@ text_sensor:
|
||||
id: wt32_uptime
|
||||
entity_category: diagnostic
|
||||
icon: mdi:clock-start
|
||||
- platform: template
|
||||
name: 'IP Address'
|
||||
id: ip_address
|
||||
entity_category: diagnostic
|
||||
icon: 'mdi:ip-network'
|
||||
lambda: |-
|
||||
return id(eth).get_ip_addresses().empty() ? "Unset" : id(eth).get_ip_addresses()[0].str();
|
||||
update_interval: 60s
|
||||
|
||||
script:
|
||||
- id: screensaver_script
|
||||
@@ -40,11 +48,10 @@ script:
|
||||
|
||||
esphome:
|
||||
on_boot:
|
||||
# by default display show the first page defined in display (which is the logo page) until full initialization
|
||||
# after that we show the first_page and start the screensaver script
|
||||
priority: 0
|
||||
then:
|
||||
- display.page.show: first_page
|
||||
- component.update: ip_address
|
||||
- component.update: oled_display
|
||||
- script.execute: screensaver_script
|
||||
|
||||
@@ -83,8 +90,6 @@ binary_sensor:
|
||||
# restart screensaver script
|
||||
- script.execute: screensaver_script
|
||||
|
||||
# it.printf(4, 37, id(roboto_9), TextAlign::BASELINE_LEFT ,"IP addr:");
|
||||
# it.printf(124, 37, id(roboto_9), TextAlign::BASELINE_RIGHT ,"%s", id(eth).get_ip_addresses().str().c_str());
|
||||
display:
|
||||
- platform: ssd1306_i2c
|
||||
id: oled_display
|
||||
@@ -95,29 +100,31 @@ display:
|
||||
- id: first_page
|
||||
lambda: |-
|
||||
it.rectangle(0, 0, 126, 15);
|
||||
it.printf(64,11, id(roboto_9), TextAlign::BASELINE_CENTER, "BoneIO");
|
||||
it.printf(4, 49, id(roboto_9), TextAlign::BASELINE_LEFT ,"Uptime:");
|
||||
it.printf(124, 49, id(roboto_9), TextAlign::BASELINE_RIGHT ,"%s", id(wt32_uptime).state.c_str());
|
||||
it.printf(4, 61, id(roboto_9), TextAlign::BASELINE_LEFT ,"Temperature:");
|
||||
it.printf(124, 61, id(roboto_9), TextAlign::BASELINE_RIGHT ,"%.2f°C", id(boneIO_temp).state);
|
||||
it.printf(64,11, id(size_10), TextAlign::BASELINE_CENTER, "bone IO");
|
||||
it.printf(4, 37, id(size_10), TextAlign::BASELINE_LEFT ,"IP addr:");
|
||||
it.printf(124, 37, id(size_10), TextAlign::BASELINE_RIGHT ,"%s", id(ip_address).state.c_str());
|
||||
it.printf(4, 49, id(size_10), TextAlign::BASELINE_LEFT ,"Uptime:");
|
||||
it.printf(124, 49, id(size_10), TextAlign::BASELINE_RIGHT ,"%s", id(wt32_uptime).state.c_str());
|
||||
it.printf(4, 61, id(size_10), TextAlign::BASELINE_LEFT ,"Temperature:");
|
||||
it.printf(124, 61, id(size_10), TextAlign::BASELINE_RIGHT ,"%.2f°C", id(boneIO_temp).state);
|
||||
# additional pages should be defined between the first and last page
|
||||
- id: last_page
|
||||
lambda: |-
|
||||
it.rectangle(0, 0, 126, 15);
|
||||
it.printf(64,11, id(roboto_9), TextAlign::BASELINE_CENTER, "BoneIO");
|
||||
it.printf(4, 25, id(roboto_9), TextAlign::BASELINE_LEFT ,"Current:");
|
||||
it.printf(124, 25, id(roboto_9), TextAlign::BASELINE_RIGHT ,"%.3fA", id(ina_current).state);
|
||||
it.printf(4, 37, id(roboto_9), TextAlign::BASELINE_LEFT ,"Power:");
|
||||
it.printf(124, 37, id(roboto_9), TextAlign::BASELINE_RIGHT ,"%.2fW", id(ina_power).state);
|
||||
it.printf(4, 49, id(roboto_9), TextAlign::BASELINE_LEFT ,"Bus Volt:");
|
||||
it.printf(124, 49, id(roboto_9), TextAlign::BASELINE_RIGHT ,"%.2fV", id(ina_bus_voltage).state);
|
||||
it.printf(4, 61, id(roboto_9), TextAlign::BASELINE_LEFT ,"Shunt Volt:");
|
||||
it.printf(124, 61, id(roboto_9), TextAlign::BASELINE_RIGHT ,"%.2fV", id(ina_shunt_voltage).state);
|
||||
it.printf(64,11, id(size_10), TextAlign::BASELINE_CENTER, "boneIO");
|
||||
it.printf(4, 25, id(size_10), TextAlign::BASELINE_LEFT ,"Current:");
|
||||
it.printf(124, 25, id(size_10), TextAlign::BASELINE_RIGHT ,"%.3fA", id(ina_current).state);
|
||||
it.printf(4, 37, id(size_10), TextAlign::BASELINE_LEFT ,"Power:");
|
||||
it.printf(124, 37, id(size_10), TextAlign::BASELINE_RIGHT ,"%.2fW", id(ina_power).state);
|
||||
it.printf(4, 49, id(size_10), TextAlign::BASELINE_LEFT ,"Bus Volt:");
|
||||
it.printf(124, 49, id(size_10), TextAlign::BASELINE_RIGHT ,"%.2fV", id(ina_bus_voltage).state);
|
||||
it.printf(4, 61, id(size_10), TextAlign::BASELINE_LEFT ,"Shunt Volt:");
|
||||
it.printf(124, 61, id(size_10), TextAlign::BASELINE_RIGHT ,"%.2fV", id(ina_shunt_voltage).state);
|
||||
- id: screensaver
|
||||
lambda: |-
|
||||
it.fill(COLOR_OFF);
|
||||
|
||||
font:
|
||||
- file: 'gfonts://Roboto'
|
||||
id: roboto_9
|
||||
size: 9
|
||||
- file: 'gfonts://Ubuntu'
|
||||
id: size_10
|
||||
size: 10
|
||||
|
||||
Reference in New Issue
Block a user