Merge pull request #585 from Blackymas/dev

v.3.2.2 - fixed some bugs
This commit is contained in:
Blackymas
2023-04-03 16:40:51 +02:00
committed by GitHub
6 changed files with 522 additions and 1936 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -49,15 +49,19 @@ wifi:
password: ${wifi_password}
##### Functionality for the Nextion display #####
external_components:
- source: github://pr#2956
components: [nextion]
refresh: 1h
# external_components:
# - source: github://pr#2956
# components: [nextion]
# refresh: 1h
##### ESPHOME CONFIGURATION #####
esphome:
name: ${device_name}
min_version: 2022.10.2
on_boot:
priority: 601
then:
- lambda: id(disp1).send_command_printf("DRAKJHSUYDGBNCJHGJKSHBDN");
##### TYPE OF ESP BOARD #####
esp32:
@@ -302,6 +306,41 @@ api:
id(disp1).set_component_text_printf("target_temp", "%.1f°", value);
id(display_target_temp).publish_state(value);
#### Service to set the buttons ####
- service: set_button
variables:
btn_id: string
btn_pic: int
btn_bg: int
btn_icon_font: int
btn_txt_font: int
btn_bri_font: int
btn_icon: string
btn_label: string
btn_bri_txt: string
then:
- wait_until:
switch.is_on: nextion_init
- lambda: |-
// ESP_LOGD("nextion", "set button %s", btn_id.c_str());
std::string btnicon = btn_id.c_str() + std::string("icon");
std::string btntext = btn_id.c_str() + std::string("text");
std::string btnbri = btn_id.c_str() + std::string("bri");
id(disp1).send_command_printf("%spic.pic=%i", btn_id.c_str(), btn_pic);
id(disp1).set_component_background_color(btnicon.c_str(), btn_bg);
id(disp1).set_component_background_color(btntext.c_str(), btn_bg);
id(disp1).set_component_background_color(btnbri.c_str(), btn_bg);
id(disp1).set_component_font_color(btnicon.c_str(), btn_icon_font);
id(disp1).set_component_font_color(btntext.c_str(), btn_txt_font);
id(disp1).set_component_font_color(btnbri.c_str(), btn_bri_font);
id(disp1).set_component_text_printf(btnicon.c_str(), "%s", btn_icon.c_str());
id(disp1).set_component_text_printf(btntext.c_str(), "%s", btn_label.c_str());
// id(disp1).set_component_text_printf(btnbri.c_str(), "%s", btn_bri_txt.c_str());
if (strcmp(btn_bri_txt.c_str(), "0") != 0) {
id(disp1).set_component_text_printf(btnbri.c_str(), "%s", btn_bri_txt.c_str());
} else {
id(disp1).set_component_text_printf(btnbri.c_str(), " ");
}
##### START - GLOBALS CONFIGURATION #####
globals:
@@ -380,13 +419,15 @@ binary_sensor:
api.connected:
then:
- switch.toggle: relay_1
- lambda: id(disp1).send_command_printf("home.icon_top_01.pic=51");
- lambda: id(disp1).send_command_printf("home.left_bt_pic.pic=98");
- if:
condition:
switch.is_on: relay_1
then:
- lambda: id(disp1).send_command_printf("home.icon_top_01.pic=105");
- lambda: id(disp1).send_command_printf("home.left_bt_pic.pic=78");
- lambda: id(disp1).send_command_printf("home.icon_top_01","\U0000E3A5");
else:
- lambda: id(disp1).send_command_printf("home.left_bt_pic.pic=77");
- lambda: id(disp1).send_command_printf("home.icon_top_01","\U0000FFFF");
##### RIGHT BUTTON BELOW DISPLAY TO TOGGLE RELAY #####
@@ -406,19 +447,21 @@ binary_sensor:
api.connected:
then:
- switch.toggle: relay_2
- lambda: id(disp1).send_command_printf("home.icon_top_02.pic=51");
- lambda: id(disp1).send_command_printf("home.right_bt_pic.pic=98");
- if:
condition:
switch.is_on: relay_2
then:
- lambda: id(disp1).send_command_printf("home.icon_top_02.pic=106");
- lambda: id(disp1).send_command_printf("home.right_bt_pic.pic=78");
- lambda: id(disp1).send_command_printf("home.icon_top_02","\U0000E3A8");
else:
- lambda: id(disp1).send_command_printf("home.right_bt_pic.pic=77");
- lambda: id(disp1).send_command_printf("home.icon_top_02","\U0000FFFF");
##### JUMP PAGE TO SETTING PAGE #####
- platform: nextion
name: $device_name setting page
page_id: 0
component_id: 53
component_id: 52
internal: true
on_multi_click:
- timing:
@@ -430,7 +473,7 @@ binary_sensor:
- platform: nextion
name: ${device_name} Restart
page_id: 7
component_id: 15
component_id: 13
internal: true
on_click:
- button.press: restart_nspanel
@@ -439,7 +482,7 @@ binary_sensor:
- platform: nextion
name: ${device_name} Restart
page_id: 8
component_id: 5
component_id: 4
internal: true
on_click:
- button.press: restart_nspanel
@@ -448,7 +491,7 @@ binary_sensor:
- platform: nextion
name: ${device_name} Sleep Modus
page_id: 7
component_id: 16
component_id: 14
internal: true
on_click:
- switch.toggle: sleep_modus
@@ -925,7 +968,7 @@ display:
on_setup:
then:
- lambda: id(disp1).send_command_printf("page 8");
- lambda: id(disp1).set_component_text_printf("boot.esph_version", "%s", "3.2"); ### esphome-version ###
- lambda: id(disp1).set_component_text_printf("boot.esph_version", "%s", "3.2.2"); ### esphome-version ###
- wait_until:
api.connected
- lambda: id(disp1).set_component_text_printf("boot.ip_addr", "%s", id(ip_address).state.c_str());

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.