Skip to content

Commit

Permalink
Merge pull request #2358 from Blackymas/v4.4.0.dev5
Browse files Browse the repository at this point in the history
V4.4.0.dev5
  • Loading branch information
edwardtfn authored Nov 2, 2024
2 parents 4be7ed2 + c02d4da commit 8602e21
Show file tree
Hide file tree
Showing 249 changed files with 705 additions and 1,698 deletions.
38 changes: 24 additions & 14 deletions .github/workflows/validate_esphome.yml
Original file line number Diff line number Diff line change
Expand Up @@ -355,20 +355,30 @@ jobs:
name: Prebuilt Firmware
runs-on: ubuntu-latest
needs: code_scan
if: github.ref == 'refs/heads/dev' || github.base_ref == 'dev'
if: contains(github.ref, 'dev') || contains(github.base_ref, 'dev')
steps:
- uses: actions/checkout@main

- name: Read NSPanel ESPHome version
uses: CumulusDS/get-yaml-paths-action@master
id: read_nspanel_esphome_core_version
with:
file: esphome/nspanel_esphome_core_version.yaml
version: substitutions.version

- name: Display NSPanel ESPHome version
- name: Extract Version Number
id: extract_version
run: |
VERSION=$(yq eval '.substitutions.version' esphome/nspanel_esphome_core_versioning.yaml)
if [ -z "$VERSION" ]; then
echo "Error: No version found in esphome/nspanel_esphome_core_versioning.yaml"
exit 1
fi
echo "Extracted Version: ${VERSION}"
echo "version=${VERSION}" >> $GITHUB_OUTPUT
echo "VERSION=${VERSION}" >> $GITHUB_ENV

Check failure on line 373 in .github/workflows/validate_esphome.yml

View workflow job for this annotation

GitHub Actions / Validate YAML

373:1 [trailing-spaces] trailing spaces
- name: Debug Version Output
run: |
echo NSPanel ESPHome version: ${{ steps.read_nspanel_esphome_core_version.outputs.version }}
echo "Version from setup_dependencies: ${{ steps.extract_version.outputs.version }}"
echo "Environment Variable VERSION: $VERSION"
if [ -z "${{ steps.extract_version.outputs.version }}" ]; then
echo "Error: Version output is empty. Exiting..."
exit 1
fi
- name: Build ESPHome Prebuilt Firmware
id: build_nspanel_fw
Expand All @@ -388,7 +398,7 @@ jobs:
with:
file: ${{ steps.build_nspanel_fw.outputs.name }}/manifest.json
field: version
value: ${{ steps.read_nspanel_esphome_core_version.outputs.version }}
value: ${{ steps.extract_version.outputs.version }}

- name: Update manifest.json - builds.chipFamily
uses: jossef/action-set-json-field@v2.2
Expand All @@ -409,7 +419,7 @@ jobs:
with:
file: ${{ steps.build_nspanel_fw.outputs.name }}/manifest.json
field: builds.ota.release_url
value: "https://github.com/Blackymas/NSPanel_HA_Blueprint/releases/tag/v${{ steps.read_nspanel_esphome_core_version.outputs.version }}"
value: "https://github.com/Blackymas/NSPanel_HA_Blueprint/releases/tag/v${{ steps.extract_version.outputs.version }}"

- name: Move and Rename Firmware File - nspanel_esphome_prebuilt
run: |
Expand Down Expand Up @@ -437,7 +447,7 @@ jobs:
with:
file: ${{ steps.build_wall_display_fw.outputs.name }}/manifest.json
field: version
value: ${{ steps.read_nspanel_esphome_core_version.outputs.version }}
value: ${{ steps.extract_version.outputs.version }}

- name: Update manifest.json - builds.chipFamily
uses: jossef/action-set-json-field@v2.2
Expand All @@ -458,7 +468,7 @@ jobs:
with:
file: ${{ steps.build_wall_display_fw.outputs.name }}/manifest.json
field: builds.ota.release_url
value: "https://github.com/Blackymas/NSPanel_HA_Blueprint/releases/tag/v${{ steps.read_nspanel_esphome_core_version.outputs.version }}"
value: "https://github.com/Blackymas/NSPanel_HA_Blueprint/releases/tag/v${{ steps.extract_version.outputs.version }}"

