current Version blueprint and esphome

This commit is contained in:
Blackymas
2022-10-27 15:17:29 +02:00
parent 498451ba6d
commit f76a111c22
2 changed files with 15010 additions and 129 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -4,13 +4,13 @@
substitutions:
##### GENEREL CONFIG #############################################################################################
node_name: nspanel-buero # $node_name
device_name: NSPanel Büro # $device_name
device_name: NSPanel Buero # $device_name
wifi_ssid: !secret wifi_ssid # add in your esphome secrets file.
wifi_password: !secret wifi_password # add in your esphome secrets file.
ota_password: !secret ota_password # add in your esphome secrets file.
nextion_update_url: !secret nextion_update_url_buero # add in your esphome secrets file.
# nextion_update_url: !secret nextion_update_url_buero # add in your esphome secrets file.
nextion_update_url: "http://192.168.4.250:8123/local/nspanel/buero/nspanel_buero.tft"
###### EDIT THE BELOW ENTITIES FOR YOURS... #######################################################################
#ha_weekday: sensor.wochentag ##### Sensor Wochentag generiert in HA (custom_configuration -> nspanel) #####
@@ -174,6 +174,36 @@ api:
switch.is_on: nextion_init
- lambda: 'id(disp1).set_component_value(component.c_str(), message);'
##### Service to send a command "component_value (Dualstate Button)" directly to the display. Useful for testing #####
- service: send_command_hide
variables:
component: string
then:
- wait_until:
switch.is_on: nextion_init
- lambda: 'id(disp1).hide_component(component.c_str());'
##### Service to send a command "component_value (Dualstate Button)" directly to the display. Useful for testing #####
- service: send_command_font_color
variables:
component: string
message: int
then:
- wait_until:
switch.is_on: nextion_init
- lambda: 'id(disp1).set_component_font_color(component.c_str(), message);'
##### Service to send a command "component_value (Dualstate Button)" directly to the display. Useful for testing #####
- service: send_command_background_color
variables:
component: string
message: int
then:
- wait_until:
switch.is_on: nextion_init
- lambda: 'id(disp1).set_component_background_color(component.c_str(), message);'
#########################################
#
#
@@ -266,8 +296,8 @@ binary_sensor:
pin:
number: 14
inverted: true
on_click:
- switch.toggle: relay_1
# on_click:
# - switch.toggle: relay_1
##### RIGHT BUTTON BELOW DISPLAY TO TOGGLE RELAY #####
- platform: gpio
@@ -275,14 +305,14 @@ binary_sensor:
pin:
number: 27
inverted: true
on_click:
- switch.toggle: relay_2
# on_click:
# - switch.toggle: relay_2
##### THERMOSTAT - BUTTON DECREASES CLIMATE TARGET TEMPERATURE IN HA #####
- platform: nextion
name: $device_name Climate Target DOWN
page_id: 6
component_id: 14
component_id: 13
internal: true
on_click:
- homeassistant.service:
@@ -295,7 +325,7 @@ binary_sensor:
- platform: nextion
name: $device_name Climate Target UP
page_id: 6
component_id: 15
component_id: 14
internal: true
on_click:
- homeassistant.service:
@@ -309,68 +339,68 @@ binary_sensor:
name: $device_name Heating Room State
id: heating_room_state
page_id: 6
component_id: 17
component_id: 16
internal: true
on_click:
- switch.toggle: hvac_mode
##### Display Brightness - BUTTON DECREASES Brightness #####
- platform: nextion
name: $device_name Brightness DOWN
page_id: 7
component_id: 12
internal: true
on_click:
- number.set:
id: display_brightness
value: !lambda return id(display_brightness_global) - 1;
- lambda: id(disp1).set_component_text_printf("settings.a03", "%i", id(display_brightness_global));
- lambda: id(disp1).send_command_printf("settings.brightslider.val=%i", id(display_brightness_global));
# - platform: nextion
# name: $device_name Brightness DOWN
# page_id: 7
# component_id: 12
# internal: true
# on_click:
# - number.set:
# id: display_brightness
# value: !lambda return id(display_brightness_global) - 1;
# - lambda: id(disp1).set_component_text_printf("settings.a03", "%i", id(display_brightness_global));
# - lambda: id(disp1).send_command_printf("settings.brightslider.val=%i", id(display_brightness_global));
##### Display Brightness - BUTTON INCREASES Brightness #####
- platform: nextion
name: $device_name Brightness UP
page_id: 7
component_id: 13
internal: true
on_click:
- number.set:
id: display_brightness
value: !lambda return id(display_brightness_global) + 1;
- lambda: id(disp1).set_component_text_printf("settings.a03", "%i", id(display_brightness_global));
- lambda: id(disp1).send_command_printf("settings.brightslider.val=%i", id(display_brightness_global));
# - platform: nextion
# name: $device_name Brightness UP
# page_id: 7
# component_id: 13
# internal: true
# on_click:
# - number.set:
# id: display_brightness
# value: !lambda return id(display_brightness_global) + 1;
# - lambda: id(disp1).set_component_text_printf("settings.a03", "%i", id(display_brightness_global));
# - lambda: id(disp1).send_command_printf("settings.brightslider.val=%i", id(display_brightness_global));
##### Display DIM Brightness - BUTTON DECREASES Brightness #####
- platform: nextion
name: $device_name Brightness DIM DOWN
page_id: 7
component_id: 14
internal: true
on_click:
- number.set:
id: display_dim_brightness
value: !lambda return id(display_dim_brightness_global) - 1;
- lambda: id(disp1).set_component_text_printf("settings.a04", "%i", id(display_dim_brightness_global));
- lambda: id(disp1).send_command_printf("settings.dimslider.val=%i", id(display_dim_brightness_global));
# - platform: nextion
# name: $device_name Brightness DIM DOWN
# page_id: 7
# component_id: 14
# internal: true
# on_click:
# - number.set:
# id: display_dim_brightness
# value: !lambda return id(display_dim_brightness_global) - 1;
# - lambda: id(disp1).set_component_text_printf("settings.a04", "%i", id(display_dim_brightness_global));
# - lambda: id(disp1).send_command_printf("settings.dimslider.val=%i", id(display_dim_brightness_global));
##### Display DIM Brightness - BUTTON INCREASES Brightness #####
- platform: nextion
name: $device_name Brightness DIM UP
page_id: 7
component_id: 15
internal: true
on_click:
- number.set:
id: display_dim_brightness
value: !lambda return id(display_dim_brightness_global) + 1;
- lambda: id(disp1).set_component_text_printf("settings.a04", "%i", id(display_dim_brightness_global));
- lambda: id(disp1).send_command_printf("settings.dimslider.val=%i", id(display_dim_brightness_global));
# - platform: nextion
# name: $device_name Brightness DIM UP
# page_id: 7
# component_id: 15
# internal: true
# on_click:
# - number.set:
# id: display_dim_brightness
# value: !lambda return id(display_dim_brightness_global) + 1;
# - lambda: id(disp1).set_component_text_printf("settings.a04", "%i", id(display_dim_brightness_global));
# - lambda: id(disp1).send_command_printf("settings.dimslider.val=%i", id(display_dim_brightness_global));
##### Restart NSPanel Button #####
- platform: nextion
name: $device_name Restart
page_id: 7
component_id: 11
component_id: 10
internal: true
on_click:
- button.press: restart_nspanel
@@ -379,7 +409,7 @@ binary_sensor:
- platform: nextion
name: $device_name Sleep Modus
page_id: 7
component_id: 6
component_id: 5
internal: true
on_click:
- switch.toggle: sleep_modus
@@ -388,7 +418,7 @@ binary_sensor:
- platform: nextion
name: $device_name Hotwater Charge
page_id: 6
component_id: 22
component_id: 21
on_click:
- homeassistant.service:
service: switch.toggle
@@ -806,9 +836,9 @@ text_sensor:
- wait_until:
switch.is_on: nextion_init
- lambda: |-
int symbol=60; // 60 is a blank image 30x30
int symbol=53; // 53 is a blank image 20x20
if (id(heating_system).state == "on") {
symbol=61;
symbol=64;
}
id(disp1).send_command_printf("home.a50.pic=%i", symbol);
id(disp1).send_command_printf("thermostat.a50.pic=%i", symbol);
@@ -836,50 +866,50 @@ text_sensor:
# }
##### WEATHER SYMBOL FROM HA WEATHER ENTITY #####
- platform: homeassistant
id: weather_symbol
entity_id: weather.home_wetter
on_value:
then:
- wait_until:
switch.is_on: nextion_init
- lambda: |-
int symbol=1; // 1 is a empty box.
if (id(weather_symbol).state == "sunny") {
symbol=2;
} else if (id(weather_symbol).state == "cloudy") {
symbol=3;
if (id(sun_sun).state == "below_horizon") {
symbol=3;
}
} else if (id(weather_symbol).state == "rainy") {
symbol=4;
} else if (id(weather_symbol).state == "pouring") {
symbol=5;
} else if (id(weather_symbol).state == "snowy") {
symbol=6;
} else if (id(weather_symbol).state == "hail" || id(weather_symbol).state == "snowy-rainy") {
symbol=7;
} else if (id(weather_symbol).state == "fog") {
symbol=8;
} else if (id(weather_symbol).state == "windy" || id(weather_symbol).state == "windy-variant") {
symbol=9;
} else if (id(weather_symbol).state == "lightning") {
symbol=10;
} else if (id(weather_symbol).state == "partlycloudy") {
symbol=11;
if (id(sun_sun).state == "below_horizon") {
symbol=12;
}
} else if (id(weather_symbol).state == "lightning-rainy" || id(weather_symbol).state == "exceptional") {
symbol=13;
if (id(sun_sun).state == "below_horizon") {
symbol=14;
}
} else if (id(weather_symbol).state == "clear-night") {
symbol=15;
}
id(disp1).send_command_printf("home.a05.pic=%i", symbol);
# - platform: homeassistant
# id: weather_symbol
# entity_id: weather.home_wetter
# on_value:
# then:
# - wait_until:
# switch.is_on: nextion_init
# - lambda: |-
# int symbol=1; // 1 is a empty box.
# if (id(weather_symbol).state == "sunny") {
# symbol=2;
# } else if (id(weather_symbol).state == "cloudy") {
# symbol=3;
# if (id(sun_sun).state == "below_horizon") {
# symbol=3;
# }
# } else if (id(weather_symbol).state == "rainy") {
# symbol=4;
# } else if (id(weather_symbol).state == "pouring") {
# symbol=5;
# } else if (id(weather_symbol).state == "snowy") {
# symbol=6;
# } else if (id(weather_symbol).state == "hail" || id(weather_symbol).state == "snowy-rainy") {
# symbol=7;
# } else if (id(weather_symbol).state == "fog") {
# symbol=8;
# } else if (id(weather_symbol).state == "windy" || id(weather_symbol).state == "windy-variant") {
# symbol=9;
# } else if (id(weather_symbol).state == "lightning") {
# symbol=10;
# } else if (id(weather_symbol).state == "partlycloudy") {
# symbol=11;
# if (id(sun_sun).state == "below_horizon") {
# symbol=12;
# }
# } else if (id(weather_symbol).state == "lightning-rainy" || id(weather_symbol).state == "exceptional") {
# symbol=13;
# if (id(sun_sun).state == "below_horizon") {
# symbol=14;
# }
# } else if (id(weather_symbol).state == "clear-night") {
# symbol=15;
# }
# id(disp1).send_command_printf("home.a05.pic=%i", symbol);
#########################################
#
@@ -941,19 +971,19 @@ switch:
- lambda: |-
if (id(hvac_mode_global) == 0)
{
id(disp1).send_command_printf("thermostat.a06.pic=51");
id(disp1).send_command_printf("thermostat.a06.pic=49");
} else if (id(hvac_mode_global) == 1) {
id(disp1).send_command_printf("thermostat.a06.pic=52");
id(disp1).send_command_printf("thermostat.a06.pic=50");
}
- lambda: id(disp1).send_command_printf("home.a52.pic=60");
- lambda: id(disp1).send_command_printf("thermostat.a52.pic=60");
- lambda: id(disp1).send_command_printf("home.a52.pic=53");
- lambda: id(disp1).send_command_printf("thermostat.a52.pic=53");
on_turn_on:
- globals.set:
id: heating_room_global
value: '1'
- lambda: id(disp1).send_command_printf("thermostat.a06.pic=53");
- lambda: id(disp1).send_command_printf("home.a52.pic=63");
- lambda: id(disp1).send_command_printf("thermostat.a52.pic=63");
- lambda: id(disp1).send_command_printf("thermostat.a06.pic=51");
- lambda: id(disp1).send_command_printf("home.a52.pic=66");
- lambda: id(disp1).send_command_printf("thermostat.a52.pic=66");
##### Switch Climate HVAC Mode #####
- platform: template
@@ -973,9 +1003,9 @@ switch:
data_template:
entity_id: $ha_climate_thermostat
hvac_mode: 'off'
- lambda: id(disp1).send_command_printf("thermostat.a06.pic=51");
- lambda: id(disp1).send_command_printf("home.a51.pic=60");
- lambda: id(disp1).send_command_printf("thermostat.a51.pic=60");
- lambda: id(disp1).send_command_printf("thermostat.a06.pic=49");
- lambda: id(disp1).send_command_printf("home.a51.pic=53");
- lambda: id(disp1).send_command_printf("thermostat.a51.pic=53");
on_turn_on:
- lambda: id(disp1).set_component_value("thermostat.a10",1);
- globals.set:
@@ -989,12 +1019,12 @@ switch:
- lambda: |-
if (id(heating_room_global) == 0)
{
id(disp1).send_command_printf("thermostat.a06.pic=52");
id(disp1).send_command_printf("thermostat.a06.pic=50");
} else if (id(heating_room_global) == 1) {
id(disp1).send_command_printf("thermostat.a06.pic=53");
id(disp1).send_command_printf("thermostat.a06.pic=51");
}
- lambda: id(disp1).send_command_printf("home.a51.pic=62");
- lambda: id(disp1).send_command_printf("thermostat.a51.pic=62");
- lambda: id(disp1).send_command_printf("home.a51.pic=65");
- lambda: id(disp1).send_command_printf("thermostat.a51.pic=65");
##### DISPLAY ALWAYS ON #####
- platform: gpio
@@ -1143,26 +1173,26 @@ display:
id(disp1).set_component_value("settings.a02",1);
}
- lambda: |-
id(disp1).send_command_printf("home.a50.pic=60");
id(disp1).send_command_printf("thermostat.a50.pic=60");
id(disp1).send_command_printf("thermostat.a06.pic=52");
id(disp1).send_command_printf("home.a50.pic=53");
id(disp1).send_command_printf("thermostat.a50.pic=53");
id(disp1).send_command_printf("thermostat.a06.pic=50");
if (id(heating_room_global) == 1)
{
id(disp1).send_command_printf("home.a52.pic=63");
id(disp1).send_command_printf("thermostat.a52.pic=63");
id(disp1).send_command_printf("thermostat.a06.pic=53");
id(disp1).send_command_printf("home.a52.pic=66");
id(disp1).send_command_printf("thermostat.a52.pic=66");
id(disp1).send_command_printf("thermostat.a06.pic=51");
}
- lambda: |-
if (id(hvac_mode_global) == 0) {
id(disp1).send_command_printf("home.a51.pic=60");
id(disp1).send_command_printf("thermostat.a51.pic=60");
id(disp1).send_command_printf("thermostat.a06.pic=51");
id(disp1).send_command_printf("home.a51.pic=53");
id(disp1).send_command_printf("thermostat.a51.pic=53");
id(disp1).send_command_printf("thermostat.a06.pic=49");
} else if (id(hvac_mode_global) == 1) {
id(disp1).send_command_printf("home.a51.pic=62");
id(disp1).send_command_printf("thermostat.a51.pic=62");
id(disp1).send_command_printf("home.a51.pic=65");
id(disp1).send_command_printf("thermostat.a51.pic=65");
id(disp1).set_component_value("thermostat.a10",1);
}
#############################################################
##### CLOSE - DISPLAY START #####
#############################################################
#############################################################