Test deeper with Arduino and IDF v5

This commit is contained in:
Edward Firmo
2024-04-18 19:17:41 +02:00
parent 5206898c98
commit 5c867d1653
24 changed files with 663 additions and 163 deletions

View File

@@ -8,7 +8,8 @@ substitutions:
packages:
basic_package: !include ../nspanel_esphome.yaml # Core package
advanced_package: !include ../esphome/nspanel_esphome_advanced.yaml
# addon_climate_heat: !include ../esphome/nspanel_esphome_addon_climate_heat.yaml
# addon_climate_cool: !include ../esphome/nspanel_esphome_addon_climate_cool.yaml
# addon_climate_dual: !include ../esphome/nspanel_esphome_addon_climate_dual.yaml
esp32:
framework:
type: arduino
...

View File

@@ -0,0 +1,240 @@
---
substitutions:
device_name: nspanel
wifi_ssid: "nspanel"
wifi_password: "NSPanel_HA_Blueprint"
nextion_blank_url: "http://homeassistant.local:8123/local/nspanel_blank.tft"
packages:
basic_package: !include ../nspanel_esphome.yaml # Core package
advanced_package: !include ../esphome/nspanel_esphome_advanced.yaml
addon_climate_heat: !include ../esphome/nspanel_esphome_addon_climate_heat.yaml
esp32:
framework:
type: arduino
##### Customizations from Wiki #####
api:
# Encrypt the communication between ESPHome and Home Assistant
encryption:
key: !secret api_encryption_key
# Reboot if HA is not connected for 15 minutes
reboot_timeout: 15min
binary_sensor:
# Is display awake?
- name: ${device_name} Display state
id: display_state
platform: template
lambda: |-
return (current_page->state != "screensaver");
button:
# Adds a button to put the panel to sleep
- name: ${device_name} Sleep
id: force_sleep
platform: template
icon: mdi:sleep
on_press:
then:
- logger.log: Button Sleep pressed
- lambda: |-
goto_page->execute("screensaver");
# Adds a button to wake-up the panel (similar to the existing service)
- name: ${device_name} Wake-up
id: force_wake_up
platform: template
icon: mdi:alarm
on_press:
then:
- logger.log: Button Wake-up pressed
- lambda: |-
if (current_page->state == "screensaver") id(disp1).goto_page(id(wakeup_page_name).state.c_str());
// timer_page->execute(); // enable this if you want page timeout to be reset
timer_sleep->execute();
timer_dim->execute();
# Add custom presets to your climate (heat in this example)
climate:
- id: !extend thermostat_embedded
heat_deadband: 0.3
heat_overrun: 0.0
default_preset: "Home"
preset:
- name: "Off"
default_target_temperature_low: ${temp_min} ${temp_units}
mode: "off"
- name: Home
default_target_temperature_low: 21 ${temp_units}
mode: "heat"
- name: Away
default_target_temperature_low: 16.5 ${temp_units}
mode: "heat"
- name: Sleep
default_target_temperature_low: 17.5 ${temp_units}
mode: "heat"
esphome:
# change OTA password, remove after flashing
on_boot:
- priority: 601.0
then:
- lambda: |-
id(my_ota).set_auth_password("New password");
# Limit the amount of resources used for compiling
compile_process_limit: 1
light:
# Add the display as a light in Home Assistant
- name: ${device_name} Display
id: display_light
icon: mdi:tablet-dashboard
platform: monochromatic
output: display_output
default_transition_length: 0s
on_turn_on:
then:
- lambda: |-
ESP_LOGD("light.display_light", "Turn-on");
if (current_page->state == "screensaver") disp1->goto_page(wakeup_page_name->state.c_str());
timer_reset_all->execute();
on_turn_off:
then:
- lambda: |-
ESP_LOGD("light.display_light", "Turn-off");
goto_page->execute("screensaver");
logger:
# Enable hardware UART serial logging
baud_rate: 115200
ota:
# change OTA password, remove after flashing
password: !secret wifi_password
id: my_ota
output:
# Output required by `display_light` to send the commands to Nextion
- id: display_output
platform: template
type: float
write_action:
- lambda: |-
ESP_LOGV("output.display_output", "state: %f", state);
uint8_t current_brightness = int(round(display_light->current_values.is_on() ? (display_light->current_values.get_brightness() * 100.0f) : 0.0));
ESP_LOGV("output.display_output", "current_brightness: %i%%", current_brightness);
set_brightness->execute(current_brightness);
script:
# Updates the existing `page_changed` script to update the `display_light` status when a page changes
- id: !extend page_changed
then:
- lambda: |-
ESP_LOGD("script.page_changed(custom)", "page: %s", current_page->state.c_str());
ESP_LOGV("script.page_changed(custom)", "is_on(): %s", display_light->current_values.is_on() ? "True" : "False");
if (current_page->state == "screensaver" and display_light->current_values.is_on()) {
auto call = display_light->turn_off();
call.perform();
} else if (current_page->state != "screensaver" and (not display_light->current_values.is_on())) {
auto call = display_light->turn_on();
call.perform();
}
# Updates the existing `set_brightness` script to update the `display_light` status when a new brightness level is set
- id: !extend set_brightness
then:
- lambda: |-
ESP_LOGD("script.set_brightness(custom)", "brightness: %.0f%%", brightness);
uint8_t current_light_brightness = int(round(display_light->current_values.is_on() ? (display_light->current_values.get_brightness() * 100.0f) : 0.0));
ESP_LOGV("script.set_brightness(custom)", "current_light_brightness: %i%%", current_light_brightness);
if (brightness != current_light_brightness) {
if (current_page->state != "screensaver" and brightness > 0) {
auto call = display_light->turn_on();
call.set_brightness(current_brightness->state / 100.0f);
call.perform();
} else if (display_light->current_values.is_on()) {
auto call = display_light->turn_off();
call.set_brightness(0);
call.perform();
}
}
time:
- id: !extend time_provider
timezone: "America/Cancun"
# Use my own local network time server
platform: sntp
servers:
- !secret mysntpserver
- europe.pool.ntp.org
- 0.pool.ntp.org
on_time:
# Scheduled relay
- hours: 7
minutes: 30
seconds: 0
then:
- switch.turn_on: relay_1
- hours: 12
minutes: 15
seconds: 0
then:
- switch.turn_off: relay_1
- hours: 19
minutes: 30
seconds: 0
then:
- switch.turn_on: relay_1
- hours: 23
minutes: 30
seconds: 0
then:
- switch.turn_off: relay_1
# Scheduled climate
- hours: 7
minutes: 0
seconds: 0
then:
- climate.control:
id: thermostat_embedded
mode: auto
target_temperature: 22°C
- hours: 19
minutes: 0
seconds: 0
then:
- climate.control:
id: thermostat_embedded
mode: auto
target_temperature: 20°C
- hours: 23
minutes: 0
seconds: 0
then:
- climate.control:
id: thermostat_embedded
mode: auto
target_temperature: 18°C
web_server:
# Custom web server credentials
auth:
username: !secret web_server_username
password: !secret web_server_password
wifi:
networks:
- id: !extend wifi_default
# Set IP address manually
manual_ip:
static_ip: 192.168.0.123
gateway: 192.168.0.1
subnet: 255.255.255.0
# Set dual network
priority: 10
- ssid: !secret wifi_ssid_backup
password: !secret wifi_password_backup
priority: 0
...

