@@ -217,10 +217,6 @@ api:
|
||||
mui_alarm: string[] #std::vector<std::string> #std::map
|
||||
then:
|
||||
- lambda: |-
|
||||
// set alarm icon on home page
|
||||
disp1->send_command_printf("is_alarm=%i", (state == "" or state.empty()) ? 0 : 1);
|
||||
update_alarm_icon->execute("home.bt_alarm", state.c_str());
|
||||
|
||||
// Is page Alarm visible?
|
||||
if (current_page->state == "alarm") // To do: This page constructor should be moved to Blueprint
|
||||
{ // Update alarm page
|
||||
@@ -578,7 +574,6 @@ api:
|
||||
entities_pages: bool
|
||||
entities_pages_icon: string
|
||||
entities_pages_icon_color: int[]
|
||||
alarm_state: string
|
||||
then:
|
||||
- lambda: |-
|
||||
static const char *const TAG = "service.page_home";
|
||||
@@ -623,11 +618,6 @@ api:
|
||||
//set_component_color->execute("home.bt_entities", entities_pages_icon_color);
|
||||
set_component_color->execute("home.bt_entities", entities_pages_icon_color);
|
||||
|
||||
// Alarm button
|
||||
ESP_LOGV(TAG, "Set Alarm button");
|
||||
disp1->send_command_printf("is_alarm=%i", (alarm_state == "" or alarm_state.empty()) ? 0 : 1);
|
||||
update_alarm_icon->execute("home.bt_alarm", alarm_state.c_str());
|
||||
|
||||
#### Service to populate the page Settings #####
|
||||
- service: page_settings
|
||||
variables:
|
||||
@@ -1513,28 +1503,22 @@ text_sensor:
|
||||
int embedded = doc["embedded"];
|
||||
std::string service = "";
|
||||
|
||||
// send event to Home Assistant
|
||||
// send event to Home Assistant #DEBUG
|
||||
auto ha_event = new esphome::api::CustomAPIDevice();
|
||||
if (event == "short_click" or event == "long_click") ha_button->execute(page.c_str(), component.c_str(), event.c_str());
|
||||
else if (event == "click")
|
||||
{
|
||||
if (page == "home" and component == "climate")
|
||||
{
|
||||
detailed_entity->publish_state((id(is_embedded_thermostat)) ? "embedded_climate" : "");
|
||||
disp1->set_component_value("climate.embedded", id(is_embedded_thermostat) ? 1 : 0);
|
||||
}
|
||||
disp1->goto_page("climate");
|
||||
}
|
||||
else if (page == "light" or page == "climate" or page == "notification")// Generic event
|
||||
{
|
||||
ha_event->fire_homeassistant_event("esphome.nspanel_ha_blueprint",
|
||||
{
|
||||
{"type", "generic"},
|
||||
{"page", page},
|
||||
{"event", event},
|
||||
{"value", value},
|
||||
{"entity", entity}
|
||||
});
|
||||
if (event == "short_click" or event == "long_click") {
|
||||
ha_button->execute(page.c_str(), component.c_str(), event.c_str());
|
||||
} else if (event == "click" and page == "home" and component == "climate") {
|
||||
detailed_entity->publish_state((id(is_embedded_thermostat)) ? "embedded_climate" : "");
|
||||
disp1->set_component_value("climate.embedded", id(is_embedded_thermostat) ? 1 : 0);
|
||||
disp1->goto_page("climate");
|
||||
} else if (page == "light" or page == "climate" or page == "notification") { // Generic event
|
||||
ha_event->fire_homeassistant_event("esphome.nspanel_ha_blueprint", {
|
||||
{"type", "generic"},
|
||||
{"page", page},
|
||||
{"event", event},
|
||||
{"value", value},
|
||||
{"entity", entity}
|
||||
});
|
||||
}
|
||||
|
||||
// page based actions
|
||||
@@ -1968,7 +1952,7 @@ script:
|
||||
{"command", command}
|
||||
});
|
||||
|
||||
- id: update_alarm_icon
|
||||
- id: update_alarm_icon #To do: Move to blueprint
|
||||
mode: restart
|
||||
parameters:
|
||||
component: string
|
||||
@@ -2224,7 +2208,8 @@ script:
|
||||
// Go to boot page if not initiated
|
||||
if (page != "boot" and not nextion_init->state) disp1->goto_page("boot");
|
||||
// Reset globals
|
||||
if (page != "climate" &&
|
||||
if (page != "alarm" && //DEBOG
|
||||
page != "climate" &&
|
||||
page != "cover" &&
|
||||
page != "fan" &&
|
||||
page != "light" &&
|
||||
|
||||
Binary file not shown.
@@ -6,7 +6,7 @@ Program.s
|
||||
int p=0,q=0,t=0,f=0
|
||||
int dimdelta=0
|
||||
int api=0 // 0 = disconnected from HA, 1 = connected to HA
|
||||
int is_alarm=0,is_entities=0,is_qrcode=0,is_notification=0
|
||||
int is_entities=0,is_qrcode=0,is_notification=0
|
||||
int brightness=100,brightness_dim=40
|
||||
int display_mode=1 // 1 = EU, 2 = US, 3 = US landscape
|
||||
int charset=1 // 1 = International (original), 2 = CJK
|
||||
|
||||
@@ -16,7 +16,6 @@ Page home
|
||||
vis bt_notific,is_notification
|
||||
vis bt_qrcode,is_qrcode
|
||||
vis bt_entities,is_entities
|
||||
vis bt_alarm,is_alarm
|
||||
if(display_mode==3)
|
||||
{
|
||||
vis left_bt_text,0
|
||||
@@ -364,7 +363,7 @@ Text bt_entities
|
||||
page entitypage01
|
||||
}
|
||||
|
||||
Text bt_alarm
|
||||
Text button07
|
||||
Attributes
|
||||
ID : 31
|
||||
Scope : global
|
||||
@@ -375,10 +374,21 @@ Text bt_alarm
|
||||
Max. Text Size : 3
|
||||
|
||||
Events
|
||||
Touch Press Event
|
||||
click_comp.txt="button07"
|
||||
click_timer.en=1
|
||||
|
||||
Touch Release Event
|
||||
if(api==1)
|
||||
if(click_timer.en==1)
|
||||
{
|
||||
page alarm
|
||||
click_timer.en=0
|
||||
lastclick.txt="{\"page\": \"home\", \"event\": \"short_click\", \"component\": \""+click_comp.txt+"\"}"
|
||||
printh 92
|
||||
prints "localevent",0
|
||||
printh 00
|
||||
prints lastclick.txt,0
|
||||
printh 00
|
||||
printh FF FF FF
|
||||
}
|
||||
|
||||
Text meridiem
|
||||
|
||||
Binary file not shown.
@@ -6,7 +6,7 @@ Program.s
|
||||
int p=0,q=0,t=0,f=0
|
||||
int dimdelta=0
|
||||
int api=0 // 0 = disconnected from HA, 1 = connected to HA
|
||||
int is_alarm=0,is_entities=0,is_qrcode=0,is_notification=0
|
||||
int is_entities=0,is_qrcode=0,is_notification=0
|
||||
int brightness=100,brightness_dim=40
|
||||
int display_mode=2 // 1 = EU, 2 = US, 3 = US landscape
|
||||
int charset=2 // 1 = International (original), 2 = CJK
|
||||
|
||||
@@ -16,7 +16,6 @@ Page home
|
||||
vis bt_notific,is_notification
|
||||
vis bt_qrcode,is_qrcode
|
||||
vis bt_entities,is_entities
|
||||
vis bt_alarm,is_alarm
|
||||
if(display_mode==3)
|
||||
{
|
||||
vis left_bt_text,0
|
||||
@@ -364,7 +363,7 @@ Text bt_entities
|
||||
page entitypage01
|
||||
}
|
||||
|
||||
Text bt_alarm
|
||||
Text button07
|
||||
Attributes
|
||||
ID : 31
|
||||
Scope : global
|
||||
@@ -375,10 +374,21 @@ Text bt_alarm
|
||||
Max. Text Size : 3
|
||||
|
||||
Events
|
||||
Touch Press Event
|
||||
click_comp.txt="button07"
|
||||
click_timer.en=1
|
||||
|
||||
Touch Release Event
|
||||
if(api==1)
|
||||
if(click_timer.en==1)
|
||||
{
|
||||
page alarm
|
||||
click_timer.en=0
|
||||
lastclick.txt="{\"page\": \"home\", \"event\": \"short_click\", \"component\": \""+click_comp.txt+"\"}"
|
||||
printh 92
|
||||
prints "localevent",0
|
||||
printh 00
|
||||
prints lastclick.txt,0
|
||||
printh 00
|
||||
printh FF FF FF
|
||||
}
|
||||
|
||||
Text meridiem
|
||||
|
||||
Reference in New Issue
Block a user