Add page utilites

Supports #168
This commit is contained in:
Edward Firmo
2024-02-28 19:19:22 +01:00
parent 755ced3130
commit 22dd4b0c89
7 changed files with 415 additions and 299 deletions

View File

@@ -843,22 +843,24 @@ display:
lambda: |-
if (not id(is_uploading_tft)) {
timer_reset_all->execute(page_names[page_id]);
if (!touch_event) { // Release touch only
switch (page_id) {
case 10: // light
switch (component_id) {
case 34: // power_button
switch (page_id) {
case 10: // light
switch (component_id) {
case 34: // power_button
if (!touch_event) { // Release
ha_call_service->execute("light.toggle", "", "", detailed_entity->state.c_str());
break;
}
break;
case 22: // fan
switch (component_id) {
case 17: // bt_oscillate
}
break;
}
break;
case 22: // fan
switch (component_id) {
case 17: // bt_oscillate
if (!touch_event) { // Release
ha_call_service->execute("fan.oscillate", "", "", detailed_entity->state.c_str());
break;
}
}
}
break;
}
}
}
@@ -1364,6 +1366,7 @@ select:
- entitypage04
- home
- qrcode
- utilities
initial_option: home
optimistic: true
restore_value: true
@@ -1654,6 +1657,7 @@ text_sensor:
on_value:
then:
- lambda: |-
ESP_LOGE("text_sensor.nspanelevent", "Obsolete call");
DynamicJsonDocument doc(1024);
deserializeJson(doc, x);
std::string page = doc["page"];
@@ -1670,6 +1674,10 @@ text_sensor:
{"value", value},
{"entity", entity}
});
ESP_LOGE("text_sensor.nspanelevent", " Page: %s", page.c_str());
ESP_LOGE("text_sensor.nspanelevent", " Component: %s", component.c_str());
ESP_LOGE("text_sensor.nspanelevent", " Value: %s", value.c_str());
ESP_LOGE("text_sensor.nspanelevent", " Entity: %s", entity.c_str());
##### NSPanel event - Execute actions from ESPHome - NO push to HA #####
- name: NSPanel local event
@@ -2165,6 +2173,7 @@ script:
else if (page == "qrcode") page_qrcode->execute();
else if (page == "screensaver") page_screensaver->execute();
else if (page == "settings") page_settings->execute();
else if (page == "utilities") page_utilities->execute();
else if (page == "weather01") page_weather01->execute();
else if (page == "weather02") page_weather02->execute();
else if (page == "weather03") page_weather03->execute();
@@ -2284,6 +2293,10 @@ script:
set_component_visibility->execute("page_settings.lbl_sleep", false);
set_component_visibility->execute("page_settings.bt_sleep", false);
- id: page_utilities
mode: restart
then: # There's nothing here so far
- id: page_weather
mode: restart
parameters:
@@ -2759,6 +2772,7 @@ script:
page_qrcode->stop();
page_screensaver->stop();
page_settings->stop();
page_utilities->stop();
page_weather01->stop();
page_weather02->stop();
page_weather03->stop();