View File

@@ -0,0 +1,14 @@
---
substitutions:
device_name: nspanel
wifi_ssid: "nspanel"
wifi_password: "NSPanel_HA_Blueprint"
nextion_update_url: "https://github.com/Blackymas/NSPanel_HA_Blueprint/dummy"
packages:
basic_package: !include ../nspanel_esphome.yaml # Basic package
esp32:
framework:
type: arduino
...

View File

@@ -7,10 +7,7 @@ substitutions:
packages:
basic_package: !include ../nspanel_esphome.yaml # Core package
advanced_package: !include ../esphome/nspanel_esphome_advanced.yaml
# addon_climate_heat: !include ../esphome/nspanel_esphome_addon_climate_heat.yaml
addon_climate_cool: !include ../esphome/nspanel_esphome_addon_climate_cool.yaml
# addon_climate_dual: !include ../esphome/nspanel_esphome_addon_climate_dual.yaml
esp32:
framework:

View File

@@ -7,8 +7,9 @@ substitutions:
packages:
basic_package: !include ../nspanel_esphome.yaml # Core package
# advanced_package: !include ../esphome/nspanel_esphome_advanced.yaml
# addon_climate_heat: !include ../esphome/nspanel_esphome_addon_climate_heat.yaml
# addon_climate_cool: !include ../esphome/nspanel_esphome_addon_climate_cool.yaml
addon_climate_dual: !include ../esphome/nspanel_esphome_addon_climate_dual.yaml
esp32:
framework:
type: arduino
...