- name: Move and Rename Firmware File - wall_display
run: |
Expand Down
12 changes: 6 additions & 6 deletions .test/esphome_ard_advanced_climate_heat_customizations.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ binary_sensor:
id: display_state
platform: template
lambda: |-
return (current_page->state != "screensaver");
return (id(current_page_id) != ${PAGE_ID_SCREENSAVER});
button:
# Adds a button to put the panel to sleep
Expand All @@ -38,9 +38,9 @@ button:
icon: mdi:sleep
on_press:
then:
- logger.log: Button Sleep pressed
- lambda: |-
goto_page->execute("screensaver", false);
ESP_LOGI("button.force_sleep.on_press", "Button Sleep pressed");
goto_page_id->execute(${PAGE_ID_SCREENSAVER}, false);
# Adds a button to wake-up the panel (similar to the existing service)
- name: ${device_name} Wake-up
Expand All @@ -49,10 +49,10 @@ button:
icon: mdi:alarm
on_press:
then:
- logger.log: Button Wake-up pressed
- lambda: |-
if (current_page->state == "screensaver")
goto_page->execute(id(wakeup_page_name).state.c_str(), true);
ESP_LOGI("button.force_wake_up.on_press", "Button Wake-up pressed");
if (id(current_page_id) == ${PAGE_ID_SCREENSAVER})
goto_page_id->execute(get_page_id(id(wakeup_page_name).state.c_str()), true);
# Add custom presets to your climate (heat in this example)
climate:
Expand Down
5 changes: 3 additions & 2 deletions .test/esphome_idf5_advanced.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ packages:
esp32:
framework:
type: esp-idf
version: 5.1.2
platform_version: 6.5.0
version: 5.1.4
source: https://github.com/pioarduino/esp-idf/releases/download/v5.1.4.240921/esp-idf-v5.1.4.zip
platform_version: https://github.com/pioarduino/platform-espressif32/releases/download/51.03.05/platform-espressif32.zip
...
5 changes: 3 additions & 2 deletions .test/esphome_idf5_basic.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ packages:
esp32:
framework:
type: esp-idf
version: 5.1.2
platform_version: 6.5.0
version: 5.1.4
source: https://github.com/pioarduino/esp-idf/releases/download/v5.1.4.240921/esp-idf-v5.1.4.zip
platform_version: https://github.com/pioarduino/platform-espressif32/releases/download/51.03.05/platform-espressif32.zip
...
5 changes: 3 additions & 2 deletions .test/esphome_idf5_ble_tracker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ packages:
esp32:
framework:
type: esp-idf
version: 5.1.2
platform_version: 6.5.0
version: 5.1.4
source: https://github.com/pioarduino/esp-idf/releases/download/v5.1.4.240921/esp-idf-v5.1.4.zip
platform_version: https://github.com/pioarduino/platform-espressif32/releases/download/51.03.05/platform-espressif32.zip
...
5 changes: 3 additions & 2 deletions .test/esphome_idf5_bluetooth_proxy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ packages:
esp32:
framework:
type: esp-idf
version: 5.1.2
platform_version: 6.5.0
version: 5.1.4
source: https://github.com/pioarduino/esp-idf/releases/download/v5.1.4.240921/esp-idf-v5.1.4.zip
platform_version: https://github.com/pioarduino/platform-espressif32/releases/download/51.03.05/platform-espressif32.zip
...
5 changes: 3 additions & 2 deletions .test/esphome_idf5_climate_cool.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ packages:
esp32:
framework:
type: esp-idf
version: 5.1.2
platform_version: 6.5.0
version: 5.1.4
source: https://github.com/pioarduino/esp-idf/releases/download/v5.1.4.240921/esp-idf-v5.1.4.zip
platform_version: https://github.com/pioarduino/platform-espressif32/releases/download/51.03.05/platform-espressif32.zip
...
5 changes: 3 additions & 2 deletions .test/esphome_idf5_climate_dual.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ packages:
esp32:
framework:
type: esp-idf
version: 5.1.2
platform_version: 6.5.0
version: 5.1.4
source: https://github.com/pioarduino/esp-idf/releases/download/v5.1.4.240921/esp-idf-v5.1.4.zip
platform_version: https://github.com/pioarduino/platform-espressif32/releases/download/51.03.05/platform-espressif32.zip
...
5 changes: 3 additions & 2 deletions .test/esphome_idf5_climate_heat.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ packages:
esp32:
framework:
type: esp-idf
version: 5.1.2
platform_version: 6.5.0
version: 5.1.4
source: https://github.com/pioarduino/esp-idf/releases/download/v5.1.4.240921/esp-idf-v5.1.4.zip
platform_version: https://github.com/pioarduino/platform-espressif32/releases/download/51.03.05/platform-espressif32.zip
...
5 changes: 3 additions & 2 deletions .test/esphome_idf5_cover.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ packages:
esp32:
framework:
type: esp-idf
version: 5.1.2
platform_version: 6.5.0
version: 5.1.4
source: https://github.com/pioarduino/esp-idf/releases/download/v5.1.4.240921/esp-idf-v5.1.4.zip
platform_version: https://github.com/pioarduino/platform-espressif32/releases/download/51.03.05/platform-espressif32.zip
...
12 changes: 6 additions & 6 deletions .test/esphome_idf_advanced_climate_heat_customizations.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ binary_sensor:
id: display_state
platform: template
lambda: |-
return (current_page->state != "screensaver");
return (id(current_page_id) != ${PAGE_ID_SCREENSAVER});
button:
# Adds a button to put the panel to sleep
Expand All @@ -36,9 +36,9 @@ button:
icon: mdi:sleep
on_press:
then:
- logger.log: Button Sleep pressed
- lambda: |-
goto_page->execute("screensaver", false);
ESP_LOGI("button.force_sleep.on_press", "Button Sleep pressed");
goto_page_id->execute(${PAGE_ID_SCREENSAVER}, false);
# Adds a button to wake-up the panel (similar to the existing service)
- name: ${device_name} Wake-up
Expand All @@ -47,10 +47,10 @@ button:
icon: mdi:alarm
on_press:
then:
- logger.log: Button Wake-up pressed
- lambda: |-
if (current_page->state == "screensaver")
goto_page->execute(id(wakeup_page_name).state.c_str(), true);
ESP_LOGI("button.force_wake_up.on_press", "Button Wake-up pressed");
if (id(current_page_id) == ${PAGE_ID_SCREENSAVER})
goto_page_id->execute(get_page_id(id(wakeup_page_name).state.c_str()), true);
# Add custom presets to your climate (heat in this example)
climate:
Expand Down
5 changes: 3 additions & 2 deletions components/nspanel_ha_blueprint/pages.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ namespace nspanel_ha_blueprint {
* These names correspond to various pages of the Nextion TFT file in use,
* such as settings, home, weather information, and more.
*/
constexpr std::array<const char*, 28> page_names = {
constexpr std::array<const char*, 29> page_names = {
"boot",
"home",
"weather01",
Expand Down Expand Up @@ -48,7 +48,8 @@ namespace nspanel_ha_blueprint {
"keyb_num",
"media_player",
"confirm",
"utilities"
"utilities",
"home_smpl"
};

/**
Expand Down
97 changes: 12 additions & 85 deletions docs/customization.md
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ binary_sensor:
id: display_state
platform: template
lambda: |-
return (current_page->state != "screensaver");
return (id(current_page_id) != ${PAGE_ID_SCREENSAVER});
```

You can easily invert the meaning to have a sensor for display sleeping:
Expand All @@ -311,7 +311,7 @@ binary_sensor:
id: display_sleeping
platform: template
lambda: |-
return (current_page->state == "screensaver");
return (id(current_page_id) == ${PAGE_ID_SCREENSAVER});
```

### Deep sleep
Expand Down Expand Up @@ -377,108 +377,35 @@ There are several ways to wake-up or put your panel to sleep, but in this exampl
```yaml
button:
# Adds a button to put the panel to sleep
- name: 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", false);
# Adds a button to wake-up the panel (similar to the existing action)
- name: Wake-up
ESP_LOGI("button.force_sleep.on_press", "Button Sleep pressed");
goto_page_id->execute(${PAGE_ID_SCREENSAVER}, false);
# 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")
goto_page->execute(wakeup_page_name->state.c_str(), true);
ESP_LOGI("button.force_wake_up.on_press", "Button Wake-up pressed");
if (id(current_page_id) == ${PAGE_ID_SCREENSAVER})
goto_page_id->execute(get_page_id(id(wakeup_page_name).state.c_str()), true);
```

### Set display as a light

> [!WARNING]
> This was incorporated to the core yaml and therefore is deprecated as a customization.
> This was incorporated to the core yaml and therefore was removed from customizations docs.
> If you have this added as a customization, please remove it to avoid conflicts.

You can set your display as a light in Home Assistant, so you can control the brightness and turn on/off just like any other light,
and even use this in your automation to control when your panel is on with the same automation you use for your lights:

```yaml
light:
# Add the display as a light in Home Assistant
- 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")
goto_page->execute(wakeup_page_name->state.c_str(), true);
timer_reset_all->execute();
on_turn_off:
then:
- lambda: |-
ESP_LOGD("light.display_light", "Turn-off");
goto_page->execute("screensaver", false);
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(static_cast<float>(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();
}
}
```
### Scheduled actions
Although ESPHome doesn't have a Scheduler component, it is possible to use the timer to schedule actions and this is entirely managed in the device,
so it will work even if Home Assistant and/or the Wi-Fi are unavailable.
Expand Down
Loading

0 comments on commit 8602e21

Please sign in to comment.