Merge pull request #468 from Blackymas/beta
v.3.2 - New features and custom configurations
This commit is contained in:
14160
nspanel_blueprint.yaml
14160
nspanel_blueprint.yaml
File diff suppressed because it is too large
Load Diff
@@ -107,12 +107,22 @@ uart:
|
|||||||
baud_rate: 115200
|
baud_rate: 115200
|
||||||
id: tf_uart
|
id: tf_uart
|
||||||
|
|
||||||
###### REBOOT BUTTON #####
|
##### START - BUTTON CONFIGURATION #####
|
||||||
button:
|
button:
|
||||||
|
###### REBOOT BUTTON #####
|
||||||
- platform: restart
|
- platform: restart
|
||||||
name: ${device_name} Restart
|
name: ${device_name} Restart
|
||||||
id: restart_nspanel
|
id: restart_nspanel
|
||||||
|
|
||||||
|
##### UPDATE TFT DISPLAY #####
|
||||||
|
- platform: template
|
||||||
|
name: ${device_name} Update TFT display
|
||||||
|
icon: mdi:file-sync
|
||||||
|
id: tft_update
|
||||||
|
entity_category: config
|
||||||
|
on_press:
|
||||||
|
- delay: 16ms
|
||||||
|
- lambda: id(disp1).upload_tft();
|
||||||
|
|
||||||
##### START - API CONFIGURATION #####
|
##### START - API CONFIGURATION #####
|
||||||
api:
|
api:
|
||||||
@@ -161,7 +171,7 @@ api:
|
|||||||
- lambda: 'id(disp1).set_component_value(component.c_str(), message);'
|
- lambda: 'id(disp1).set_component_value(component.c_str(), message);'
|
||||||
|
|
||||||
##### Service to send a command "hide componente" directly to the display #####
|
##### Service to send a command "hide componente" directly to the display #####
|
||||||
- service: send_command_hide
|
- service: send_command_hide ### unused ###
|
||||||
variables:
|
variables:
|
||||||
component: string
|
component: string
|
||||||
then:
|
then:
|
||||||
@@ -170,7 +180,7 @@ api:
|
|||||||
- lambda: 'id(disp1).hide_component(component.c_str());'
|
- lambda: 'id(disp1).hide_component(component.c_str());'
|
||||||
|
|
||||||
##### Service to send a command "show componente" directly to the display #####
|
##### Service to send a command "show componente" directly to the display #####
|
||||||
- service: send_command_show
|
- service: send_command_show ### unused ###
|
||||||
variables:
|
variables:
|
||||||
component: string
|
component: string
|
||||||
then:
|
then:
|
||||||
@@ -178,6 +188,13 @@ api:
|
|||||||
switch.is_on: nextion_init
|
switch.is_on: nextion_init
|
||||||
- lambda: 'id(disp1).show_component(component.c_str());'
|
- lambda: 'id(disp1).show_component(component.c_str());'
|
||||||
|
|
||||||
|
##### Service to send a command "show ALL componente" directly to the display #####
|
||||||
|
- service: send_command_show_all ### unused ###
|
||||||
|
then:
|
||||||
|
- wait_until:
|
||||||
|
switch.is_on: nextion_init
|
||||||
|
- lambda: 'id(disp1).show_component("255");'
|
||||||
|
|
||||||
##### Service to send a command "font color" directly to the display #####
|
##### Service to send a command "font color" directly to the display #####
|
||||||
- service: send_command_font_color
|
- service: send_command_font_color
|
||||||
variables:
|
variables:
|
||||||
@@ -229,6 +246,16 @@ api:
|
|||||||
id(notification_text).publish_state("");
|
id(notification_text).publish_state("");
|
||||||
- switch.turn_off: notification_unread
|
- switch.turn_off: notification_unread
|
||||||
|
|
||||||
|
##### Service to set entity-information for settings-page(s)
|
||||||
|
- service: set_settings_entity
|
||||||
|
variables:
|
||||||
|
entity: string
|
||||||
|
then:
|
||||||
|
- wait_until:
|
||||||
|
switch.is_on: nextion_init
|
||||||
|
- lambda: |-
|
||||||
|
id(settings_entity).publish_state(entity.c_str());
|
||||||
|
|
||||||
##### Service to play a rtttl tones #####
|
##### Service to play a rtttl tones #####
|
||||||
# Example tones : https://codebender.cc/sketch:109888#RTTTL%20Songs.ino
|
# Example tones : https://codebender.cc/sketch:109888#RTTTL%20Songs.ino
|
||||||
- service: play_rtttl
|
- service: play_rtttl
|
||||||
@@ -338,18 +365,13 @@ binary_sensor:
|
|||||||
|
|
||||||
###### LEFT BUTTON BELOW DISPLAY TO TOGGLE RELAY#####
|
###### LEFT BUTTON BELOW DISPLAY TO TOGGLE RELAY#####
|
||||||
- platform: gpio
|
- platform: gpio
|
||||||
# name: ${device_name} Left Button
|
name: ${device_name} Left Button
|
||||||
id: left_button
|
id: left_button
|
||||||
pin:
|
pin:
|
||||||
number: 14
|
number: 14
|
||||||
inverted: true
|
inverted: true
|
||||||
on_click:
|
on_click:
|
||||||
- min_length: 50ms
|
|
||||||
max_length: 1000ms
|
|
||||||
then:
|
then:
|
||||||
- binary_sensor.template.publish:
|
|
||||||
id: left_button_short
|
|
||||||
state: ON
|
|
||||||
- if:
|
- if:
|
||||||
condition:
|
condition:
|
||||||
and:
|
and:
|
||||||
@@ -365,50 +387,17 @@ binary_sensor:
|
|||||||
switch.is_on: relay_1
|
switch.is_on: relay_1
|
||||||
then:
|
then:
|
||||||
- lambda: id(disp1).send_command_printf("home.icon_top_01.pic=105");
|
- lambda: id(disp1).send_command_printf("home.icon_top_01.pic=105");
|
||||||
- delay: 500ms
|
|
||||||
- binary_sensor.template.publish:
|
|
||||||
id: left_button_short
|
|
||||||
state: OFF
|
|
||||||
on_press:
|
|
||||||
then:
|
|
||||||
- lambda: |-
|
|
||||||
if (id(disp1_currentpage).state == "lightsettings" or id(disp1_currentpage).state == "coversettings") {
|
|
||||||
ESP_LOGD("nspanel", "settingspage -> no press");
|
|
||||||
} else {
|
|
||||||
// ESP_LOGD("nspanel", "release button");
|
|
||||||
id(disp1_lastclick_general).set_state("pressbuttonleft",true,true);
|
|
||||||
}
|
|
||||||
on_release:
|
|
||||||
then:
|
|
||||||
- lambda: |-
|
|
||||||
if (id(disp1_currentpage).state == "lightsettings" or id(disp1_currentpage).state == "coversettings") {
|
|
||||||
ESP_LOGD("nspanel", "settingspage -> no release");
|
|
||||||
} else {
|
|
||||||
// ESP_LOGD("nspanel", "release button");
|
|
||||||
id(disp1_lastclick_general).set_state("releasebuttonleft",true,true);
|
|
||||||
}
|
|
||||||
|
|
||||||
- platform: template
|
|
||||||
name: ${device_name} Left Button
|
|
||||||
id: left_button_short
|
|
||||||
lambda: |-
|
|
||||||
return {};
|
|
||||||
|
|
||||||
|
|
||||||
##### RIGHT BUTTON BELOW DISPLAY TO TOGGLE RELAY #####
|
##### RIGHT BUTTON BELOW DISPLAY TO TOGGLE RELAY #####
|
||||||
- platform: gpio
|
- platform: gpio
|
||||||
# name: ${device_name} Right Button
|
name: ${device_name} Right Button
|
||||||
id: right_button
|
id: right_button
|
||||||
pin:
|
pin:
|
||||||
number: 27
|
number: 27
|
||||||
inverted: true
|
inverted: true
|
||||||
on_click:
|
on_click:
|
||||||
- min_length: 50ms
|
|
||||||
max_length: 1000ms
|
|
||||||
then:
|
then:
|
||||||
- binary_sensor.template.publish:
|
|
||||||
id: right_button_short
|
|
||||||
state: ON
|
|
||||||
- if:
|
- if:
|
||||||
condition:
|
condition:
|
||||||
and:
|
and:
|
||||||
@@ -424,40 +413,24 @@ binary_sensor:
|
|||||||
switch.is_on: relay_2
|
switch.is_on: relay_2
|
||||||
then:
|
then:
|
||||||
- lambda: id(disp1).send_command_printf("home.icon_top_02.pic=106");
|
- lambda: id(disp1).send_command_printf("home.icon_top_02.pic=106");
|
||||||
- delay: 500ms
|
|
||||||
- binary_sensor.template.publish:
|
|
||||||
id: right_button_short
|
|
||||||
state: OFF
|
|
||||||
on_press:
|
|
||||||
then:
|
|
||||||
- lambda: |-
|
|
||||||
if (id(disp1_currentpage).state == "lightsettings" or id(disp1_currentpage).state == "coversettings") {
|
|
||||||
ESP_LOGD("nspanel", "settingspage -> no press");
|
|
||||||
} else {
|
|
||||||
// ESP_LOGD("nspanel", "release button");
|
|
||||||
id(disp1_lastclick_general).set_state("pressbuttonright",true,true);
|
|
||||||
}
|
|
||||||
on_release:
|
|
||||||
then:
|
|
||||||
- lambda: |-
|
|
||||||
if (id(disp1_currentpage).state == "lightsettings" or id(disp1_currentpage).state == "coversettings") {
|
|
||||||
ESP_LOGD("nspanel", "settingspage -> no release");
|
|
||||||
} else {
|
|
||||||
// ESP_LOGD("nspanel", "release button");
|
|
||||||
id(disp1_lastclick_general).set_state("releasebuttonright",true,true);
|
|
||||||
}
|
|
||||||
|
|
||||||
- platform: template
|
##### JUMP PAGE TO SETTING PAGE #####
|
||||||
name: ${device_name} Right Button
|
- platform: nextion
|
||||||
id: right_button_short
|
name: $device_name setting page
|
||||||
lambda: |-
|
page_id: 0
|
||||||
return {};
|
component_id: 53
|
||||||
|
internal: true
|
||||||
|
on_multi_click:
|
||||||
|
- timing:
|
||||||
|
- ON for at least 1s #LONG Press
|
||||||
|
then:
|
||||||
|
- lambda: 'id(disp1).send_command_printf("page settings");'
|
||||||
|
|
||||||
##### Restart NSPanel Button - Setting Page #####
|
##### Restart NSPanel Button - Setting Page #####
|
||||||
- platform: nextion
|
- platform: nextion
|
||||||
name: ${device_name} Restart
|
name: ${device_name} Restart
|
||||||
page_id: 7
|
page_id: 7
|
||||||
component_id: 8
|
component_id: 15
|
||||||
internal: true
|
internal: true
|
||||||
on_click:
|
on_click:
|
||||||
- button.press: restart_nspanel
|
- button.press: restart_nspanel
|
||||||
@@ -475,7 +448,7 @@ binary_sensor:
|
|||||||
- platform: nextion
|
- platform: nextion
|
||||||
name: ${device_name} Sleep Modus
|
name: ${device_name} Sleep Modus
|
||||||
page_id: 7
|
page_id: 7
|
||||||
component_id: 3
|
component_id: 16
|
||||||
internal: true
|
internal: true
|
||||||
on_click:
|
on_click:
|
||||||
- switch.toggle: sleep_modus
|
- switch.toggle: sleep_modus
|
||||||
@@ -504,6 +477,14 @@ sensor:
|
|||||||
- platform: wifi_signal
|
- platform: wifi_signal
|
||||||
name: ${device_name} RSSI
|
name: ${device_name} RSSI
|
||||||
update_interval: 60s
|
update_interval: 60s
|
||||||
|
on_value:
|
||||||
|
- if:
|
||||||
|
condition:
|
||||||
|
wifi.connected:
|
||||||
|
then:
|
||||||
|
- lambda: id(disp1).set_component_text_printf("home.wifi_icon", "%s", "\U0000E5A8");
|
||||||
|
else:
|
||||||
|
- lambda: id(disp1).set_component_text_printf("home.wifi_icon", "%s", "\U0000FFFF");
|
||||||
|
|
||||||
##### INTERNAL TEMPERATURE SENSOR, ADC VALUE #####
|
##### INTERNAL TEMPERATURE SENSOR, ADC VALUE #####
|
||||||
- platform: adc
|
- platform: adc
|
||||||
@@ -616,6 +597,10 @@ text_sensor:
|
|||||||
name: ${device_name} Notification Text
|
name: ${device_name} Notification Text
|
||||||
id: notification_text
|
id: notification_text
|
||||||
|
|
||||||
|
- platform: template
|
||||||
|
name: ${device_name} Settings Entity
|
||||||
|
id: settings_entity
|
||||||
|
|
||||||
##### last click sensor, the main action variable - push to HA #####
|
##### last click sensor, the main action variable - push to HA #####
|
||||||
- platform: nextion
|
- platform: nextion
|
||||||
nextion_id: disp1
|
nextion_id: disp1
|
||||||
@@ -800,16 +785,6 @@ switch:
|
|||||||
restore_state: false
|
restore_state: false
|
||||||
optimistic: true
|
optimistic: true
|
||||||
|
|
||||||
##### UPDATE TFT DISPLAY #####
|
|
||||||
- platform: template
|
|
||||||
name: ${device_name} Update TFT display
|
|
||||||
id: tft_update
|
|
||||||
entity_category: config
|
|
||||||
turn_on_action:
|
|
||||||
- delay: 16ms
|
|
||||||
- lambda: id(disp1).upload_tft();
|
|
||||||
- switch.turn_off: tft_update
|
|
||||||
|
|
||||||
##### PHYSICAL SWITCH 1 #####
|
##### PHYSICAL SWITCH 1 #####
|
||||||
- platform: gpio
|
- platform: gpio
|
||||||
name: ${device_name} Relay 1
|
name: ${device_name} Relay 1
|
||||||
@@ -950,11 +925,11 @@ display:
|
|||||||
on_setup:
|
on_setup:
|
||||||
then:
|
then:
|
||||||
- lambda: id(disp1).send_command_printf("page 8");
|
- lambda: id(disp1).send_command_printf("page 8");
|
||||||
- lambda: id(disp1).set_component_text_printf("boot.esph_version", "%s", "3.1.0"); ### esphome-version ###
|
- lambda: id(disp1).set_component_text_printf("boot.esph_version", "%s", "3.2"); ### esphome-version ###
|
||||||
- wait_until:
|
- wait_until:
|
||||||
api.connected
|
api.connected
|
||||||
- lambda: id(disp1).set_component_text_printf("boot.ip_addr", "%s", id(ip_address).state.c_str());
|
- lambda: id(disp1).set_component_text_printf("boot.ip_addr", "%s", id(ip_address).state.c_str());
|
||||||
- delay: 0.5s
|
- delay: 1s
|
||||||
- number.set:
|
- number.set:
|
||||||
id: display_brightness
|
id: display_brightness
|
||||||
value: !lambda 'return id(display_brightness_global);'
|
value: !lambda 'return id(display_brightness_global);'
|
||||||
@@ -967,7 +942,7 @@ display:
|
|||||||
- lambda: id(disp1).send_command_printf("settings.dimslider.val=%i", id(display_dim_brightness_global));
|
- lambda: id(disp1).send_command_printf("settings.dimslider.val=%i", id(display_dim_brightness_global));
|
||||||
- lambda: id(disp1).send_command_printf("home.sleepmodus.val=%i", id(sleep_modus_global));
|
- lambda: id(disp1).send_command_printf("home.sleepmodus.val=%i", id(sleep_modus_global));
|
||||||
- lambda: id(disp1).set_component_value("settings.a02", id(sleep_modus_global) == 1);
|
- lambda: id(disp1).set_component_value("settings.a02", id(sleep_modus_global) == 1);
|
||||||
- delay: 0.5s
|
- delay: 1s
|
||||||
- switch.template.publish:
|
- switch.template.publish:
|
||||||
id: nextion_init
|
id: nextion_init
|
||||||
state: on
|
state: on
|
||||||
@@ -988,4 +963,3 @@ script:
|
|||||||
ESP_LOGD("nspanel", "timer->home");
|
ESP_LOGD("nspanel", "timer->home");
|
||||||
id(disp1).send_command_printf("page 0");
|
id(disp1).send_command_printf("page 0");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
BIN
nspanel_eu.HMI
BIN
nspanel_eu.HMI
Binary file not shown.
BIN
nspanel_eu.tft
BIN
nspanel_eu.tft
Binary file not shown.
BIN
nspanel_us.HMI
BIN
nspanel_us.HMI
Binary file not shown.
BIN
nspanel_us.tft
BIN
nspanel_us.tft
Binary file not shown.
Reference in New Issue
Block a user