View File

@@ -7,8 +7,9 @@ substitutions:
packages:
basic_package: !include ../nspanel_esphome.yaml # Core package
# advanced_package: !include ../esphome/nspanel_esphome_advanced.yaml
addon_climate_heat: !include ../esphome/nspanel_esphome_addon_climate_heat.yaml
# addon_climate_cool: !include ../esphome/nspanel_esphome_addon_climate_cool.yaml
# addon_climate_dual: !include ../esphome/nspanel_esphome_addon_climate_dual.yaml
esp32:
framework:
type: arduino
...

View File

@@ -1,14 +0,0 @@
---
substitutions:
device_name: nspanel
wifi_ssid: "nspanel"
wifi_password: "NSPanel_HA_Blueprint"
nextion_update_url: "https://github.com/Blackymas/NSPanel_HA_Blueprint/dummy"
packages:
basic_package: !include ../nspanel_esphome.yaml # Basic package
# advanced_package: !include ../esphome/nspanel_esphome_advanced.yaml
# addon_climate_heat: !include ../esphome/nspanel_esphome_addon_climate_heat.yaml
# addon_climate_cool: !include ../esphome/nspanel_esphome_addon_climate_cool.yaml
# addon_climate_dual: !include ../esphome/nspanel_esphome_addon_climate_dual.yaml
...

View File

@@ -1,25 +0,0 @@
---
substitutions:
device_name: nspanel
wifi_ssid: "nspanel"
wifi_password: "NSPanel_HA_Blueprint"
nextion_update_url: "https://github.com/Blackymas/NSPanel_HA_Blueprint/dummy"
packages:
basic_package: !include ../nspanel_esphome.yaml # Core package
# advanced_package: !include ../esphome/nspanel_esphome_advanced.yaml
# addon_climate_heat: !include ../esphome/nspanel_esphome_addon_climate_heat.yaml
addon_climate_cool: !include ../esphome/nspanel_esphome_addon_climate_cool.yaml
# addon_climate_dual: !include ../esphome/nspanel_esphome_addon_climate_dual.
bluetooth_proxy:
id: ble_proxy
esp32_ble_tracker:
id: ble_tracker
# Set Wi-Fi power save mode to "LIGHT" as required for Bluetooth on ESP32
wifi:
power_save_mode: LIGHT
...

View File

@@ -0,0 +1,11 @@
---
substitutions:
device_name: nspanel
wifi_ssid: "nspanel"
wifi_password: "NSPanel_HA_Blueprint"
nextion_update_url: "https://github.com/Blackymas/NSPanel_HA_Blueprint/dummy"
packages:
basic_package: !include ../nspanel_esphome.yaml # Core package
advanced_package: !include ../esphome/nspanel_esphome_advanced.yaml
...

View File

@@ -0,0 +1,10 @@
---
substitutions:
device_name: nspanel
wifi_ssid: "nspanel"
wifi_password: "NSPanel_HA_Blueprint"
nextion_update_url: "https://github.com/Blackymas/NSPanel_HA_Blueprint/dummy"
packages:
basic_package: !include ../nspanel_esphome.yaml # Basic package
...

View File

@@ -0,0 +1,11 @@
---
substitutions:
device_name: nspanel
wifi_ssid: "nspanel"
wifi_password: "NSPanel_HA_Blueprint"
nextion_update_url: "https://github.com/Blackymas/NSPanel_HA_Blueprint/dummy"
packages:
basic_package: !include ../nspanel_esphome.yaml # Core package
addon_bluetooth_proxy: !include ../esphome/nspanel_esphome_addon_bluetooth_proxy.yaml
...

View File

@@ -7,8 +7,5 @@ substitutions:
packages:
basic_package: !include ../nspanel_esphome.yaml # Core package
# advanced_package: !include ../esphome/nspanel_esphome_advanced.yaml
# addon_climate_heat: !include ../esphome/nspanel_esphome_addon_climate_heat.yaml
addon_climate_cool: !include ../esphome/nspanel_esphome_addon_climate_cool.yaml
# addon_climate_dual: !include ../esphome/nspanel_esphome_addon_climate_dual.yaml
...

View File

@@ -0,0 +1,11 @@
---
substitutions:
device_name: nspanel
wifi_ssid: "nspanel"
wifi_password: "NSPanel_HA_Blueprint"
nextion_update_url: "https://github.com/Blackymas/NSPanel_HA_Blueprint/dummy"
packages:
basic_package: !include ../nspanel_esphome.yaml # Core package
addon_climate_dual: !include ../esphome/nspanel_esphome_addon_climate_dual.yaml
...

View File

@@ -0,0 +1,11 @@
---
substitutions:
device_name: nspanel
wifi_ssid: "nspanel"
wifi_password: "NSPanel_HA_Blueprint"
nextion_update_url: "https://github.com/Blackymas/NSPanel_HA_Blueprint/dummy"
packages:
basic_package: !include ../nspanel_esphome.yaml # Core package
addon_climate_heat: !include ../esphome/nspanel_esphome_addon_climate_heat.yaml
...

View File

@@ -0,0 +1,11 @@
---
substitutions:
device_name: nspanel
wifi_ssid: "nspanel"
wifi_password: "NSPanel_HA_Blueprint"
nextion_update_url: "https://github.com/Blackymas/NSPanel_HA_Blueprint/dummy"
packages:
basic_package: !include ../nspanel_esphome.yaml # Core package
advanced_package: !include ../esphome/nspanel_esphome_advanced.yaml
...

View File

@@ -0,0 +1,10 @@
---
substitutions:
device_name: nspanel
wifi_ssid: "nspanel"
wifi_password: "NSPanel_HA_Blueprint"
nextion_update_url: "https://github.com/Blackymas/NSPanel_HA_Blueprint/dummy"
packages:
basic_package: !include ../nspanel_esphome.yaml # Basic package
...

View File

@@ -0,0 +1,11 @@
---
substitutions:
device_name: nspanel
wifi_ssid: "nspanel"
wifi_password: "NSPanel_HA_Blueprint"
nextion_update_url: "https://github.com/Blackymas/NSPanel_HA_Blueprint/dummy"
packages:
basic_package: !include ../nspanel_esphome.yaml # Core package
addon_bluetooth_proxy: !include ../esphome/nspanel_esphome_addon_bluetooth_proxy.yaml
...

View File

@@ -0,0 +1,11 @@
---
substitutions:
device_name: nspanel
wifi_ssid: "nspanel"
wifi_password: "NSPanel_HA_Blueprint"
nextion_update_url: "https://github.com/Blackymas/NSPanel_HA_Blueprint/dummy"
packages:
basic_package: !include ../nspanel_esphome.yaml # Core package
addon_climate_cool: !include ../esphome/nspanel_esphome_addon_climate_cool.yaml
...

View File

@@ -0,0 +1,12 @@
---
substitutions:
device_name: nspanel
wifi_ssid: "nspanel"
wifi_password: "NSPanel_HA_Blueprint"
nextion_update_url: "https://github.com/Blackymas/NSPanel_HA_Blueprint/dummy"
packages:
basic_package: !include ../nspanel_esphome.yaml # Core package
addon_climate_cool: !include ../esphome/nspanel_esphome_addon_climate_cool.yaml
addon_bluetooth_proxy: !include ../esphome/nspanel_esphome_addon_bluetooth_proxy.yaml
...

View File

@@ -0,0 +1,11 @@
---
substitutions:
device_name: nspanel
wifi_ssid: "nspanel"
wifi_password: "NSPanel_HA_Blueprint"
nextion_update_url: "https://github.com/Blackymas/NSPanel_HA_Blueprint/dummy"
packages:
basic_package: !include ../nspanel_esphome.yaml # Core package
addon_climate_dual: !include ../esphome/nspanel_esphome_addon_climate_dual.yaml
...

View File

@@ -0,0 +1,11 @@
---
substitutions:
device_name: nspanel
wifi_ssid: "nspanel"
wifi_password: "NSPanel_HA_Blueprint"
nextion_update_url: "https://github.com/Blackymas/NSPanel_HA_Blueprint/dummy"
packages:
basic_package: !include ../nspanel_esphome.yaml # Core package
addon_climate_heat: !include ../esphome/nspanel_esphome_addon_climate_heat.yaml
...