diff --git a/ReleaseNotes.md b/ReleaseNotes.md
new file mode 100644
index 0000000..03c613b
--- /dev/null
+++ b/ReleaseNotes.md
@@ -0,0 +1,236 @@
+# v4.0 - Alarm and Media player pages, Climate add-ons and a more robust panel
+
+## Support this project
+
+### As always, we would like to thank everyone who donated to this project and remind you that every donation helps to support this project - so if you haven't made a donation yet, now would be a good time ;)
+
+[](https://www.paypal.com/donate/?hosted_button_id=S974SWQMB8PB2)
+
+
+## General
+
+Big news: v4.0 has finally landed! Hereβs the scoop:
+π¨ We've added an Alarm control panel β safety first, right?
+π΅ The Media Player control is here for all our tunes and binge-watching needs.
+π¬οΈ Dial in your comfort with the new Fan speed and Embedded climate control settings.
+
+Plus, we've beefed up the panel's resilience to those annoying network or server glitches.
+
+Give it a spin and let us know your thoughts. Thanks for being on this journey with us!
+
+
+## Updating
+Since in this update lots of input to the blueprint changed, we highly recommend you review your settings and make sure all fields have the correct selection. We did our best to support your legacy settings and avoid breaking your system, but please double check your settings if you see something not working as expected.
+
+### Files that need to be reloaded:
+1. nspanel_blueprint.yaml - v4.0
+2. nspanel_eu.tft or nspanel_us.tft - v4.0
+3. nspanel_esphome.yaml - v4.0
+
+### Instructions
+ _You can find the update procedures following here:_
+- [(EN) How To - All important thing you should know - Update](https://github.com/Blackymas/NSPanel_HA_Blueprint/wiki/(EN)-HowTo---All-important-thing-you-should-know#2-update-blueprint)
+- [(DE) How To - Alle wichtigen Dinge die man wissen sollte - Update](https://github.com/Blackymas/NSPanel_HA_Blueprint/wiki/(DE)-HowTo---Alle-wichtigen-Dinge-die-man-wissen-sollte#2-update-blueprint)
+
+### Enable "Current page" sensor
+If have used v3.3 or earlier, and then updated to v3.4, there's a chance the entity `sensor.xxxxx_current_page` was disabled. As this entity is used again with v4.0, please go to your panel's page (Settings > Devices and Services > ESPHome) and make sure the sensor "Current page" is enabled.
+
+
+## Breaking changes
+1. New requirements: Home Assistant and ESPHome v2023.5.0 or later.
+1. Existing users will have to select again the language for the panel, otherwise English will be used to display strings.
+1. Removed entity `sensor.xxxxx_settings_entity` and service `esphome.xxxxx_set_settings_entity`.
+1. Removed entity `sensor.xxxxx_nspanel_event` related to sensor "NSPanel Event". So no more of those ugly json-like strings polluting the device's page.
The sensor "Current page" is back with the information about the page currently visible in your panel, so please update your automation if you are using the event sensor.
**Attention!! If you have disabled the entity `sensor.xxxxx_current_page` in a previous version you will be required to manually enable it back after the update.**
+1. Due to the changes on the time display engine, you might have to select your time format again in the blueprint settings.
+1. The network settings was moved to under `networks` on the `wifi` section. If you are using advanced/custom settings for Wi-Fi on ESPHome, you may have to update it in order to follow the new format.
+1. The sensor "Uptime" is deprecated. It was replaced by "API timestamp" and "Device timestamp" sensors, which makes it more readable to humans on Home Assistant interface and shows respectively the last time the API got connected (between the panel and Home Assistant) and the last time the device started. Thanks to @WZYProjects (#986 and #998) for the new sensors.
+1. Service `esphome.xxxxx_qr_code` is deprecated. It was replaced by service `qrcode` which can be used for changing the QRcode value even when the QRcode page is not visible (useful when using dynamic Wi-Fi credentials).
+1. Removed switches "Relay 1 Local Fallback" and "Relay 2 Local Fallback". Now when you assign your panel's relay to it's respective button the control will be fully local and therefore will have the same behavior as the "fallback" in previous versions, and you can still force a fallback in the blueprint settings when you want to have it working locally (to the respective relays) even when the buttons are assigned to other entities.
+1. The "Hardware button long press hold delay" input was removed and the delay (800ms) is now hard coded in ESPHome.
+1. The service `esphome.xxxxx_wake_up_display` was deprecated. Please use `esphome.xxxxx_wake_up` instead.
+1. The services `esphome.xxxxx_send_command_font_color` and `esphome.xxxxx_send_command_background_color` where deprecated. Please use `esphome.xxxxx_set_component_color` instead, and you can use RGB arrays for `foreground` and `background` colors, a 1-element array with the Nextion color code or an empty array if you don't want to change that specific parameter.
+1. Old color selection (based in a text input where you typed a number) is being deprecated gradually.
The icons colors selected before the implementation of the color picker (when it was about typing a number) might fail now, so if you haven't done this yet, please select the color using the new color selector. Open the Blueprint and if the colors are shown properly, you are good, otherwise, please select a color.
+1. The panel selection based on a text box (where you manually typed the panel name).
The new device selection was introduce a few releases ago and is more reliable. The previous selections are still valid, but requires extra processing every time the automation is triggered, so it will be removed.
If you can see your device name on the blueprint settings screen, you are good, otherwise, pick your panel from the new drop down list.
+1. The entity `switch.xxxxx_confirmation_message` was removed and now the confirmation is processed directly on the Nextion display.
+1. With the new flows for dimming and sleeping, you might have to adjust the page timeout as this have a slightly different name now.
+
+
+## Overview of all changes
+1. Add-ons support
+ - Embedded thermostat (cooler or heater) (#917)
+3. Alarm control panel
+4. Support to sensor display precision from Home Assistant (#880)
+5. Filtered device list (#881)
+6. New language selector (#882)
+7. Removed json sensors (#887)
+8. Support for US model on landscape mode (#890)
+9. API status indication on the panel ([#5ff5d35](https://github.com/Blackymas/NSPanel_HA_Blueprint/commit/5ff5d35833be1a1cf9ca0f570662456058980024))
+10. Light & cover settings pages will show only the supported features (#896)
+11. New "Fan speed page" (#897)
+12. Select wake-up page (#898)
+13. Panel's local control
+14. New "Confirm" pop-up
+15. Page "Settings" now supports translations
+16. Media Player control
+17. Custom buttons on Home page
+18. New controls for dimming and sleeping time
+
+
+## Details of all changes
+
+### 1. Support to add-ons
+We are trying to make your panel more useful and more robust by changing some of the functionalities to run internally in the panel, even when the Wi-Fi network or Home Assistant are not available, however, every new functionality takes a bit from the ESP embedded in your panel and increases the complexity, and having a code capable to adapt to all the different user cases will be very complex and certainly will exceed the available memory.
+
+The first add-on available is an **[embedded thermostat](/docs/en/addon_climate.md)**, able to control it locally even when your Wi-Fi is out or Home Assistant is unavailable.
+
+Please refer to the [documentation](/docs/en/addon_climate.md) to get more details on how to enable this add-on.
+
+
+### 2. Alarm control panel
+Now you can control an Alarm Control Panel from your NSPanel, which will allow you to set the alarm mode between the standard modes supported by Home Assistant (Home, Away, Night, Vacation or Custom bypass) or disarm the alarm.
+On this first release, only the basic functionality will be available, so please share your ideas for future improvements.
+
+
+
+For more details, instructions and security considerations, please take a look at the [Alarm Control Panel docs](/docs/en/alarm.md). You may also want to join [this discussion](https://github.com/Blackymas/NSPanel_HA_Blueprint/discussions/984) about the alarm implementation and some ideas for the future releases.
+
+**Important:** At this moment, this functionality is available only for alarms without a code or alarms using a numeric code. Alarms with text code are not yet supported.
+
+
+### 3. Support to sensor display precision from Home Assistant
+Now the values shown in your panel will follow the [sensor display precision](https://www.home-assistant.io/blog/2023/03/01/release-20233/#sensor-display-precision) provided by Home Assistant.
+
+- If you have problems with a value exceeding the available space in your panel, please reduce the number of decimals using Home Assistant [sensor display precision](https://www.home-assistant.io/blog/2023/03/01/release-20233/#sensor-display-precision).
+
+
+### 4. Filtered device list
+When selecting the NSPanel on the automation, only ESP32 devices will be shown, making easier to find your panel.
+
+
+
+
+### 5. New language selector
+Starts using the new language selector release with HA 2023.5.0 and based on RFC 5646, which will increase reliability and standardization of the code.
+
+Althougt this is not visible for users at the first view, it will enable the use of more granular language selections (like pt-BR vs pt-PT or en-US vs en-UK) if needed in the future.
+
+- If you are an existing users, please remember to select your language again after the update, as the previous selection will be invalid.
+
+
+### 6. Removed json sensors
+The entities `sensor.xxxxx_settings_entity` and `sensor.xxxxx_nspanel_event`, previously used by ESPHome to to transfer information to the Blueprint, like the selected page, buttons pressed, the selected entity on the settings page, etc., together with the service `esphome.xxxxx_set_settings_entity`. This mechanism was a bit fragile and not very user friendly.
+
+With this version all that information will be transfered via calls to event `esphome.nspanel_ha_blueprint` and the service `esphome.xxxxx_open_entity_settings_page`.
+
+Apart of a cleaner device page, this change should be transparent for most users. If you have made automation based on the removed elements, please update it using the new service and `sensor.xxxxx_current_page`.
+
+
+### 7. Support for US model on landscape mode
+If you are using a panel model US in landscape mode, you can now use `nspanel_us_land.tft` where the bars related to the hardware buttons will be located at the right, closer to the respective buttons and fixing the offset on the touch screen when using `nspanel_eu.tft` into a US panel.
+
+- The hardware buttons labels are hidden in this format, as Nextion cannot support rotated text.
+
+
+### 8. API status indication on the panel
+Now the Wi-Fi icon in the panel (at the right side of the time) will show one of 3 possible states:
+
+ The panel is connected to the Wi-Fi and the API is connected to Home Assistant (mdi:wifi)
+
+ The panel is connected to the Wi-Fi, but the API is not connected to Home Assistant (mdi:api-off)
+
+ The panel is **NOT** connected to the Wi-Fi (mdi:wifi-off)
+
+
+### 9. Light & cover settings pages will show only the supported features
+Now when long press a button connected to a light or a cover, the detailed light settings page will open only when the entity supports advanced control, and the detailed page will only show the controls supported by that entity.
+
+
+### 10. New "Fan speed page"
+If you have a connected fan supporting speed control, now you are able to control it's speed from your panel. Just add the new fan to one of the buttons pages or to the hardware buttons and a long press on those buttons will pop up the new "Fan speed page":
+
+
+
+
+### 11. Select wake-up page
+Now you can select the wake-up page on the device settings:
+
+
+
+This selected page will be shown after a boot (after the boot page) and with a touch in the screen when on screen saver page. After showing this wake-up page, all the previous behavior for closing the page (with a click or after a timeout) will be the same and will fall back to the "Home" page.
+
+
+### 12. Panel's local control
+We are trying to make your panel as autonomous as possible by moving some of the controls from the Blueprint to ESPHome. This will reduce the load in your network and Home Assistant, but also will make a more reliable system capable to do it's core functionality even when the network is unavailable or Home Assistant is restarting.
+
+With this version, the following engines have been moved to your panel (local control):
+- Time display
+- Physical relay control (when hardware left button is connected to relay 1 or right button to relay 2) - Replacing the fallback mode from previous versions.
+- Embedded thermostat (see item 1 about add-ons)
+
+
+### 13. New "Confirm" pop-up
+A new pop-up will replace the previous confirmation page, making clear the difference from notifications.
+
+
+
+
+### 14. Page "Settings" now supports translations
+Now you will see the Settings page in the same language selected to your panel:
+ 
+ 
+
+- Not all the languages are supported at this moment. If you want to contribute with the translations for your language(s), please visit #1002.
+
+
+### 15. Media Player control
+You can now tap into basic controls for all your connected media devices right from your panel.
+
+Just add a media player entity to any of the buttons pages. A long press in the button will open the media player control page:
+
+
+
+
+- Just like all other pages, this one relies on information from Home Assistant, and the Media Player entities are a bit slower than other entities to update it's states. We included an engine to pull for a new update in a loop, but as a result of that, the commands can be a bit laggy.
+- Some media player providers aren't capable to send updated information about the progress of the media playing. We create an engine to try to estimate this progress and keep the progress bar updated in the screen, however it is possible that the information gets unsync specially when a track starts while the Media Player is not visible. In this case, it should adjust (again to an estimated value) when the next track starts.
+
+
+### 16. Custom buttons on Home page
+Now you can add up to 3 customize buttons to the Home page. You can select a climate, cover, fan, light or media player and an icon of your preference, which will be shown in the Home page right above the already known icons for QRcode and entities pages.
+
+By clicking in the icon, the detailed page will be opened with the selected entity. With that, all those icons will have a similar behavior of jumping to another page.
+
+
+
+- To keep consistency with other buttons on this page, entities supporting advanced settings will open the settings page with the click. All other entities will toggle or execute, with no visual feedback,
+
+
+### 17. New controls for dimming and sleeping time
+We have changed the way your panel handles the dimming and sleeping.
+#### Sleep flow on v3.4:
+
+
+Apart of some hard-coded times for dimming and sleeping, this flow was inconvenient when the time-out was set to 0, as the panel never go to dimming when left in a page other than Home.
+
+Now you will have full control of the 3 actions and you will be able to play with those parameters as you want or just disabling any of the flows by setting the timeout to 0.
+
+#### New flows on v4.0:
+
+
+
+## Next topics we are currently working on
+See here: https://github.com/Blackymas/NSPanel_HA_Blueprint/labels/roadmap
+
+## Special thanks to:
+* @chpego
+ - Fixes on the blueprint UI (#928)
+* @WZYProjects
+ - Human readable "Last started" sensor (#986)
+ - Support with customization (#1003)
+ - Translation to Spanish (#1023)
+* @Doughboy68
+ - Tons of tests and feedback during the `dev` phase.
+
+## New Contributors
+* @chpego
+* @WZYProjects
+* @Doughboy68
\ No newline at end of file
diff --git a/nspanel_blueprint.yaml b/nspanel_blueprint.yaml
index 34bbd07..8eee7f1 100644
--- a/nspanel_blueprint.yaml
+++ b/nspanel_blueprint.yaml
@@ -510,17 +510,27 @@ blueprint:
description: >
*HOME page*
- *Entity which should be displayed (ONLY climate | cover | fan | light | media_player)*
+ *Entity which should be switched (ONLY light | switch | cover | input_boolean | automation | button | input_button | scene | script | fan | climate | media_player)*
+
+ *Entities with supported advanced settings will open it's settings page, all other entities will execute the action or toggle when clicked.*
default: []
selector: &home-custom-button-entity-selector
entity:
filter:
domain:
+ - automation
+ - button
- climate
- cover
- fan
+ - input_boolean
+ - input_button
- light
- media_player
+ - scene
+ - script
+ - switch
+
home_custom_button01_icon:
name: Custom button 01 - ICON (Optional)
description: >
@@ -535,7 +545,9 @@ blueprint:
description: >
*HOME page*
- *Entity which should be displayed (ONLY climate | cover | fan | light | media_player)*
+ *Entity which should be switched (ONLY light | switch | cover | input_boolean | automation | button | input_button | scene | script | fan | climate | media_player)*
+
+ *Entities with supported advanced settings will open it's settings page, all other entities will execute the action or toggle when clicked.*
default: []
selector: *home-custom-button-entity-selector
home_custom_button02_icon:
@@ -552,7 +564,9 @@ blueprint:
description: >
*HOME page*
- *Entity which should be displayed (ONLY climate | cover | fan | light | media_player)*
+ *Entity which should be switched (ONLY light | switch | cover | input_boolean | automation | button | input_button | scene | script | fan | climate | media_player)*
+
+ *Entities with supported advanced settings will open it's settings page, all other entities will execute the action or toggle when clicked.*
default: []
selector: *home-custom-button-entity-selector
home_custom_button03_icon:
@@ -883,6 +897,17 @@ blueprint:
default: ' '
selector: *placeholder-selector
##### PLACEHOLDER ######################################################################
+ relay_1_local_fallback:
+ name: Activate relay 1 local fallback - TRUE/FALSE (Optional)
+ default: false
+ description: >
+ *SYSTEM settings*
+
+ *activate this to use left button to toggle relay 1 if display is offline*
+
+ *When button left is using the entity related to relay 1 the processing will always be local, even if fallback is disabled.*
+ selector:
+ boolean:
left_button_entity:
name: Left hardware button - ENTITY (Optional)
description: >
@@ -945,6 +970,17 @@ blueprint:
*LABEL color which should be displayed*
default: [200, 204, 200] #52857 Grey super light
selector: *color-selector
+ relay_2_local_fallback:
+ name: Activate relay 2 local fallback - TRUE/FALSE (Optional)
+ default: false
+ description: >
+ *SYSTEM settings*
+
+ *activate this to use right button to toggle relay 2 if display is offline*
+
+ *When button right is using the entity related to relay 2 the processing will always be local, even if fallback is disabled.*
+ selector:
+ boolean:
right_button_entity:
name: Right hardware button - ENTITY (Optional)
description: >
@@ -3453,6 +3489,15 @@ blueprint:
default: [255, 255, 255] #65535 White
selector: *color-selector
+ ##### Advanced settings #####
+ ##### PLACEHOLDER ######################################################################
+ placeholder19:
+ name: ' '
+ description: '# β
ADVANCED SETTINGS β
'
+ default: ' '
+ selector: *placeholder-selector
+ ##### PLACEHOLDER ######################################################################
+
###### Special settings ###############################################################################################################################################################################
tft_path:
name: Nextion TFT File Folder (Optional)
@@ -3481,6 +3526,24 @@ blueprint:
default: false
selector:
boolean:
+ media_player_update_interval:
+ name: Media player - Update interval
+ description: Interval (msec) to call for an update from the media player entity. Lower values will improve the responsiveness, but could spam your Home Assistant with constant requests, while higher values will reduce the load on HA but the Media Player page can be laggy.
+ default: 5000
+ selector:
+ number:
+ min: 500
+ max: 60000
+ unit_of_measurement: milliseconds
+ media_player_update_delay:
+ name: Media player - Delay (msec) after entity updade call?
+ default: 500
+ selector:
+ number:
+ min: 0
+ max: 5000
+ unit_of_measurement: milliseconds
+
# yamllint enable rule:line-length
#############################################################
##### CLOSE - INPUT #####
@@ -3554,8 +3617,10 @@ variables:
cyan: [1530] #'1530' # rgb(0, 188, 212)
deep-orange: [64164] #'64164' # rgb(255, 87, 34)
amber: [65024] #'65024' # rgb(255, 193, 7)
+ "on": [65535] #'65535' # rgb(255, 255, 255)
"off": [35921] #'35921' #8a8a8a
disabled: [48631] #'48631' # rgb(189, 189, 189)
+ unknown: [6339] #'6339'
unavailable: [6339] #'6339'
command:
alarm_settings: 'esphome.{{ nspanel_name }}_alarm_settings'
@@ -5707,6 +5772,10 @@ variables:
###### SYNC SETTINGS #####
delay_value: !input 'delay'
+ ###### MEDIA PLAYER REFRESH #####
+ media_player_update_interval: !input 'media_player_update_interval'
+ media_player_update_delay: !input 'media_player_update_delay'
+
##### GENERAL ENTITYS #####
climate: !input 'climate'
embedded_climate: '{{ climate == thermostat_embedded }}'
@@ -5726,6 +5795,10 @@ variables:
rgbw: "[]"
rgbww: "[]"
white: "[]"
+ states:
+ "on": ["on", "open", "opening", "true", "True", true, True, "playing", "heat", "cold", "dry", "armed_home", "armed_away", "armed_vacation", "armed_custom_bypass"]
+ "off": ["off", "closed", "closing", "false", "False", false, False, "standby", "paused", "idle", "disarmed"]
+ unknown: ["unknown", "unavailable", None, none, ""]
#############################################################
##### CLOSE - Variables #####
@@ -6160,6 +6233,27 @@ trigger:
- unavailable
id: home_value03_state
+ ##### Trigger - Home - Custom buttons - State change #################################################################################################################
+ ##### Custom button 01 - Trigger 'home_custom_buttons' #####
+ - platform: event
+ event_type: state_changed
+ event_data:
+ entity_id: !input 'home_custom_button01'
+ id: home_custom_buttons
+ ##### Custom button 02 - Trigger 'home_custom_buttons' #####
+ - platform: event
+ event_type: state_changed
+ event_data:
+ entity_id: !input 'home_custom_button02'
+ id: home_custom_buttons
+ ##### Custom button 03 - Trigger 'home_custom_buttons' #####
+ - platform: event
+ event_type: state_changed
+ event_data:
+ entity_id: !input 'home_custom_button03'
+ id: home_custom_buttons
+
+
##### Trigger - Relays - State change #################################################################################################################
##### Relay01 - Trigger 'relay01_state' #####
@@ -6401,20 +6495,20 @@ action:
name: !input 'left_button_name'
color_rgb: !input 'left_button_color'
hold_select: !input 'left_button_hold_select'
- #custom_action: !input 'left_button_hold_custom_action'
right:
entity: !input 'right_button_entity'
name: !input 'right_button_name'
color_rgb: !input 'right_button_color'
hold_select: !input 'right_button_hold_select'
- #custom_action: !input 'right_button_hold_custom_action'
relays:
relay1:
icon: !input 'relay01_icon' #E3A5
icon_color_rgb: !input 'relay01_icon_color'
+ fallback: !input 'relay_1_local_fallback'
relay2:
icon: !input 'relay02_icon' #E3A8
icon_color_rgb: !input 'relay02_icon_color'
+ fallback: !input 'relay_2_local_fallback'
- &variables-home_buttons
variables:
@@ -6491,7 +6585,7 @@ action:
- service: '{{ nextion.command.page_settings}}'
data:
reboot: '{{ mui[language].settings.reboot }}'
- sleep_mode: '{{ mui[language].settings.sleep }}'
+ #sleep_mode: '{{ mui[language].settings.sleep }}'
brightness: '{{ mui[language].settings.brightness }}'
bright: '{{ mui[language].settings.bright }}'
dim: '{{ mui[language].settings.dim }}'
@@ -6519,6 +6613,7 @@ action:
if is_number(hardware.relays.relay1.icon_color_rgb)
else ((hardware.relays.relay1.icon_color_rgb[0] //(2**3)) *(2**11))+((hardware.relays.relay1.icon_color_rgb[1] //(2**2)) *(2**5))+(hardware.relays.relay1.icon_color_rgb[2] //(2**3))
}}
+ relay1_fallback: '{{ hardware.relays.relay1.fallback }}'
relay2_local_control: '{{ hardware.buttons.right.entity == relay02_entity }}'
relay2_icon: >
{{
@@ -6537,6 +6632,7 @@ action:
if is_number(hardware.relays.relay2.icon_color_rgb)
else ((hardware.relays.relay2.icon_color_rgb[0] //(2**3)) *(2**11))+((hardware.relays.relay2.icon_color_rgb[1] //(2**2)) *(2**5))+(hardware.relays.relay2.icon_color_rgb[2] //(2**3))
}}
+ relay2_fallback: '{{ hardware.relays.relay2.fallback }}'
date_color: >
{{
display.date.color_rgb
@@ -6603,13 +6699,7 @@ action:
entity_id: '{{ nspanel_event.entity }}'
continue_on_error: true
- delay:
- milliseconds: 500
- - service: homeassistant.update_entity
- data:
- entity_id: '{{ nspanel_event.entity }}'
- continue_on_error: true
- - delay:
- milliseconds: 1500
+ milliseconds: '{{ media_player_update_delay }}'
- service: homeassistant.update_entity
data:
entity_id: '{{ nspanel_event.entity }}'
@@ -6625,13 +6715,6 @@ action:
- alias: Home page
conditions: '{{ nspanel_event.page == page.home }}'
sequence: &refresh_page_home
- ##### Set entity variable #####
- - &set_entity_variable
- service: '{{ nextion.command.text_printf }}'
- data:
- component: home.climate_entity
- message: '{{ "embedded_climate" if climate == thermostat_embedded else climate }}'
- continue_on_error: true
##### Weather Icon Home Page #####
- *delay-default
@@ -6817,10 +6900,10 @@ action:
continue_on_error: true
###### Custom buttons ######
- - &update-home_page-custom_buttons
+ - &update_home_page_custom_buttons
if: '{{ true }}'
then:
- - &variables-home_page-custom_buttons
+ - &variables_home_page_custom_buttons
variables:
home_page_custom_buttons:
- entity: !input home_custom_button01
@@ -6834,12 +6917,46 @@ action:
component: button03
- repeat:
for_each: '{{ home_page_custom_buttons }}'
- sequence: &display-home_page-custom_buttons
- - if: '{{ repeat.item.entity is defined and repeat.item.entity is string and repeat.item.entity | length > 0 }}'
+ sequence:
+ - &display_home_page_custom_buttons
+ if: '{{ repeat.item.entity is defined and repeat.item.entity is string and repeat.item.entity | length > 0 }}'
then:
+ - variables:
+ entity_domain: '{{ repeat.item.entity.split(".")[0] if repeat.item.entity and repeat.item.entity.split(".") | count > 1 else "unknown" }}'
+ entity_state: '{{ states(repeat.item.entity) }}'
+ rgb_color: '{{ state_attr(repeat.item.entity, "rgb_color") | default(None) }}'
+ brightness: '{{ (state_attr(repeat.item.entity, "brightness") | int(255))/255 }}'
+ icon_color: >
+ {{
+ rgb_color | list
+ if rgb_color is sequence
+ else
+ (
+ nextion.color.on
+ if entity_state in enum.states.on
+ else nextion.color.off
+ )
+ }}
+ icon_color_adjusted: >
+ {{
+ [
+ min(255,icon_color[0] * brightness) | round(0),
+ min(255,icon_color[1] * brightness) | round(0),
+ min(255,icon_color[2] * brightness) | round(0)
+ ]
+ if icon_color is sequence and icon_color | count == 3
+ else icon_color
+ }}
+ - service: '{{ nextion.command.set_component_color }}'
+ data:
+ component: 'home.{{ repeat.item.component }}'
+ foreground: '{{ icon_color_adjusted }}'
+ background: []
+ continue_on_error: true
+ - *delay-default
- service: '{{ nextion.command.text_printf }}'
data:
- component: '{{ repeat.item.component }}'
+ component: 'home.{{ repeat.item.component }}'
message: >
{% if repeat.item.icon | length > 0 %}
{{
@@ -6848,21 +6965,24 @@ action:
else repeat.item.icon
}}
{% elif repeat.item.entity and repeat.item.entity.split(".") | count > 1 %}
- {{ nextion.icon.domain[repeat.item.entity.split(".")[0] if repeat.item.entity else "unknown"] }}
+ {{ nextion.icon.domain[entity_domain] }}
{% else %}{{ nextion.icon.domain.unknown }}
{% endif %}
continue_on_error: true
- - *delay-default
- - service: '{{ nextion.command.show }}'
- data:
- component: '{{ repeat.item.component }}'
- continue_on_error: true
+ - if: '{{ page.current == page.home }}'
+ then:
+ - *delay-default
+ - service: '{{ nextion.command.show }}'
+ data:
+ component: '{{ repeat.item.component }}'
+ continue_on_error: true
else:
- - service: '{{ nextion.command.hide }}'
- data:
- component: '{{ repeat.item.component }}'
- continue_on_error: true
- - *delay-default
+ - if: '{{ page.current == page.home }}'
+ then:
+ - service: '{{ nextion.command.hide }}'
+ data:
+ component: '{{ repeat.item.component }}'
+ continue_on_error: true
###### Climate chip ######
- &update-home_page-climate_chip
@@ -7324,6 +7444,22 @@ action:
confirm: !input 'entity32_confirm'
page: buttonpage04
component: button08
+ confirm_list: >
+ {{
+ button_pages_buttons[first_button:last_button]
+ | sort(attribute="component")
+ | map(attribute="confirm")
+ | list
+ }}
+ confirm_value: >
+ {% set ns = namespace(decimal_value = 0, index = 0) %}
+ {% for confirm_item in confirm_list %}
+ {% if (confirm_item) %}
+ {% set ns.decimal_value = ns.decimal_value + (2 ** ns.index) %}
+ {% endif %}
+ {% set ns.index = ns.index + 1 %}
+ {% endfor %}
+ {{ ns.decimal_value }}
- if: '{{ button_page_index >= 0 and button_page_index <= 3 }}'
then:
##### Button Page Label #####
@@ -7335,6 +7471,13 @@ action:
message: '{{ button_pages_labels[button_page_index].label }}'
continue_on_error: true
+ ###### Confirm buttons ######
+ - *delay-default
+ - service: '{{ nextion.command.value }}'
+ data:
+ component: confirm
+ message: '{{ confirm_value }}'
+ continue_on_error: true
###### Display page while other elements are still loading #####
- variables:
show_while_loading: !input 'show_while_loading'
@@ -7355,10 +7498,6 @@ action:
repeat.item.entity.split(".") | default([]) | count > 0
}}
then:
- #- service: homeassistant.update_entity
- # data:
- # entity_id: '{{ repeat.item.entity }}'
- # continue_on_error: true
- variables:
item_domain: '{{ repeat.item.entity.split(".")[0] | default("unknown") }}'
current_entity_state: '{{ states(repeat.item.entity) | default("unavailable") }}'
@@ -7425,7 +7564,23 @@ action:
{% else %}{{ nextion.icon.domain.unknown }}
{% endif %}
# LABEL Value
- btn_label: '{{ repeat.item.name }}'
+ btn_label_tmp: >
+ {{
+ repeat.item.name
+ if repeat.item.name is string and repeat.item.name | length > 0
+ else state_attr(repeat.item.entity, "friendly_name")
+ }}
+ btn_label: >
+ {{
+ btn_label_tmp
+ if btn_label_tmp is string and btn_label_tmp | length > 0
+ else
+ (
+ item_domain
+ if item_domain is string and item_domain | length > 0
+ else ""
+ )
+ }}
# BRIGHTNESS Value
btn_bri_txt: >-
{% if not current_entity_state_available %} 0
@@ -7451,7 +7606,7 @@ action:
btn_icon: '{{ btn_icon }}'
btn_label: '{{ btn_label }}'
btn_bri_txt: '{{ btn_bri_txt }}'
- btn_confirm: '{{ repeat.item.confirm }}'
+ #btn_confirm: '{{ repeat.item.confirm }}'
#entity: '{{ repeat.item.entity }}'
continue_on_error: true
- if: '{{ item_domain in ["button","input_button","scene"] and trigger.id is match "current_state_entity" }}'
@@ -7742,13 +7897,12 @@ action:
- alias: Refresh page in a loop
repeat:
sequence:
- - &update_entity
- service: homeassistant.update_entity
+ - service: homeassistant.update_entity
data:
entity_id: '{{ nspanel_event.entity }}'
continue_on_error: true
- delay:
- milliseconds: 500
+ milliseconds: '{{ media_player_update_delay }}'
- variables:
media_player:
state: '{{ states(media_player_entity) }}'
@@ -7759,7 +7913,7 @@ action:
media_artist: '{{ state_attr(media_player_entity, "media_artist") }}'
media_duration: '{{ state_attr(media_player_entity, "media_duration") | int(0) }}'
media_position: '{{ state_attr(media_player_entity, "media_position") | int(0) }}'
- #media_position_updated_at: '{{ state_attr(media_player_entity, "media_position_updated_at") }}'
+ media_position_updated_at: '{{ state_attr(media_player_entity, "media_position_updated_at") | default(now()) }}'
supported_features: '{{ state_attr(media_player_entity, "supported_features") | int(0) }}'
- service: '{{ nextion.command.media_player }}'
data:
@@ -7771,12 +7925,13 @@ action:
media_title: '{{ media_player.media_title if media_player.media_title is string and media_player.media_title not in [null, None, "unknown", "unavailable"] else "" }}'
media_artist: '{{ media_player.media_artist if media_player.media_artist is string and media_player.media_artist not in [null, None, "unknown", "unavailable"] else "" }}'
media_duration: '{{ media_player.media_duration }}'
- media_position: '{{ media_player.media_position }}'
+ media_position: '{{ media_player.media_position }}' #min(media_player.media_duration, media_player.media_position + (now() | as_timestamp - media_player.media_position_updated_at | as_timestamp | default(now() | as_timestamp))) }}'
+ media_position_delta: '{{ (now() | as_timestamp - media_player.media_position_updated_at | as_timestamp | default(now() | as_timestamp)) }}'
supported_features: '{{ media_player.supported_features }}'
continue_on_error: true
- wait_template: '{{ states(currentpage) != page.media_player }}'
timeout:
- seconds: 10
+ milliseconds: '{{ media_player_update_interval }}'
continue_on_timeout: true
- variables:
wait_completed: '{{ wait.completed }}'
@@ -7820,7 +7975,7 @@ action:
- &variables-climate_entity
variables:
climate_entity_temp: '{{ nspanel_event.entity if nspanel_event is defined and nspanel_event.entity is defined else trigger.entity_id }}'
- climate_entity: '{{ thermostat_embedded if climate_entity_temp == "embedded_climate" else climate_entity_temp }}'
+ climate_entity: '{{ climate_entity_temp if climate_entity_temp is string and climate_entity_temp | length > 0 and climate_entity_temp != "embedded_climate" else climate }}'
settings_entity_domain: >
{{
climate_entity.split(".")[0]
@@ -7831,7 +7986,6 @@ action:
else "unknown"
}}
hvac_modes: '{{ state_attr(climate_entity, "hvac_modes") if settings_entity_domain == "climate" }}'
-
- condition: '{{ settings_entity_domain == "climate" }}'
- service: '{{ nextion.command.text_printf }}'
data:
@@ -7917,6 +8071,7 @@ action:
temp_offset: '{{ temp_offset }}'
climate_icon: '{{ climate_icon }}'
embedded_climate: '{{ embedded_climate }}'
+ entity: '{{ climate_entity }}'
continue_on_error: true
##### Climate buttons #####
@@ -8201,7 +8356,7 @@ action:
page: entitypage04
component: value08
- variables:
- entity_page_index: '{{ (page.current[-2:] | int(-1)) - 1 }}'
+ entity_page_index: '{{ (nspanel_event.page[-2:] | int(-1)) - 1 }}'
first_entity: '{{ entity_page_index * 8 }}'
last_entity: '{{ first_entity + 8 }}'
##### Entity page - Label #####
@@ -8651,13 +8806,7 @@ action:
entity_id: '{{ button_context.entity }}'
continue_on_error: true
- delay:
- milliseconds: 500
- - service: homeassistant.update_entity
- data:
- entity_id: '{{ button_context.entity }}'
- continue_on_error: true
- - delay:
- milliseconds: 1500
+ milliseconds: '{{ media_player_update_delay }}'
- service: homeassistant.update_entity
data:
entity_id: '{{ button_context.entity }}'
@@ -8728,13 +8877,7 @@ action:
entity_id: '{{ last_click_button.entity }}'
continue_on_error: true
- delay:
- milliseconds: 500
- - service: homeassistant.update_entity
- data:
- entity_id: '{{ last_click_button.entity }}'
- continue_on_error: true
- - delay:
- milliseconds: 1500
+ milliseconds: '{{ media_player_update_delay }}'
- service: homeassistant.update_entity
data:
entity_id: '{{ last_click_button.entity }}'
@@ -8778,7 +8921,7 @@ action:
conditions:
- '{{ nspanel_event.page == page.home }}'
sequence:
- - *variables-home_page-custom_buttons
+ - *variables_home_page_custom_buttons
- variables:
last_click_button: '{{ home_page_custom_buttons | selectattr("component", "defined") | selectattr("component", "eq", nspanel_event.component) | list }}'
- condition: '{{ last_click_button | count >= 0 }}'
@@ -8794,6 +8937,7 @@ action:
else "unknown"
}}
- if:
+ - '{{ entity_domain in ["climate", "cover", "fan", "light", "media_player"] }}'
- '{{ entity_domain != "cover" or state_attr(last_click_button.entity, "supported_features") | int(0) | bitwise_and(4) > 0 }}'
- '{{ entity_domain != "fan" or state_attr(last_click_button.entity, "supported_features") | int(0) | bitwise_and(1) > 0 }}'
- '{{ entity_domain != "light" or state_attr(last_click_button.entity, "supported_color_modes") | default("unknown") | string not in ["unknown", "onoff", enum.color_mode.unknown, enum.color_mode.onoff, "", none] }}'
@@ -8812,6 +8956,8 @@ action:
entity: '{{ "embedded_climate" if last_click_button.entity == thermostat_embedded else last_click_button.entity }}'
back_page: '{{ page.home }}'
continue_on_error: true
+ else:
+ - *service-button_changed
##### Versions mismatch #####
- alias: Versions
@@ -9156,12 +9302,23 @@ action:
conditions:
- condition: trigger
id: alarm_state
- #- '{{ trigger.event.data.new_state.state not in ["unavailable", "unknown", "", None] }}'
- #- '{{ page.current == page.alarm }}'
sequence: *refresh-page_alarm
########## TRIGGER - HOME PAGE ###########
+ ##### HOME PAGE - Custom buttons #####
+ - alias: Home page - Custom buttons
+ conditions:
+ - condition: trigger
+ id:
+ - home_custom_buttons
+ sequence:
+ - *variables_home_page_custom_buttons
+ - repeat:
+ for_each: '{{ home_page_custom_buttons | selectattr("entity", "defined") | selectattr("entity", "eq", trigger.event.data.entity_id) | list }}'
+ sequence:
+ - *display_home_page_custom_buttons
+
##### HOME PAGE - Values #####
- alias: Home page - Values
conditions:
@@ -9271,20 +9428,6 @@ action:
data: {}
continue_on_error: true
- ##### Wake-up when sleep mode is disabled #####
- - alias: Sleep mode changed
- conditions:
- - condition: trigger
- id: sleep_mode_state
- - "{{ page.current == page.screensaver }}"
- - "{{ trigger.event.data.old_state.state == 'on' }}"
- - "{{ trigger.event.data.new_state.state == 'off' }}"
- sequence:
- service: '{{ nextion.command.wake_up }}'
- data:
- reset_timer: true
- continue_on_error: true
-
#############################################################
##### CLOSE - Action #####
#############################################################
diff --git a/nspanel_esphome.yaml b/nspanel_esphome.yaml
index f577a7d..9c0e896 100644
--- a/nspanel_esphome.yaml
+++ b/nspanel_esphome.yaml
@@ -212,18 +212,16 @@ api:
then:
- lambda: |-
ESP_LOGV("service.notification_show", "Starting");
- ESP_LOGV("service.notification_show", "label: %s", label.c_str());
- ESP_LOGV("service.notification_show", "text: %s", text.c_str());
- ESP_LOGV("service.notification_show", "text length: %i", text.length());
id(disp1).send_command_printf("is_notification=1");
- id(disp1).send_command_printf("page notification");
+ id(disp1).goto_page("notification");
id(disp1).set_component_text_printf("notification.notifi_label", "%s", label.c_str());
id(display_wrapped_text).execute("notification.notifi_text01", text.c_str(), id(display_mode) == 2 ? 23 : 32);
id(notification_label).publish_state(label.c_str());
id(notification_text).publish_state(text.c_str());
+ id(timer_reset_all).execute(id(current_page).state.c_str());
- switch.turn_on: notification_unread
- if:
condition:
@@ -253,13 +251,6 @@ api:
back_page: string
then:
- lambda: |-
- ESP_LOGV("api.service.open_entity_settings_page", "Starting");
- ESP_LOGV("api.service.open_entity_settings_page", "page: %s", page.c_str());
- ESP_LOGV("api.service.open_entity_settings_page", "page_label: %s", page_label.c_str());
- ESP_LOGV("api.service.open_entity_settings_page", "page_icon: %s", page_icon.c_str());
- ESP_LOGV("api.service.open_entity_settings_page", "page_icon_color: %i, %i, %i", page_icon_color[0], page_icon_color[1], page_icon_color[2] );
- ESP_LOGV("api.service.open_entity_settings_page", "entity: %s", entity.c_str());
- ESP_LOGV("api.service.open_entity_settings_page", "back_page: %s", back_page.c_str());
id(entity_id) = entity;
std::string cmd_page = std::string("page ") + page.c_str();
id(disp1).send_command_printf(cmd_page.c_str());
@@ -276,7 +267,6 @@ api:
id(disp1).set_component_text_printf("icon_state", "%s", page_icon.c_str());
id(set_component_color).execute("icon_state", page_icon_color, {});
}
- ESP_LOGV("api.service.open_entity_settings_page", "Finished");
##### Service to play a rtttl tones #####
# Example tones : https://codebender.cc/sketch:109888#RTTTL%20Songs.ino
@@ -297,7 +287,7 @@ api:
- lambda: |-
id(disp1).set_component_text_printf("qrcode.qrcode_label", "%s", title.c_str());
id(disp1).set_component_text_printf("qrcode.qrcode_value", "%s", qrcode.c_str());
- if (show) id(disp1).send_command_printf("page qrcode");
+ if (show) id(disp1).goto_page("qrcode");
#### Service to set climate state ####
- service: set_climate
@@ -309,15 +299,10 @@ api:
temp_offset: int
climate_icon: string
embedded_climate: bool
+ entity: string
then:
- lambda: |-
- ESP_LOGV("api.service.set_climate", "climateslider.maxval=%i", total_steps);
- ESP_LOGV("api.service.set_climate", "temp_offset=%f", temp_offset);
- ESP_LOGV("api.service.set_climate", "temp_step=%f", temp_step);
- ESP_LOGV("api.service.set_climate", "current_temp=%f", current_temp);
- ESP_LOGV("api.service.set_climate", "target_temp=%f", target_temp);
- ESP_LOGV("api.service.set_climate", "target_icon=%s", climate_icon.c_str());
- ESP_LOGV("api.service.set_climate", "embedded=%i", (embedded_climate) ? 1 : 0);
+ if (id(current_page).state == "climate") id(entity_id) = entity;
- script.execute:
id: set_climate
@@ -341,16 +326,11 @@ api:
btn_icon: string
btn_label: string
btn_bri_txt: string
- btn_confirm: bool
- #entity: string
then:
- lambda: |-
- // ESP_LOGV("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");
- std::string btnconf = btn_id.c_str() + std::string("conf");
- //std::string btnentity = btn_id.c_str() + std::string("entity");
id(disp1).send_command_printf("%spic.pic=%i", btn_id.c_str(), btn_pic);
id(set_component_color).execute(btnicon.c_str(), btn_icon_font, btn_bg);
id(set_component_color).execute(btntext.c_str(), btn_txt_font, btn_bg);
@@ -361,8 +341,6 @@ api:
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(), " ");
- id(disp1).set_component_value(btnconf.c_str(), (btn_confirm) ? 1 : 0);
- //id(disp1).set_component_text_printf(btnentity.c_str(), "%s", entity.c_str());
##### SERVICE TO WAKE UP THE DISPLAY #####
- service: wake_up
@@ -370,14 +348,14 @@ api:
reset_timer: bool
then:
- lambda: |-
- if (id(current_page).state == "home")
+ if (id(current_page).state == "screensaver") id(disp1).goto_page(id(wakeup_page_name).state.c_str());
+ if (reset_timer)
+ id(timer_reset_all).execute(id(wakeup_page_name).state.c_str());
+ else
{
- id(disp1).send_command_printf("home.dimtimer.en=1");
- id(disp1).send_command_printf("home.sleeptimer.en=1");
+ id(timer_sleep).execute(id(wakeup_page_name).state.c_str(), int(id(timeout_sleep).state));
+ id(timer_dim).execute(id(wakeup_page_name).state.c_str(), int(id(timeout_dim).state));
}
- else if (id(current_page).state == "screensaver") id(disp1).send_command_printf("page %s", id(wakeup_page_name).state.c_str());
- id(disp1).send_command_printf("dim=brightness");
- if (reset_timer) id(page_timer)->execute();
#### Service to set the entities ####
- service: set_entity
@@ -389,14 +367,12 @@ api:
ent_value_xcen: string
then:
- lambda: |-
- ESP_LOGV("service.set_entity", "entity: %s", ent_id.c_str());
std::string enticon = ent_id.c_str() + std::string("_pic");
std::string entlabel = ent_id.c_str() + std::string("_label");
std::string entxcen = ent_id.c_str() + std::string(".xcen=") + ent_value_xcen.c_str();
id(disp1).set_component_text_printf(enticon.c_str(), "%s", ent_icon.c_str());
if (strcmp(ent_icon.c_str(), "0") != 0) id(disp1).set_component_text_printf(enticon.c_str(), "%s", ent_icon.c_str());
id(disp1).set_component_text_printf(entlabel.c_str(), "%s", ent_label.c_str());
- //id(display_wrapped_text).execute(entlabel.c_str(), ent_label.c_str(), id(display_mode) == 2 ? 16 : 20);
id(disp1).set_component_text_printf(ent_id.c_str(), "%s", ent_value.c_str());
if (strcmp(ent_value_xcen.c_str(), "0") != 0) id(disp1).send_command_printf("%s", entxcen.c_str());
@@ -407,9 +383,11 @@ api:
relay1_local_control: bool
relay1_icon: string
relay1_icon_color: int
+ relay1_fallback: bool
relay2_local_control: bool
relay2_icon: string
relay2_icon_color: int
+ relay2_fallback: bool
date_color: int
time_format: string
time_color: int
@@ -419,23 +397,6 @@ api:
mui_please_confirm: string
then:
- lambda: |-
- // Logs - Begin
- ESP_LOGV("service.global_settings", "Starting");
- ESP_LOGD("service.global_settings", "Blueprint version: %s", blueprint_version.c_str());
- ESP_LOGV("service.global_settings", "relay1_local_control: %i", (relay1_local_control) ? 1 : 0);
- ESP_LOGV("service.global_settings", "relay1_icon: %s", relay1_icon.c_str());
- ESP_LOGV("service.global_settings", "relay1_icon_color: %i", relay1_icon_color);
- ESP_LOGV("service.global_settings", "relay2_local_control: %i", (relay2_local_control) ? 1 : 0);
- ESP_LOGV("service.global_settings", "relay2_icon: %s", relay2_icon.c_str());
- ESP_LOGV("service.global_settings", "relay2_icon_color: %i", relay2_icon_color);
- ESP_LOGV("service.global_settings", "date_color: %i", date_color);
- ESP_LOGV("service.global_settings", "time_format: %s", time_format.c_str());
- ESP_LOGV("service.global_settings", "time_color: %i", time_color);
- ESP_LOGV("service.global_settings", "embedded_climate: %i", (embedded_climate) ? 1 : 0);
- ESP_LOGV("service.global_settings", "embedded_indoor_temperature: %i", (embedded_indoor_temperature) ? 1 : 0);
- ESP_LOGV("service.global_settings", "temperature_unit_is_fahrenheit: %i", (temperature_unit_is_fahrenheit) ? 1 : 0);
- ESP_LOGV("service.global_settings", "mui_please_confirm: %s", mui_please_confirm.c_str());
-
// Blueprint version
id(version_blueprint) = blueprint_version;
id(check_versions).execute();
@@ -447,6 +408,8 @@ api:
id(home_relay2_icon) = relay2_icon.c_str();
id(home_relay1_icon_color) = relay1_icon_color;
id(home_relay2_icon_color) = relay2_icon_color;
+ id(relay_1_fallback) = relay1_fallback;
+ id(relay_2_fallback) = relay2_fallback;
// Localization
id(mui_time_format) = time_format;
@@ -461,21 +424,18 @@ api:
// Indoor temperature
id(embedded_indoor_temp) = embedded_indoor_temperature;
id(temp_unit_fahrenheit) = temperature_unit_is_fahrenheit;
- id(display_embedded_temp)->execute();
+ id(display_embedded_temp).execute();
// Confirm page
- ESP_LOGV("service.global_settings", "Confirm page - Start");
id(display_wrapped_text).execute("confirm.title", mui_please_confirm.c_str(), 15);
// Refresh colors of global components
- ESP_LOGV("service.global_settings", "Refresh colors of global components");
id(disp1).set_component_font_color("home.date", id(home_date_color));
id(disp1).set_component_font_color("home.time", id(home_time_color));
id(disp1).set_component_font_color("home.icon_top_01", id(home_relay1_icon_color));
id(disp1).set_component_font_color("home.icon_top_02", id(home_relay2_icon_color));
// Update home page
- ESP_LOGV("service.global_settings", "Update home page");
id(update_page_home).execute();
- if:
@@ -485,9 +445,7 @@ api:
state: 'boot'
then:
- lambda: |-
- ESP_LOGV("service.global_settings", "Boot page is visible");
id(disp1).set_component_text_printf("boot.bluep_version", "%s", blueprint_version.c_str());
- ESP_LOGV("service.global_settings", "Wait a bit");
- wait_until:
condition:
- not:
@@ -505,14 +463,12 @@ api:
condition:
switch.is_on: notification_sound
then:
- - lambda: ESP_LOGV("service.global_settings", "Play boot sound");
- rtttl.play:
rtttl: 'two short:d=4,o=5,b=100:16e6,16e6'
- lambda: |-
- ESP_LOGV("service.global_settings", "Jump to wake-up page: %s", id(wakeup_page_name).state.c_str());
- id(disp1).send_command_printf("page %s", id(wakeup_page_name).state.c_str());
-
- - lambda: ESP_LOGV("service.global_settings", "Finished");
+ ESP_LOGD("service.global_settings", "Jump to wake-up page: %s", id(wakeup_page_name).state.c_str());
+ id(disp1).goto_page(id(wakeup_page_name).state.c_str());
+ id(timer_reset_all).execute(id(wakeup_page_name).state.c_str());
#### Service to populate the page Home #####
- service: page_home
@@ -529,17 +485,7 @@ api:
alarm_state: string
then:
- lambda: |-
- // Logs - Begin
- ESP_LOGV("service.page_home_settings", "Starting");
- ESP_LOGV("service.page_home_settings", "notification_icon: %s", notification_icon.c_str());
- ESP_LOGV("service.page_home_settings", "qrcode: %i", (qrcode) ? 1 : 0);
- ESP_LOGV("service.page_home_settings", "qrcode_icon: %s", qrcode_icon.c_str());
- ESP_LOGV("service.page_home_settings", "entities_pages: %i", (entities_pages) ? 1 : 0);
- ESP_LOGV("service.page_home_settings", "entities_pages_icon: %s", entities_pages_icon.c_str());
- ESP_LOGV("service.page_home_settings", "alarm_state: %s", alarm_state.c_str());
-
// Notification button
- ESP_LOGV("service.page_home_settings", "Notification button - Start");
id(disp1).send_command_printf("is_notification=%i", (id(notification_text).state.empty() and id(notification_label).state.empty()) ? 0 : 1);
id(disp1).set_component_text_printf("home.bt_notific", "%s", notification_icon.c_str());
id(set_component_color).execute("home.bt_notific", id(notification_unread).state ? notification_icon_color_unread : notification_icon_color_normal, {});
@@ -547,43 +493,30 @@ api:
id(home_notify_icon_color_unread) = notification_icon_color_unread;
// QRCode button
- ESP_LOGV("service.page_home_settings", "QRcode button - Start");
id(disp1).send_command_printf("is_qrcode=%i", (qrcode) ? 1 : 0);
id(disp1).set_component_text_printf("home.bt_qrcode", "%s", qrcode_icon.c_str());
id(set_component_color).execute("home.bt_qrcode", qrcode_icon_color, {});
// Entities pages button
- ESP_LOGV("service.page_home_settings", "Entities pages button - Start");
id(disp1).send_command_printf("is_entities=%i", (entities_pages) ? 1 : 0);
id(disp1).set_component_text_printf("home.bt_entities", "%s", entities_pages_icon.c_str());
id(set_component_color).execute("home.bt_entities", entities_pages_icon_color, {});
// Alarm button
- ESP_LOGV("service.page_home_settings", "Alarm button - Start");
id(disp1).send_command_printf("is_alarm=%i", (alarm_state=="" or alarm_state.empty()) ? 0 : 1);
- id(update_alarm_icon)->execute("home.bt_alarm", alarm_state.c_str());
-
- // Logs - End
- ESP_LOGV("service.page_home_settings", "Finished");
+ id(update_alarm_icon).execute("home.bt_alarm", alarm_state.c_str());
#### Service to populate the page Settings #####
- service: page_settings
variables:
reboot: string
- sleep_mode: string
+ #sleep_mode: string
brightness: string
bright: string
dim: string
then:
- lambda: |-
- ESP_LOGV("service.page_settings", "Starting");
- ESP_LOGV("service.page_settings", "reboot: %s", reboot.c_str());
- ESP_LOGV("service.page_settings", "sleep_mode: %s", sleep_mode.c_str());
- ESP_LOGV("service.page_settings", "brightness: %s", brightness.c_str());
- ESP_LOGV("service.page_settings", "bright: %s", bright.c_str());
- ESP_LOGV("service.page_settings", "dim: %s", dim.c_str());
if (not reboot.empty()) id(disp1).set_component_text_printf("settings.lbl_reboot", " %s", reboot.c_str());
- if (not sleep_mode.empty()) id(disp1).set_component_text_printf("settings.lbl_sleep", " %s", sleep_mode.c_str());
id(display_wrapped_text).execute("settings.lbl_brightness", brightness.c_str(), id(display_mode) == 2 ? 25 : 10);
id(display_wrapped_text).execute("settings.lbl_bright", bright.c_str(), id(display_mode) == 2 ? 25 : 10);
id(display_wrapped_text).execute("settings.lbl_dim", dim.c_str(), id(display_mode) == 2 ? 25 : 10);
@@ -600,28 +533,17 @@ api:
mui_alarm: string[] #std::vector #std::map
then:
- lambda: |-
- // Logs - Begin
- ESP_LOGV("service.alarm_settings", "Starting");
- ESP_LOGV("service.alarm_settings", "page_title: %s", page_title.c_str());
- ESP_LOGV("service.alarm_settings", "state: %s", state.c_str());
- ESP_LOGV("service.alarm_settings", "supported_features: %i", supported_features);
- ESP_LOGV("service.alarm_settings", "code_format: %s", code_format.c_str());
- ESP_LOGV("service.alarm_settings", "code_arm_required: %i", (code_arm_required) ? 1 : 0);
- ESP_LOGV("service.alarm_settings", "entity: %s", entity.c_str());
-
// set alarm icon on home page
- ESP_LOGV("service.alarm_settings", "Updating home page icon");
id(disp1).send_command_printf("is_alarm=%i", (state=="" or state.empty()) ? 0 : 1);
- id(update_alarm_icon)->execute("home.bt_alarm", state.c_str());
+ id(update_alarm_icon).execute("home.bt_alarm", state.c_str());
// Is page Alarm visible?
if (id(current_page).state=="alarm")
{ // Update alarm page
- ESP_LOGV("service.alarm_settings", "Updating alarm page");
id(entity_id) = entity;
// Alarm page - Header
- id(update_alarm_icon)->execute("icon_state", state.c_str());
+ id(update_alarm_icon).execute("icon_state", state.c_str());
id(disp1).set_component_text_printf("page_label", "%s", page_title.c_str());
id(disp1).set_component_text_printf("code_format", "%s", code_format.c_str());
if (code_arm_required) id(disp1).set_component_text_printf("code_arm_req", "1"); else id(disp1).set_component_text_printf("code_arm_req", "0");
@@ -699,9 +621,6 @@ api:
}
}
- // Logs - End
- ESP_LOGV("service.alarm_settings", "Finished");
-
#### Service to populate the media player page #####
- service: media_player
variables:
@@ -712,50 +631,18 @@ api:
volume_level: int
media_title: string
media_artist: string
- media_duration: int
- media_position: int
+ media_duration: float
+ media_position: float
+ media_position_delta: float
supported_features: int
then:
- lambda: |-
- ESP_LOGV("service.media_player", "Starting");
if (id(current_page).state == "media_player")
{
- //id(disp1).set_component_text_printf("entity", "%s", entity.c_str());
id(entity_id) = entity;
id(disp1).set_component_text_printf("page_label", "%s", friendly_name.c_str());
id(display_wrapped_text).execute("track", media_title.c_str(), id(display_mode) == 2 ? 16 : 27);
id(display_wrapped_text).execute("artist", media_artist.c_str(), id(display_mode) == 2 ? 26 : 40);
- // states:
- // OFF: Entity is turned off and is not accepting commands until turned on.
- // ON: Entity is turned on, but no details on its state is currently known.
- // IDLE: Entity is turned on and accepting commands, but currently not playing any media. Possibly at some idle home screen.
- // PLAYING: Entity is currently playing media.
- // PAUSED: Entity has an active media and is currently paused
- // STANDBY: Entity is in a low power state, accepting commands.
- // BUFFERING: Entity is preparing to start playback of some media
- // feature:
- // PAUSE: 1
- // SEEK: 2
- // VOLUME_SET: 4
- // VOLUME_MUTE: 8
- // PREVIOUS_TRACK: 16
- // NEXT_TRACK: 32
- // reserved: 64
- // TURN_ON: 128
- // TURN_OFF: 256
- // PLAY_MEDIA: 512
- // VOLUME_STEP: 1024
- // SELECT_SOURCE: 2048
- // STOP: 4096
- // CLEAR_PLAYLIST: 8192
- // PLAY: 16384
- // SHUFFLE_SET: 32768
- // SELECT_SOUND_MODE: 65536
- // BROWSE_MEDIA: 131072
- // REPEAT_SET: 262144
- // GROUPING: 524288
- // MEDIA_ANNOUNCE: 1048576
- // MEDIA_ENQUEUE: 2097152
// on/off button
if (supported_features & 128 and state == "off") //TURN_ON
@@ -789,7 +676,7 @@ api:
if (supported_features & 32 and state != "off") id(disp1).show_component("bt_next"); else id(disp1).hide_component("bt_next");
// Stop button - STOP
- if (supported_features & 4096 and (state == "playing" or state == "paused")) id(disp1).show_component("bt_stop"); else id(disp1).hide_component("bt_stop");
+ //if (supported_features & 4096 and (state == "playing" or state == "paused")) id(disp1).show_component("bt_stop"); else id(disp1).hide_component("bt_stop");
// mute/unmute button - VOLUME_MUTE
id(disp1).set_component_value("is_muted", (is_volume_muted) ? 1 : 0);
@@ -808,8 +695,12 @@ api:
// VOLUME_SET
if (supported_features & 4)
{
- id(disp1).set_component_text_printf("vol_text", "%i%%", volume_level);
- id(disp1).set_component_value("vol_slider", volume_level);
+ if (volume_level != id(last_volume_level))
+ {
+ id(last_volume_level) = volume_level;
+ id(disp1).set_component_text_printf("vol_text", "%i%%", volume_level);
+ id(disp1).set_component_value("vol_slider", volume_level);
+ }
id(disp1).show_component("vol_slider");
id(disp1).show_component("bt_vol_down");
id(disp1).show_component("bt_vol_up");
@@ -825,8 +716,13 @@ api:
if (media_duration > 0)
{
- id(disp1).set_component_value("prg_current", media_position);
- id(disp1).set_component_value("prg_total", media_duration);
+ if (media_duration != id(last_media_duration) or media_position != id(last_media_position))
+ {
+ id(last_media_duration) = media_duration;
+ id(last_media_position) = media_position;
+ id(disp1).set_component_value("prg_current", int(round(min(media_position + media_position_delta, media_duration))));
+ }
+ id(disp1).set_component_value("prg_total", int(round(media_duration)));
id(disp1).send_command_printf("prg_timer.en=%i", (state == "playing") ? 1 : 0);
id(disp1).show_component("time_current");
id(disp1).show_component("time_total");
@@ -844,12 +740,46 @@ api:
##### START - GLOBALS CONFIGURATION #####
globals:
+ ###### Last volume level from Home Assistant ######
+ - id: last_volume_level
+ type: int
+ restore_value: false
+ initial_value: '-1'
+
+ ###### Last duration from Home Assistant ######
+ - id: last_media_duration
+ type: int
+ restore_value: false
+ initial_value: '-1'
+
+ ###### Last duration from Home Assistant ######
+ - id: last_media_position
+ type: int
+ restore_value: false
+ initial_value: '-1'
+
+ ###### Relay fallback even when buttons have other entities? ######
+ - id: relay_1_fallback
+ type: bool
+ restore_value: true
+ initial_value: 'false'
+ - id: relay_2_fallback
+ type: bool
+ restore_value: true
+ initial_value: 'false'
+
##### Display mode (1 = EU, 2 = US, 3 = US Landscape)
- id: display_mode
type: int
restore_value: true
initial_value: '0'
+ ##### Is dimmed #####
+ - id: is_dim_brightness
+ type: bool
+ restore_value: false
+ initial_value: 'false'
+
##### Entity Id of the entity displayed on the detailed pages
- id: entity_id
type: std::string
@@ -879,7 +809,7 @@ globals:
- id: embedded_indoor_temp
type: bool
restore_value: true
- initial_value: 'true'
+ initial_value: 'false'
- id: temp_unit_fahrenheit
type: bool
restore_value: true
@@ -929,12 +859,10 @@ globals:
- id: home_notify_icon_color_normal
type: std::vector
restore_value: false
- #initial_value: '52857'
- id: home_notify_icon_color_unread
type: std::vector
restore_value: false
- #initial_value: '63488'
##### Versions #####
- id: version_blueprint
@@ -972,7 +900,15 @@ binary_sensor:
- logger.log: "Left button - Short click"
- if:
condition:
- - switch.is_on: relay1_local
+ or:
+ - switch.is_on: relay1_local
+ - and:
+ - lambda: !lambda return id(relay_1_fallback);
+ - or:
+ - not:
+ - api.connected:
+ - not:
+ - wifi.connected:
then:
- switch.toggle: relay_1
- script.execute: refresh_relays
@@ -1003,7 +939,15 @@ binary_sensor:
- logger.log: "Right button - Short click"
- if:
condition:
- - switch.is_on: relay2_local
+ or:
+ - switch.is_on: relay2_local
+ - and:
+ - lambda: !lambda return id(relay_2_fallback);
+ - or:
+ - not:
+ - api.connected:
+ - not:
+ - wifi.connected:
then:
- switch.toggle: relay_2
- script.execute: refresh_relays
@@ -1031,16 +975,6 @@ binary_sensor:
on_click:
- button.press: restart_nspanel
- ##### Sleep mode NSPanel Button #####
- - name: ${device_name} Sleep mode
- platform: nextion
- page_id: 7
- component_id: 10
- internal: true
- on_click:
- - logger.log: "Sleep mode - Nextion toggle"
- - switch.toggle: sleep_mode
-
##### global variable to keep track on whether the Nextion display is ready or not.
## Delays initial info from HA to the display #####
- name: ${device_name} Nextion display
@@ -1072,16 +1006,7 @@ sensor:
on_value:
then:
- lambda: |-
- id(page_timer)->execute();
-
- ##### Send current brightness info to Home Assistant
- - name: ${device_name} Brightness
- id: brightness
- platform: nextion
- variable_name: dim
- #update_interval: 1s
- internal: false
- precision: 0
+ id(timer_reset_all).execute(id(current_page).state.c_str());
##### Uptime Sensors #####
- name: ${device_name} Uptime seconds
@@ -1145,7 +1070,16 @@ sensor:
on_value:
then:
# Show panel's temperature if API or Wi-Fi are out
- - lambda: id(display_embedded_temp)->execute();
+ - lambda: id(display_embedded_temp).execute();
+
+ - name: ${device_name} Brightness
+ id: display_current_brightness
+ platform: nextion
+ variable_name: dim
+ internal: true
+ icon: mdi:tablet-dashboard
+ unit_of_measurement: '%'
+ accuracy_decimals : 0
###### Display Brightness GET VALUE FROM NSPanel SLIDER #####
- name: ${device_name} brightness Slider
@@ -1158,6 +1092,9 @@ sensor:
- number.set:
id: display_brightness
value: !lambda 'return int(x);'
+ - lambda: |-
+ id(timer_reset_all).execute("settings");
+ id(display_current_brightness).update();
###### Display DIM Brightness GET VALUE FROM NSPanel SLIDER #####
- name: ${device_name} dim brightness slider
@@ -1170,22 +1107,36 @@ sensor:
- number.set:
id: display_dim_brightness
value: !lambda 'return int(x);'
+ - lambda: |-
+ id(timer_reset_all).execute("settings");
+ id(display_current_brightness).update();
##### START - TEXT SENSOR CONFIGURATION #####
text_sensor:
##### Current page name #####
- - name: ${device_name} current page
- platform: template
+ - name: ${device_name} Current page
id: current_page
+ platform: template
+ #platform: nextion
+ #nextion_id: disp1
+ #component_name: currentpage
internal: false
disabled_by_default: false
on_value:
then:
- lambda: |-
- if (x != "climate" and x != "cover" and x != "fan" and x != "light" and x != "media_player" ) id(entity_id) = "";
+ if (x != "climate" and x != "cover" and x != "fan" and x != "light" and x != "media_player" and x != "confirm" and x != "keyb_num") id(entity_id) = "";
+ if (x != "media_player")
+ {
+ id(last_volume_level) = -1;
+ id(last_media_duration) = -1;
+ id(last_media_position) = -1;
+ }
ESP_LOGD("text_sensor.current_page", "New page: %s", x.c_str());
if (!id(entity_id).empty()) ESP_LOGD("text_sensor.current_page", "Entity shown: %s", id(entity_id).c_str());
+ id(timer_reset_all).execute(x.c_str());
+ id(display_current_brightness).update();
##### ESPhome version used to compile the app #####
- name: ${device_name} ESPhome Version
@@ -1228,11 +1179,11 @@ text_sensor:
then:
- lambda: |-
ESP_LOGV("text_sensor.nspanelevent", "Starting");
- id(page_timer)->execute();
DynamicJsonDocument doc(1024);
deserializeJson(doc, x);
std::string page = doc["page"];
std::string component = doc["component"];
+ if (not (component == "currentpage" and (page == "screensaver" or page == "home"))) id(timer_reset_all).execute(page.c_str());
std::string value = doc["value"];
std::string entity = id(entity_id); //doc["entity"];
ESP_LOGV("text_sensor.nspanelevent", "page: %s", page.c_str());
@@ -1259,7 +1210,7 @@ text_sensor:
{"entity", entity}
});
ESP_LOGV("text_sensor.nspanelevent", "Call add-ons scripts for new page");
- id(addon_climate_set_climate).execute(page=="climate" and entity=="embedded_climate");
+ id(addon_climate_set_climate).execute(page=="climate" and entity == "embedded_climate");
ESP_LOGV("text_sensor.nspanelevent", "Publish current_page sensor");
id(current_page).publish_state(page);
ESP_LOGV("text_sensor.nspanelevent", "Construct new page");
@@ -1271,19 +1222,7 @@ text_sensor:
else if (page=="screensaver")
{
ESP_LOGV("text_sensor.nspanelevent", "Construct screensaver page");
- int wakeup_page_id = 0;
- if (id(wakeup_page_name).state == "buttonpage01") wakeup_page_id = 12;
- else if (id(wakeup_page_name).state == "buttonpage02") wakeup_page_id = 13;
- else if (id(wakeup_page_name).state == "buttonpage03") wakeup_page_id = 14;
- else if (id(wakeup_page_name).state == "buttonpage04") wakeup_page_id = 15;
- else if (id(wakeup_page_name).state == "entitypage01") wakeup_page_id = 18;
- else if (id(wakeup_page_name).state == "entitypage02") wakeup_page_id = 19;
- else if (id(wakeup_page_name).state == "entitypage03") wakeup_page_id = 20;
- else if (id(wakeup_page_name).state == "entitypage04") wakeup_page_id = 21;
- else if (id(wakeup_page_name).state == "qrcode") wakeup_page_id = 17;
- else if (id(wakeup_page_name).state == "alarm") wakeup_page_id = 23;
- ESP_LOGV("text_sensor.nspanelevent", "Wake-up page id: %i", wakeup_page_id);
- id(disp1).set_component_value("orign", wakeup_page_id);
+ id(update_page_screensaver).execute();
}
else if (page=="climate")
{
@@ -1295,7 +1234,7 @@ text_sensor:
id(disp1).set_component_text_printf("climate.button05_icon", "%s", "\uE58D"); //mdi:water-percent
id(disp1).set_component_text_printf("climate.button06_icon", "%s", "\uE20F"); //mdi:fan
id(disp1).set_component_text_printf("climate.button07_icon", "%s", "\uE424"); //mdi:power
- id(addon_climate_update_page_climate)->execute();
+ id(addon_climate_update_page_climate).execute();
}
else if (page=="cover")
{
@@ -1330,7 +1269,12 @@ text_sensor:
else if (page=="buttonpage02" or page=="entitypage02") id(disp1).set_component_text_printf("page_index", "%s", "\uE765\uE764\uE765\uE765"); // 2/4
else if (page=="buttonpage03" or page=="entitypage03") id(disp1).set_component_text_printf("page_index", "%s", "\uE765\uE765\uE764\uE765"); // 3/4
else if (page=="buttonpage04" or page=="entitypage04") id(disp1).set_component_text_printf("page_index", "%s", "\uE765\uE765\uE765\uE764"); // 4/4
- else if (page=="settings") id(disp1).set_component_text_printf("bt_sleep", "%s", (id(sleep_mode).state) ? "\uEA19" : "\uEA18"); //mdi:toggle-switch-outline or mdi:toggle-switch-off-outline
+ else if (page=="settings")
+ {
+ //id(disp1).set_component_text_printf("bt_sleep", "%s", (id(sleep_mode).state) ? "\uEA19" : "\uEA18"); //mdi:toggle-switch-outline or mdi:toggle-switch-off-outline
+ id(disp1).hide_component("lbl_sleep");
+ id(disp1).hide_component("bt_sleep");
+ }
else if (page=="notification")
{
id(disp1).set_component_text_printf("notification.notifi_label", "%s", id(notification_label).state.c_str());
@@ -1343,7 +1287,7 @@ text_sensor:
id(disp1).set_component_text_printf("bt_prev", "%s", "\uE4AD"); //mdi:skip-previous
id(disp1).set_component_text_printf("bt_next", "%s", "\uE4AC"); //mdi:skip-next
id(disp1).set_component_text_printf("bt_play_pause", "%s", "\uE40D"); //mdi:play-pause
- id(disp1).set_component_text_printf("bt_stop", "%s", "\uE4DA"); //mdi:stop
+ //id(disp1).set_component_text_printf("bt_stop", "%s", "\uE4DA"); //mdi:stop
id(disp1).set_component_text_printf("bt_mute", "%s", "\uE75E"); //mdi:volume-mute
id(disp1).set_component_text_printf("bt_vol_down", "%s", "\uE75D"); //mdi:volume-minus
id(disp1).set_component_text_printf("bt_vol_up", "%s", "\uE75C"); //mdi:volume-plus
@@ -1365,24 +1309,16 @@ text_sensor:
on_value:
then:
- lambda: |-
- ESP_LOGV("text_sensor.localevent", "Starting");
- id(page_timer)->execute();
DynamicJsonDocument doc(1024);
deserializeJson(doc, x);
std::string page = doc["page"];
- ESP_LOGV("text_sensor.localevent", "page: %s", page.c_str());
std::string event = doc["event"];
- ESP_LOGV("text_sensor.localevent", "event: %s", event.c_str());
+ if (not (event == "pagechanged" and (page == "screensaver" or page == "home"))) id(timer_reset_all).execute(page.c_str());
std::string component = doc["component"];
- ESP_LOGV("text_sensor.localevent", "component: %s", component.c_str());
std::string key = doc["key"];
- ESP_LOGV("text_sensor.localevent", "key: %s", key.c_str());
std::string value = doc["value"];
- ESP_LOGV("text_sensor.localevent", "value: %s", value.c_str());
std::string entity = id(entity_id); //doc["entity"];
- ESP_LOGV("text_sensor.localevent", "entity: %s", entity.c_str());
int embedded = doc["embedded"];
- ESP_LOGV("text_sensor.localevent", "embedded: %i", embedded);
std::string service = "";
// send event to Home Assistant
@@ -1403,7 +1339,16 @@ text_sensor:
id(current_page).publish_state(page);
ESP_LOGV("text_sensor.localevent", "Construct new page");
}
- else if (event=="short_click" or event=="long_click") id(ha_button)->execute(page.c_str(), component.c_str(), event.c_str());
+ else if (event=="short_click" or event=="long_click") id(ha_button).execute(page.c_str(), component.c_str(), event.c_str());
+ else if (event=="click")
+ {
+ if (page == "home" and component == "climate")
+ {
+ id(entity_id) = (id(is_embedded_thermostat)) ? "embedded_climate" : "";
+ id(disp1).set_component_value("climate.embedded", (id(is_embedded_thermostat)) ? 1 : 0);
+ }
+ id(disp1).goto_page("climate");
+ }
else if (page == "light" or page == "climate" or page == "notification")// Generic event
{
ha_event->fire_homeassistant_event("esphome.nspanel_ha_blueprint",
@@ -1424,7 +1369,7 @@ text_sensor:
std::string title = doc["mui"];
if (code_format=="number" and (key=="disarm" or code_arm_req=="1"))
{
- id(disp1).send_command_printf("page keyb_num");
+ id(disp1).goto_page("keyb_num");
id(disp1).set_component_value("keyb_num.page_id", 23); //Calling from Alarm page
id(disp1).set_component_text_printf("keyb_num.domain", "%s", page.c_str());
id(disp1).set_component_text_printf("keyb_num.key", "%s", key.c_str());
@@ -1432,15 +1377,15 @@ text_sensor:
id(disp1).set_component_text_printf("keyb_num.entity", "%s", entity.c_str());
id(disp1).set_component_text_printf("keyb_num.title", "%s", title.c_str());
}
- else id(service_call_alarm_control_panel)->execute(entity.c_str(), key.c_str(), code_format.c_str(), "");
+ else id(service_call_alarm_control_panel).execute(entity.c_str(), key.c_str(), code_format.c_str(), "");
}
else if (page=="boot")
{
- // Detect display mode - Need review
+ // Detect display mode
if (doc.containsKey("display_mode"))
{
std::string display_mode_str = doc["display_mode"];
- ESP_LOGV("text_sensor.localevent", "display_mode: %s", display_mode_str.c_str());
+ ESP_LOGD("text_sensor.localevent", "display_mode: %s", display_mode_str.c_str());
float display_mode_float = stof(display_mode_str);
if (display_mode_float > 0) id(display_mode) = int(display_mode_float);
}
@@ -1456,7 +1401,6 @@ text_sensor:
// Detect timeout
if (event=="timeout")
{
- ESP_LOGV("text_sensor.localevent", "Trigger boot timeout event");
ha_event->fire_homeassistant_event("esphome.nspanel_ha_blueprint",
{
{"type", "boot"},
@@ -1464,22 +1408,19 @@ text_sensor:
{"value", value}
});
if (stof(value) >= 5)
- {
- ESP_LOGV("text_sensor.localevent", "Jump to wakeup page: %s", id(wakeup_page_name).state.c_str());
- id(disp1).send_command_printf("page %s", id(wakeup_page_name).state.c_str());
- }
+ id(disp1).goto_page(id(wakeup_page_name).state.c_str());
}
}
- else if (page == "climate") id(service_call_climate)->execute(entity.c_str(), key.c_str(), value.c_str(), (embedded==1));
+ else if (page == "climate") id(service_call_climate).execute(entity.c_str(), key.c_str(), value.c_str(), (embedded==1));
else if (page == "cover")
{
- if (key == "position") id(ha_call_service)->execute("cover.set_cover_position", key.c_str(), value.c_str(), entity.c_str());
- else id(ha_call_service)->execute((std::string("cover.") + key.c_str()), "", "", entity.c_str());
+ if (key == "position") id(ha_call_service).execute("cover.set_cover_position", key.c_str(), value.c_str(), entity.c_str());
+ else id(ha_call_service).execute((std::string("cover.") + key.c_str()), "", "", entity.c_str());
}
else if (page == "fan")
{
- if (key == "stop" or value == "0") id(ha_call_service)->execute("fan.turn_off", "", "", entity.c_str());
- else id(ha_call_service)->execute("fan.turn_on", key.c_str(), value.c_str(), entity.c_str());
+ if (key == "stop" or value == "0") id(ha_call_service).execute("fan.turn_off", "", "", entity.c_str());
+ else id(ha_call_service).execute("fan.turn_on", key.c_str(), value.c_str(), entity.c_str());
}
else if (page == "keyb_num")
{
@@ -1488,21 +1429,19 @@ text_sensor:
{
std::string code_format = doc["code_format"];
std::string pin = doc["pin"];
- id(service_call_alarm_control_panel)->execute(entity.c_str(), key.c_str(), code_format.c_str(), pin.c_str());
+ id(service_call_alarm_control_panel).execute(entity.c_str(), key.c_str(), code_format.c_str(), pin.c_str());
}
else if (base_domain == "" or base_domain.empty()) base_domain = "home";
- id(disp1).send_command_printf("page %s", base_domain.c_str());
+ id(disp1).goto_page(base_domain.c_str());
}
- else if (page == "light") id(ha_call_service)->execute("light.turn_on", key.c_str(), value.c_str(), entity.c_str());
+ else if (page == "light") id(ha_call_service).execute("light.turn_on", key.c_str(), value.c_str(), entity.c_str());
else if (page == "media_player")
{
- if (key == "volume_mute") id(ha_call_service)->execute("media_player.volume_mute", "is_volume_muted", value.c_str(), entity.c_str());
- else if (key == "volume_set") id(ha_call_service)->execute("media_player.volume_set", "volume_level", to_string(stof(value) / 100), entity.c_str());
- else if (not key.empty()) id(ha_call_service)->execute((std::string("media_player.") + key.c_str()), "", "", entity.c_str());
+ if (key == "volume_mute") id(ha_call_service).execute("media_player.volume_mute", "is_volume_muted", value.c_str(), entity.c_str());
+ else if (key == "volume_set") id(ha_call_service).execute("media_player.volume_set", "volume_level", to_string(stof(value) / 100), entity.c_str());
+ else if (not key.empty()) id(ha_call_service).execute((std::string("media_player.") + key.c_str()), "", "", entity.c_str());
}
- ESP_LOGV("text_sensor.localevent", "Finished");
-
##### START - SWITCH CONFIGURATION #####
switch:
@@ -1568,29 +1507,6 @@ switch:
restore_mode: ALWAYS_ON
internal: true
- ##### Switch Display Sleep mode #####
- - name: ${device_name} Sleep mode
- platform: template
- device_class: switch
- id: sleep_mode
- entity_category: config
- restore_mode: RESTORE_DEFAULT_OFF
- optimistic: false
- turn_on_action: &sleep_mode-turn_on
- - lambda: |-
- ESP_LOGV("switch.sleep_mode", "Turn on");
- id(disp1).send_command_printf("sleep_mode=1");
- id(disp1).set_component_value("settings.bt_sleep",1);
- id(disp1).set_component_text_printf("settings.bt_sleep", "%s", "\uEA19");
- id(sleep_mode).publish_state(true);
- turn_off_action: &sleep_mode-turn_off
- - lambda: |-
- ESP_LOGV("switch.sleep_mode", "Turn off");
- id(disp1).send_command_printf("sleep_mode=0");
- id(disp1).set_component_value("settings.bt_sleep",0);
- id(disp1).set_component_text_printf("settings.bt_sleep", "%s", "\uEA18");
- id(sleep_mode).publish_state(false);
-
##### Relay Local control #####
- name: ${device_name} Relay 1 Local
platform: template
@@ -1635,15 +1551,9 @@ number:
id(display_brightness_global) = int(x);
id(disp1).send_command_printf("brightness=%i", int(x));
id(disp1).send_command_printf("settings.brightslider.val=%i", int(x));
- if (id(current_page).state != "screensaver")
- {
- id(disp1).set_backlight_brightness(x/100);
- id(disp1).send_command_printf("home.dimtimer.en=1");
- }
- if (id(current_page).state == "settings")
- {
- id(disp1).set_component_text_printf("bright_text", "%i%%", int(x));
- }
+ if (id(current_page).state != "screensaver") id(disp1).set_backlight_brightness(x/100);
+ if (id(current_page).state == "settings") id(disp1).set_component_text_printf("bright_text", "%i%%", int(x));
+ id(display_current_brightness).update();
##### SCREEN BRIGHTNESS DIMMED DOWN #####
- platform: template
@@ -1682,29 +1592,49 @@ number:
- delay: 1s
- lambda: id(temp_nspanel).publish_state(id(temp_nspanel).raw_state);
- ##### page-timeout #####
- - platform: template
- name: ${device_name} Page timeout
- id: page_timeout
+ ##### Timers settings #####
+ - name: ${device_name} Timeout Page
+ platform: template
+ id: timeout_page
entity_category: config
min_value: 0
- max_value: 60
- initial_value: 5
+ max_value: 300
+ initial_value: 15
step: 1
restore_value: true
optimistic: true
-
- ##### dimming-timeout #####
- #- platform: template
- # name: ${device_name} Dimming timeout
- # id: dimming_timeout
- # entity_category: config
- # min_value: 0
- # max_value: 60
- # initial_value: 15
- # step: 1
- # restore_value: true
- # optimistic: true
+ icon: mdi:timer
+ unit_of_measurement: "s"
+ set_action:
+ - lambda: id(timer_page).execute(id(current_page).state.c_str(), int(x));
+ - name: ${device_name} Timeout Dimming
+ platform: template
+ id: timeout_dim
+ entity_category: config
+ min_value: 0
+ max_value: 300
+ initial_value: 30
+ step: 1
+ restore_value: true
+ optimistic: true
+ icon: mdi:timer
+ unit_of_measurement: "s"
+ set_action:
+ - lambda: id(timer_dim).execute(id(current_page).state.c_str(), int(x));
+ - name: ${device_name} Timeout Sleep
+ platform: template
+ id: timeout_sleep
+ entity_category: config
+ min_value: 0
+ max_value: 300
+ initial_value: 60
+ step: 1
+ restore_value: true
+ optimistic: true
+ icon: mdi:timer
+ unit_of_measurement: "s"
+ set_action:
+ - lambda: id(timer_sleep).execute(id(current_page).state.c_str(), int(x));
select:
- id: wakeup_page_name
@@ -1728,10 +1658,8 @@ select:
internal: false
entity_category: config
icon: mdi:page-next-outline
- #set_action:
- # - logger.log:
- # format: "Wake-up page set: %s"
- # args: ["x.c_str()"]
+ set_action:
+ - script.execute: update_page_screensaver
##### START - DISPLAY START CONFIGURATION #####
display:
@@ -1744,10 +1672,10 @@ display:
on_setup:
then:
- lambda: |-
- ESP_LOGV("display.disp1", "Starting");
- id(disp1).send_command_printf("page 8");
+ id(disp1).goto_page("boot");
id(disp1).set_component_text_printf("boot.esph_version", "%s", "${version}"); // ### esphome-version ###
id(disp1).show_component("bt_reboot");
+ id(timer_reset_all).execute("boot");
- wait_until:
api.connected
- lambda: |-
@@ -1759,11 +1687,6 @@ display:
{"step", "start"}
});
- delay: 1s
- - if:
- condition:
- switch.is_off: sleep_mode
- then: *sleep_mode-turn_off
- else: *sleep_mode-turn_on
- lambda: |-
// Set dimming values
id(display_brightness).publish_state(id(display_brightness_global));
@@ -1772,7 +1695,6 @@ display:
id(disp1).send_command_printf("settings.brightslider.val=%i", id(display_brightness_global));
id(disp1).send_command_printf("brightness_dim=%i", id(display_dim_brightness_global));
id(disp1).send_command_printf("settings.dimslider.val=%i", id(display_dim_brightness_global));
-
id(nextion_init).publish_state(true);
auto ha_event = new esphome::api::CustomAPIDevice();
ha_event->fire_homeassistant_event("esphome.nspanel_ha_blueprint",
@@ -1782,25 +1704,100 @@ display:
});
id(home_relay1_icon) = "\uE3A5";
id(home_relay1_icon) = "\uE3A8";
+ id(timer_reset_all).execute("boot");
- *notification_clear
- switch.turn_off: notification_unread
- logger.log: "Nextion start - Done!"
-### Script for page_timer
+### Scripts ######
script:
- - id: page_timer
+ ###### Timers ######
+ ## Global timer reset - Triggered with a touch on the screen
+ - id: timer_reset_all
mode: restart
+ parameters:
+ page: string
then:
- - lambda: ESP_LOGV("script.page_timer", "start page-timer delay %i", delay);
- - delay: !lambda return int(id(page_timeout).state *1000);
- lambda: |-
- if (id(current_page).state == "home" or id(current_page).state == "screensaver" or id(current_page).state == "boot" or int(id(page_timeout).state) == 0)
- ESP_LOGD("script.page_timer", "no page-jump");
- else
+ ESP_LOGV("script.timer_reset_all", "Reset timers");
+ id(timer_page).execute(page.c_str(), int(id(timeout_page).state));
+ id(timer_dim).execute(page.c_str(), int(id(timeout_dim).state));
+ id(timer_sleep).execute(page.c_str(), int(id(timeout_sleep).state));
+
+ - id: timer_page # Handle the fallback to home page after a timeout
+ mode: restart
+ parameters:
+ page: string
+ timeout: int
+ then:
+ - lambda: |-
+ ESP_LOGV("script.timer_page", "Reset timer: %is", timeout);
+ - if:
+ condition:
+ - lambda: |-
+ return (page != "screensaver" and page != "boot" and page != "home" and timeout >= 1);
+ then:
+ - delay: !lambda return (timeout *1000);
+ - lambda: |-
+ ESP_LOGD("script.timer_page", "Timed out on page: %s", id(current_page).state.c_str());
+ if (id(current_page).state != "screensaver" and id(current_page).state != "boot" and id(current_page).state != "home" and timeout >= 1)
+ {
+ ESP_LOGD("script.timer_page", "Fallback to page Home");
+ id(disp1).goto_page("home");
+ }
+ - id: timer_dim # Handle the brightness dimming after a timeout
+ mode: restart
+ parameters:
+ page: string
+ timeout: int
+ then:
+ - lambda: |-
+ ESP_LOGV("script.timer_dim", "Reset timer: %is", timeout);
+ id(display_current_brightness).update();
+ if (id(is_dim_brightness))
{
- ESP_LOGD("script.page_timer", "timer->home");
- id(disp1).send_command_printf("page 0");
+ if (page != "screensaver" and page != "boot")
+ {
+ ESP_LOGD("script.timer_dim", "Waking up on page: %s", page.c_str());
+ id(disp1).send_command_printf("wakeup_timer.en=1");
+ }
+ id(is_dim_brightness) = false;
}
+ id(display_current_brightness).update();
+ - if:
+ condition:
+ - lambda: !lambda return (timeout >= 1);
+ then:
+ - delay: !lambda return (timeout *1000);
+ - lambda: |-
+ id(display_current_brightness).update();
+ if (id(current_page).state != "screensaver" and id(current_page).state != "boot" and timeout >= 1 and id(display_current_brightness).state > id(display_dim_brightness_global))
+ {
+ ESP_LOGD("script.timer_dim", "Dimming the display to %i%%", id(display_dim_brightness_global));
+ id(disp1).send_command_printf("dim=%i", id(display_dim_brightness_global));
+ id(is_dim_brightness) = true;
+ }
+ id(display_current_brightness).update();
+ - id: timer_sleep # Handle the sleep (go to screensaver page) after a timeout
+ mode: restart
+ parameters:
+ page: string
+ timeout: int
+ then:
+ - lambda: |-
+ ESP_LOGV("script.timer_sleep", "Reset timer: %is", timeout);
+ - if:
+ condition:
+ - lambda: !lambda return (timeout >= 1);
+ then:
+ - delay: !lambda return (timeout *1000);
+ - lambda: |-
+ if (id(current_page).state != "screensaver" and id(current_page).state != "boot" and timeout >= 1)
+ {
+ ESP_LOGD("script.timer_sleep", "Going to sleep");
+ id(disp1).goto_page("screensaver");
+ id(is_dim_brightness) = true;
+ }
- id: set_climate
mode: restart
@@ -1813,7 +1810,6 @@ script:
climate_icon: string
embedded_climate: bool
then:
- - lambda: ESP_LOGV("script.set_climate", "Starting");
- if:
condition:
- text_sensor.state: # Is climate page visible?
@@ -1821,13 +1817,6 @@ script:
state: 'climate'
then:
- lambda: |-
- ESP_LOGV("script.set_climate", "climateslider.maxval=%i", total_steps);
- ESP_LOGV("script.set_climate", "temp_offset=%i", temp_offset);
- ESP_LOGV("script.set_climate", "temp_step=%i", temp_step);
- ESP_LOGV("script.set_climate", "current_temp=%f", current_temp);
- ESP_LOGV("script.set_climate", "target_temp=%f", target_temp);
- ESP_LOGV("script.set_climate", "target_icon=%s", climate_icon.c_str());
- ESP_LOGV("script.set_climate", "embedded=%i", (embedded_climate) ? 1 : 0);
id(addon_climate_set_climate).execute(embedded_climate);
id(disp1).send_command_printf("climateslider.maxval=%i", total_steps);
id(disp1).set_component_value("temp_offset", temp_offset);
@@ -1838,7 +1827,6 @@ script:
if (target_temp > -999)
{
float slider_val = round(((10*target_temp) - temp_offset) / temp_step);
- ESP_LOGV("script.set_climate", "climateslider=%f", slider_val);
id(disp1).set_component_value("climateslider", slider_val);
id(disp1).set_component_text_printf("target_temp", "%.1fΒ°", target_temp);
id(disp1).set_component_text_printf("target_icon", "%s", climate_icon.c_str());
@@ -1857,13 +1845,11 @@ script:
id(disp1).hide_component("increase_temp");
}
id(disp1).set_component_value("embedded", (embedded_climate) ? 1 : 0);
- - lambda: ESP_LOGV("script.set_climate", "Finished");
- id: refresh_datetime
mode: restart
then:
- lambda: |-
- ESP_LOGV("script.refresh_datetime", "Starting");
std::string time_format_str = id(mui_time_format);
if (time_format_str.find("%p") != std::string::npos)
{
@@ -1889,13 +1875,11 @@ script:
}
std::string time_text = id(time_provider).now().strftime(time_format_str);
id(disp1).set_component_text_printf("home.time", "%s", time_text.c_str());
- ESP_LOGV("script.refresh_datetime", "Finished");
- id: refresh_relays
mode: restart
then:
- lambda: |-
- ESP_LOGV("script.refresh_relays", "Starting");
// Chips - Relays
if (id(relay_1).state) id(disp1).set_component_text_printf("home.icon_top_01", "%s", id(home_relay1_icon).c_str());
else id(disp1).set_component_text_printf("icon_top_01", "\uFFFF");
@@ -1904,12 +1888,10 @@ script:
// Hardware buttons - Fallback mode
if (id(relay_1).state and id(relay1_local).state) id(disp1).send_command_printf("home.left_bt_pic.val=%i", (id(relay_1).state) ? 1 : 0);
if (id(relay_2).state and id(relay2_local).state) id(disp1).send_command_printf("home.right_bt_pic.val=%i", (id(relay_2).state) ? 1 : 0);
- ESP_LOGV("script.refresh_relays", "Finished");
- id: refresh_wifi_icon
mode: restart
then:
- - lambda: ESP_LOGV("script.refresh_wifi_icon", "Starting");
- if:
condition:
- binary_sensor.is_on: nextion_init
@@ -1934,12 +1916,10 @@ script:
- lambda: id(disp1).send_command_printf("api=0");
- lambda: id(disp1).set_component_text_printf("home.wifi_icon", "%s", "\uE5A9");
- lambda: id(disp1).set_component_font_color("home.wifi_icon", 63488);
- - lambda: ESP_LOGV("script.refresh_wifi_icon", "Finished");
- id: update_page_home
mode: restart
then:
- - lambda: ESP_LOGV("script.update_page_home", "Starting");
- if:
condition:
- text_sensor.state: # Is home page visible?
@@ -1949,14 +1929,11 @@ script:
- script.execute: refresh_relays
- script.execute: refresh_wifi_icon
- lambda: |-
- ESP_LOGV("script.update_page_home", "is_notification=%i", (id(notification_text).state.empty() and id(notification_label).state.empty()) ? 0 : 1);
id(disp1).send_command_printf("is_notification=%i", (id(notification_text).state.empty() and id(notification_label).state.empty()) ? 0 : 1);
id(set_component_color).execute("home.bt_notific", id(notification_unread).state ? id(home_notify_icon_color_unread) : id(home_notify_icon_color_normal), {});
- script.execute: refresh_datetime
- script.execute: addon_climate_update_page_home
- - lambda: ESP_LOGV("script.update_page_home", "Finished");
-
- id: service_call_alarm_control_panel
mode: restart
parameters:
@@ -1966,11 +1943,6 @@ script:
pin: string
then:
- lambda: |-
- ESP_LOGV("service_call_alarm_control_panel", "ESPHome remote service call");
- ESP_LOGV("service_call_alarm_control_panel", "entity=%s", entity.c_str());
- ESP_LOGV("service_call_alarm_control_panel", "key=%s", key.c_str());
- ESP_LOGV("service_call_alarm_control_panel", "code_format=%s", code_format.c_str());
- ESP_LOGV("service_call_alarm_control_panel", "pin=%s", entity.c_str());
std::string service = "";
if (key=="home") service = "alarm_control_panel.alarm_arm_home";
else if (key=="away") service = "alarm_control_panel.alarm_arm_away";
@@ -1978,10 +1950,8 @@ script:
else if (key=="vacation") service = "alarm_control_panel.alarm_arm_vacation";
else if (key=="bypass") service = "alarm_control_panel.alarm_arm_custom_bypass";
else if (key=="disarm") service = "alarm_control_panel.alarm_disarm";
- ESP_LOGV("service_call_alarm_control_panel", "service=%s", service.c_str());
if (service != "" and not service.empty())
{
- ESP_LOGV("service_call_alarm_control_panel", "ESPHome remote service call");
HomeassistantServiceResponse resp;
HomeassistantServiceMap resp_kv;
resp.service = service.c_str();
@@ -2007,11 +1977,11 @@ script:
then:
- lambda: |-
if (embedded)
- id(addon_climate_service_call)->execute(key.c_str(), value.c_str());
+ id(addon_climate_service_call).execute(key.c_str(), value.c_str());
else if (key == "set_temperature")
- id(ha_call_service)->execute("climate.set_temperature", "temperature", to_string(stof(value) / 10), entity.c_str());
+ id(ha_call_service).execute("climate.set_temperature", "temperature", to_string(stof(value) / 10), entity.c_str());
else if (key == "hvac_mode")
- id(ha_call_service)->execute("climate.set_hvac_mode", key.c_str(), value.c_str(), entity.c_str());
+ id(ha_call_service).execute("climate.set_hvac_mode", key.c_str(), value.c_str(), entity.c_str());
- id: ha_call_service
mode: restart
@@ -2043,10 +2013,7 @@ script:
command: string
then:
- lambda: |-
- ESP_LOGV("script.ha_button", "Starting");
- ESP_LOGV("script.ha_button", "page: %s", page.c_str());
- ESP_LOGV("script.ha_button", "component: %s", component.c_str());
- ESP_LOGV("script.ha_button", "command: %s", command.c_str());
+ id(timer_reset_all).execute(page.c_str());
auto ha_event = new esphome::api::CustomAPIDevice();
ha_event->fire_homeassistant_event("esphome.nspanel_ha_blueprint",
{
@@ -2055,7 +2022,6 @@ script:
{"component", component},
{"command", command}
});
- ESP_LOGV("script.ha_button", "Finished");
- id: update_alarm_icon
mode: restart
@@ -2064,26 +2030,8 @@ script:
state: string
then:
- lambda: |-
- ESP_LOGV("script.update_alarm_icon", "Starting");
std::string alarm_icon = "\uEECC"; //mdi:shield-alert-outline
int alarm_color = 65535;
- // Standard colors:
- // blue: '1055' # rgb(0, 128, 248)
- // grey_dark: '10597' # rgb(40, 44, 40)
- // grey_light: '33808' # rgb(128, 128, 128)
- // grey_super_light: '52857' # rgb(200, 204, 200)
- // grey_white: '59164' # rgb(225, 225, 225)
- // red: '63488' # rgb(248, 0, 0)
- // white: '65535' # rgb(255, 255, 255)
- // yellow: '65472' # rgb(248, 248, 0)
- // #### Colors from HA Style:
- // green: '19818' # rgb(76, 175, 80)
- // orange: '64704' # rgb(255, 152, 0)
- // cyan: '1530' # rgb(0, 188, 212)
- // deep-orange: '64164' # rgb(255, 87, 34)
- // amber: '65024' # rgb(255, 193, 7)
- // "off": '35921' #8a8a8a
- // disabled: '48631' # rgb(189, 189, 189)
if (state == "disarmed")
{
alarm_icon = "\uE99B"; //mdi:shield-off-outline
@@ -2131,7 +2079,6 @@ script:
}
id(disp1).set_component_text_printf(component.c_str(), alarm_icon.c_str());
id(disp1).set_component_font_color(component.c_str(), alarm_color);
- ESP_LOGV("script.update_alarm_icon", "Finished");
- id: update_climate_icon
mode: restart
@@ -2141,80 +2088,62 @@ script:
mode: int
then:
- lambda: |-
- ESP_LOGV("script.update_climate_icon", "Starting");
- ESP_LOGV("script.update_climate_icon", "component: %s", component.c_str());
- ESP_LOGV("script.update_climate_icon", "action: %i", action);
- ESP_LOGV("script.update_climate_icon", "mode: %i", mode);
switch (action) // CLIMATE_ACTION_OFF = 0, CLIMATE_ACTION_COOLING = 2, CLIMATE_ACTION_HEATING = 3, CLIMATE_ACTION_IDLE = 4, CLIMATE_ACTION_DRYING = 5, CLIMATE_ACTION_FAN = 6
{
case 0: //CLIMATE_ACTION_OFF
- ESP_LOGV("script.update_climate_icon", "Climate 'action' is off. Using 'mode' instead");
switch (mode) // CLIMATE_MODE_OFF = 0, CLIMATE_MODE_HEAT_COOL = 1, CLIMATE_MODE_COOL = 2, CLIMATE_MODE_HEAT = 3, CLIMATE_MODE_FAN_ONLY = 4, CLIMATE_MODE_DRY = 5, CLIMATE_MODE_AUTO = 6
{
case 0: //CLIMATE_MODE_OFF
- ESP_LOGV("script.update_climate_icon", "Icon: none");
id(disp1).set_component_text_printf(component.c_str(), "%s", "\uFFFF"); // (E424) Don't show icon when off
id(disp1).set_component_font_color(component.c_str(), 35921); // grey (off)
break;
case 1: //CLIMATE_MODE_HEAT_COOL
- ESP_LOGV("script.update_climate_icon", "Icon: autorenew");
id(disp1).set_component_text_printf(component.c_str(), "%s", "\uE069"); // mdi:autorenew
id(disp1).set_component_font_color(component.c_str(), 35921); // grey (off)
break;
case 2: //CLIMATE_MODE_COOL
- ESP_LOGV("script.update_climate_icon", "Icon: snowflake");
id(disp1).set_component_text_printf(component.c_str(), "%s", "\uE716"); // mdi:snowflake
id(disp1).set_component_font_color(component.c_str(), 35921); // grey (off)
break;
case 3: //CLIMATE_MODE_HEAT
- ESP_LOGV("script.update_climate_icon", "Icon: fire");
id(disp1).set_component_text_printf(component.c_str(), "%s", "\uE237"); // mdi:fire
id(disp1).set_component_font_color(component.c_str(), 35921); // grey (off)
break;
case 4: //CLIMATE_MODE_FAN_ONLY
- ESP_LOGV("script.update_climate_icon", "Icon: fan");
id(disp1).set_component_text_printf(component.c_str(), "%s", "\uE20F"); // mdi:fan
id(disp1).set_component_font_color(component.c_str(), 35921); // grey (off)
break;
case 5: //CLIMATE_MODE_DRY
- ESP_LOGV("script.update_climate_icon", "Icon: water-percent");
id(disp1).set_component_text_printf(component.c_str(), "%s", "\uE58D"); // mdi:water-percent
id(disp1).set_component_font_color(component.c_str(), 35921); // grey (off)
break;
case 6: //CLIMATE_MODE_AUTO
- ESP_LOGV("script.update_climate_icon", "Icon: calendar-sync");
id(disp1).set_component_text_printf(component.c_str(), "%s", "\uEE8D"); // mdi:calendar-sync
id(disp1).set_component_font_color(component.c_str(), 35921); // grey (off)
break;
}
break;
case 2: //CLIMATE_ACTION_COOLING
- ESP_LOGV("script.update_climate_icon", "Icon: snowflake");
id(disp1).set_component_text_printf(component.c_str(), "%s", "\uE716"); // mdi:snowflake
id(disp1).set_component_font_color(component.c_str(), 1055); // blue
break;
case 3: //CLIMATE_ACTION_HEATING
- ESP_LOGV("script.update_climate_icon", "Icon: fire");
id(disp1).set_component_text_printf(component.c_str(), "%s", "\uE237"); // mdi:fire
id(disp1).set_component_font_color(component.c_str(), 64164); // deep-orange
break;
case 4: //CLIMATE_ACTION_IDLE
- ESP_LOGV("script.update_climate_icon", "Icon: thermometer");
id(disp1).set_component_text_printf(component.c_str(), "%s", "\uE50E"); // mdi:thermometer
id(disp1).set_component_font_color(component.c_str(), 35921); // grey (off)
break;
case 5: //CLIMATE_ACTION_DRYING
- ESP_LOGV("script.update_climate_icon", "Icon: water-percent");
id(disp1).set_component_text_printf(component.c_str(), "%s", "\uE58D"); // mdi:water-percent
id(disp1).set_component_font_color(component.c_str(), 64704); // orange
break;
case 6: //CLIMATE_ACTION_FAN
- ESP_LOGV("script.update_climate_icon", "Icon: fan");
id(disp1).set_component_text_printf(component.c_str(), "%s", "\uE20F"); // mdi:fan
id(disp1).set_component_font_color(component.c_str(), 1530); // cyan
break;
}
- ESP_LOGV("script.update_climate_icon", "Finished");
- id: set_component_color
mode: queued
@@ -2224,8 +2153,6 @@ script:
background: int[]
then:
- lambda: |-
- ESP_LOGV("script.set_component_color", "Starting");
- ESP_LOGV("script.set_component_color", "Component: %s", component.c_str());
int fg565 = -1;
int bg565 = -1;
@@ -2239,8 +2166,6 @@ script:
else if (background.size() == 1) bg565 = background[0];
if (bg565 >= 0) id(disp1).set_component_background_color(component.c_str(), bg565);
- ESP_LOGV("script.set_component_color", "Finished");
-
- id: display_wrapped_text
mode: queued
parameters:
@@ -2270,7 +2195,6 @@ script:
startPos = endPos + 1; // Skip the space
while (text[startPos] == ' ' and startPos < text.length()) { startPos++; }
}
- ESP_LOGV("script.display_wrapped_text", "text (new): %s", wrappedText.c_str());
id(disp1).set_component_text_printf(component.c_str(), "%s", wrappedText.c_str());
- id: display_embedded_temp
@@ -2292,7 +2216,11 @@ script:
- id: check_versions
mode: restart
then:
- - delay: 60s
+ - wait_until:
+ condition:
+ - lambda: !lambda 'return (id(version_tft) == "${version}");'
+ - lambda: !lambda 'return (id(version_blueprint) == "${version}");'
+ timeout: 60s
- lambda: |-
ESP_LOGD("script.check_versions", "ESPHome version: ${version}");
ESP_LOGD("script.check_versions", "TFT version: %s", id(version_tft).c_str());
@@ -2308,6 +2236,29 @@ script:
{"blueprint", id(version_blueprint).c_str()}
});
+ - id: update_page_screensaver
+ mode: restart
+ then:
+ - if:
+ condition:
+ text_sensor.state:
+ id: current_page
+ state: screensaver
+ then:
+ - lambda: |-
+ int wakeup_page_id = 0;
+ if (id(wakeup_page_name).state == "buttonpage01") wakeup_page_id = 12;
+ else if (id(wakeup_page_name).state == "buttonpage02") wakeup_page_id = 13;
+ else if (id(wakeup_page_name).state == "buttonpage03") wakeup_page_id = 14;
+ else if (id(wakeup_page_name).state == "buttonpage04") wakeup_page_id = 15;
+ else if (id(wakeup_page_name).state == "entitypage01") wakeup_page_id = 18;
+ else if (id(wakeup_page_name).state == "entitypage02") wakeup_page_id = 19;
+ else if (id(wakeup_page_name).state == "entitypage03") wakeup_page_id = 20;
+ else if (id(wakeup_page_name).state == "entitypage04") wakeup_page_id = 21;
+ else if (id(wakeup_page_name).state == "qrcode") wakeup_page_id = 17;
+ else if (id(wakeup_page_name).state == "alarm") wakeup_page_id = 23;
+ id(disp1).set_component_value("orign", wakeup_page_id);
+
##### ADD-ONS ############################################################
##### Add-on - Climate #####
- id: addon_climate_service_call
diff --git a/nspanel_esphome_addon_climate_cool.yaml b/nspanel_esphome_addon_climate_cool.yaml
index 7c0b096..710479b 100644
--- a/nspanel_esphome_addon_climate_cool.yaml
+++ b/nspanel_esphome_addon_climate_cool.yaml
@@ -71,50 +71,33 @@ script:
mode: restart
then:
- lambda: |-
- ESP_LOGV("script.addon_climate_update_page_home", "Starting");
// Update home.climate_entity variable
- ESP_LOGV("script.addon_climate_update_page_home", "Update home.climate_entity variable: %s", (id(is_embedded_thermostat)) ? "embedded_climate" : "");
- id(disp1).set_component_text_printf("home.climate_entity", (id(is_embedded_thermostat)) ? "embedded_climate" : "");
+ id(entity_id) = (id(is_embedded_thermostat)) ? "embedded_climate" : "";
+ id(disp1).set_component_value("climate.embedded", (id(is_embedded_thermostat)) ? 1 : 0);
// Update chips
if (id(is_embedded_thermostat))
- {
- ESP_LOGV("script.addon_climate_update_page_home", "Update chips");
- id(update_climate_icon).execute("home.icon_top_03", int(id(thermostat_embedded).action), int(id(thermostat_embedded).mode));
- }
- ESP_LOGV("script.addon_climate_update_page_home", "Finished");
+ id(update_climate_icon).execute("home.icon_top_03", int(id(thermostat_embedded).action), int(id(thermostat_embedded).mode));
- id: !extend addon_climate_service_call
then:
- lambda: |-
- ESP_LOGV("script.addon_climate_service_call", "Starting");
id(is_addon_climate_visible) = true;
+ id(disp1).set_component_value("climate.embedded", 1);
auto call = id(thermostat_embedded).make_call();
if (key == "set_temperature")
- {
- call.set_target_temperature(stof(value) / 10);
- }
+ call.set_target_temperature(stof(value) / 10);
else if (key == "hvac_mode")
- {
- call.set_mode(value);
- }
+ call.set_mode(value);
call.perform();
- ESP_LOGV("script.addon_climate_service_call", "Finished");
- id: !extend addon_climate_set_climate
then:
- lambda: |-
- ESP_LOGV("script.addon_climate_set_climate", "Starting");
- ESP_LOGV("script.addon_climate_set_climate", "embedded_climate: %i", (embedded_climate) ? 1 : 0);
id(is_addon_climate_visible) = embedded_climate;
- ESP_LOGV("script.addon_climate_set_climate", "Finished");
- id: !extend addon_climate_update_page_climate
then:
- lambda: |-
- ESP_LOGV("script.addon_climate_update_page_climate", "Starting");
- ESP_LOGV("script.addon_climate_update_page_climate", "nextion_init: %i", (id(nextion_init)) ? 1 : 0);
- ESP_LOGV("script.addon_climate_update_page_climate", "current_page: %s", id(current_page).state.c_str());
- ESP_LOGV("script.addon_climate_update_page_climate", "is_addon_climate_visible: %i", (id(is_addon_climate_visible)) ? 1 : 0);
if (id(current_page).state == "climate" and id(is_addon_climate_visible))
{
id(disp1).set_component_text_printf("page_label", id(addon_climate_friendly_name).c_str());
@@ -134,11 +117,9 @@ script:
);
// Update target temp icon
- ESP_LOGV("script.addon_climate_update_page_climate", "thermostat_embedded.action=%i", int(id(thermostat_embedded).action));
id(update_climate_icon).execute("climate.target_icon", int(id(thermostat_embedded).action), int(id(thermostat_embedded).mode));
// Update buttons bar
- ESP_LOGV("script.addon_climate_update_page_climate", "Updating buttons bar");
// Hide not supported hotspots
id(disp1).hide_component("button01");
id(disp1).hide_component("button02");
@@ -156,15 +137,11 @@ script:
id(disp1).set_component_font_color("climate.button06_icon", 6339);
id(disp1).set_component_font_color("climate.button07_icon", (id(thermostat_embedded).mode==climate::CLIMATE_MODE_OFF) ? 10597 : 35921);
}
- ESP_LOGV("script.addon_climate_update_page_climate", "Finished");
- id: !extend addon_climate_set_climate_friendly_name
then:
- lambda: |-
- ESP_LOGV("script.addon_climate_set_climate_friendly_name", "Starting");
- ESP_LOGV("script.addon_climate_set_climate_friendly_name", "friendly_name: %s", friendly_name.c_str());
id(addon_climate_friendly_name) = friendly_name;
- ESP_LOGV("script.addon_climate_set_climate_friendly_name", "Finished");
switch:
##### PHYSICAL SWITCH 0 (Dummy) - Used when relay is not set #####
diff --git a/nspanel_esphome_addon_climate_heat.yaml b/nspanel_esphome_addon_climate_heat.yaml
index 52a2740..bfa5a59 100644
--- a/nspanel_esphome_addon_climate_heat.yaml
+++ b/nspanel_esphome_addon_climate_heat.yaml
@@ -71,50 +71,33 @@ script:
mode: restart
then:
- lambda: |-
- ESP_LOGV("script.addon_climate_update_page_home", "Starting");
// Update home.climate_entity variable
- ESP_LOGV("script.addon_climate_update_page_home", "Update home.climate_entity variable: %s", (id(is_embedded_thermostat)) ? "embedded_climate" : "");
- id(disp1).set_component_text_printf("home.climate_entity", (id(is_embedded_thermostat)) ? "embedded_climate" : "");
+ id(entity_id) = (id(is_embedded_thermostat)) ? "embedded_climate" : "";
+ id(disp1).set_component_value("climate.embedded", (id(is_embedded_thermostat)) ? 1 : 0);
// Update chips
if (id(is_embedded_thermostat))
- {
- ESP_LOGV("script.addon_climate_update_page_home", "Update chips");
- id(update_climate_icon).execute("home.icon_top_03", int(id(thermostat_embedded).action), int(id(thermostat_embedded).mode));
- }
- ESP_LOGV("script.addon_climate_update_page_home", "Finished");
+ id(update_climate_icon).execute("home.icon_top_03", int(id(thermostat_embedded).action), int(id(thermostat_embedded).mode));
- id: !extend addon_climate_service_call
then:
- lambda: |-
- ESP_LOGV("script.addon_climate_service_call", "Starting");
id(is_addon_climate_visible) = true;
+ id(disp1).set_component_value("climate.embedded", 1);
auto call = id(thermostat_embedded).make_call();
if (key == "set_temperature")
- {
- call.set_target_temperature(stof(value) / 10);
- }
+ call.set_target_temperature(stof(value) / 10);
else if (key == "hvac_mode")
- {
- call.set_mode(value);
- }
+ call.set_mode(value);
call.perform();
- ESP_LOGV("script.addon_climate_service_call", "Finished");
- id: !extend addon_climate_set_climate
then:
- lambda: |-
- ESP_LOGV("script.addon_climate_set_climate", "Starting");
- ESP_LOGV("script.addon_climate_set_climate", "embedded_climate: %i", (embedded_climate) ? 1 : 0);
id(is_addon_climate_visible) = embedded_climate;
- ESP_LOGV("script.addon_climate_set_climate", "Finished");
- id: !extend addon_climate_update_page_climate
then:
- lambda: |-
- ESP_LOGV("script.addon_climate_update_page_climate", "Starting");
- ESP_LOGV("script.addon_climate_update_page_climate", "nextion_init: %i", (id(nextion_init)) ? 1 : 0);
- ESP_LOGV("script.addon_climate_update_page_climate", "current_page: %s", id(current_page).state.c_str());
- ESP_LOGV("script.addon_climate_update_page_climate", "is_addon_climate_visible: %i", (id(is_addon_climate_visible)) ? 1 : 0);
if (id(current_page).state == "climate" and id(is_addon_climate_visible))
{
id(disp1).set_component_text_printf("page_label", id(addon_climate_friendly_name).c_str());
@@ -134,11 +117,9 @@ script:
);
// Update target temp icon
- ESP_LOGV("script.addon_climate_update_page_climate", "thermostat_embedded.action=%i", int(id(thermostat_embedded).action));
id(update_climate_icon).execute("climate.target_icon", int(id(thermostat_embedded).action), int(id(thermostat_embedded).mode));
// Update buttons bar
- ESP_LOGV("script.addon_climate_update_page_climate", "Updating buttons bar");
// Hide not supported hotspots
id(disp1).hide_component("button01");
id(disp1).hide_component("button02");
@@ -156,15 +137,11 @@ script:
id(disp1).set_component_font_color("climate.button06_icon", 6339);
id(disp1).set_component_font_color("climate.button07_icon", (id(thermostat_embedded).mode==climate::CLIMATE_MODE_OFF) ? 10597 : 35921);
}
- ESP_LOGV("script.addon_climate_update_page_climate", "Finished");
- id: !extend addon_climate_set_climate_friendly_name
then:
- lambda: |-
- ESP_LOGV("script.addon_climate_set_climate_friendly_name", "Starting");
- ESP_LOGV("script.addon_climate_set_climate_friendly_name", "friendly_name: %s", friendly_name.c_str());
id(addon_climate_friendly_name) = friendly_name;
- ESP_LOGV("script.addon_climate_set_climate_friendly_name", "Finished");
switch:
##### PHYSICAL SWITCH 0 (Dummy) - Used when relay is not set #####
diff --git a/nspanel_eu.HMI b/nspanel_eu.HMI
index cfde297..142e6e3 100644
Binary files a/nspanel_eu.HMI and b/nspanel_eu.HMI differ
diff --git a/nspanel_eu.tft b/nspanel_eu.tft
index 89c9086..b2bb25e 100644
Binary files a/nspanel_eu.tft and b/nspanel_eu.tft differ
diff --git a/nspanel_eu_code/Program.s.txt b/nspanel_eu_code/Program.s.txt
index 627811f..9cb5ec8 100644
--- a/nspanel_eu_code/Program.s.txt
+++ b/nspanel_eu_code/Program.s.txt
@@ -6,7 +6,6 @@ Program.s
int p=0,q=0,t=0,f=0
int dimdelta=0
int api=0 // 0 = disconnected from HA, 1 = connected to HA
- int sleep_mode=0
int is_alarm=0,is_entities=0,is_qrcode=0,is_notification=0
int brightness=100,brightness_dim=40
int display_mode=1 // 1 = EU, 2 = US, 3 = US landscape
diff --git a/nspanel_eu_code/buttonpage01.txt b/nspanel_eu_code/buttonpage01.txt
index c4e36a2..8fae1a1 100644
--- a/nspanel_eu_code/buttonpage01.txt
+++ b/nspanel_eu_code/buttonpage01.txt
@@ -63,54 +63,12 @@ Variable (string) page_name
Text : buttonpage01
Max. Text Size: 12
-Variable (int32) button01conf
- Attributes
- ID : 50
- Scope: local
- Value: 0
-
-Variable (int32) button02conf
+Variable (int32) confirm
Attributes
ID : 51
Scope: local
Value: 0
-Variable (int32) button03conf
- Attributes
- ID : 52
- Scope: local
- Value: 0
-
-Variable (int32) button04conf
- Attributes
- ID : 53
- Scope: local
- Value: 0
-
-Variable (int32) button05conf
- Attributes
- ID : 54
- Scope: local
- Value: 0
-
-Variable (int32) button06conf
- Attributes
- ID : 55
- Scope: local
- Value: 0
-
-Variable (int32) button07conf
- Attributes
- ID : 56
- Scope: local
- Value: 0
-
-Variable (int32) button08conf
- Attributes
- ID : 57
- Scope: local
- Value: 0
-
Text button01text
Attributes
ID : 4
@@ -457,7 +415,8 @@ Hotspot button01
if(click_timer.en==1)
{
click_timer.en=0
- if(button01conf.val==1)
+ sys0=confirm.val&1
+ if(sys0>0)
{
confirm.body.txt=button01text.txt
confirm.page_id.val=dp
@@ -492,7 +451,8 @@ Hotspot button02
if(click_timer.en==1)
{
click_timer.en=0
- if(button02conf.val==1)
+ sys0=confirm.val&2
+ if(sys0>0)
{
confirm.body.txt=button02text.txt
confirm.page_id.val=dp
@@ -527,7 +487,8 @@ Hotspot button03
if(click_timer.en==1)
{
click_timer.en=0
- if(button03conf.val==1)
+ sys0=confirm.val&4
+ if(sys0>0)
{
confirm.body.txt=button03text.txt
confirm.page_id.val=dp
@@ -562,7 +523,8 @@ Hotspot button04
if(click_timer.en==1)
{
click_timer.en=0
- if(button04conf.val==1)
+ sys0=confirm.val&8
+ if(sys0>0)
{
confirm.body.txt=button04text.txt
confirm.page_id.val=dp
@@ -597,7 +559,8 @@ Hotspot button05
if(click_timer.en==1)
{
click_timer.en=0
- if(button05conf.val==1)
+ sys0=confirm.val&16
+ if(sys0>0)
{
confirm.body.txt=button05text.txt
confirm.page_id.val=dp
@@ -632,7 +595,8 @@ Hotspot button06
if(click_timer.en==1)
{
click_timer.en=0
- if(button06conf.val==1)
+ sys0=confirm.val&32
+ if(sys0>0)
{
confirm.body.txt=button06text.txt
confirm.page_id.val=dp
@@ -667,7 +631,8 @@ Hotspot button07
if(click_timer.en==1)
{
click_timer.en=0
- if(button07conf.val==1)
+ sys0=confirm.val&64
+ if(sys0>0)
{
confirm.body.txt=button07text.txt
confirm.page_id.val=dp
@@ -702,7 +667,8 @@ Hotspot button08
if(click_timer.en==1)
{
click_timer.en=0
- if(button08conf.val==1)
+ sys0=confirm.val&128
+ if(sys0>0)
{
confirm.body.txt=button08text.txt
confirm.page_id.val=dp
@@ -753,7 +719,7 @@ Timer click_timer
Timer wakeup_timer
Attributes
- ID : 58
+ ID : 50
Scope : local
Period (ms): 100
Enabled : yes
diff --git a/nspanel_eu_code/buttonpage02.txt b/nspanel_eu_code/buttonpage02.txt
index 2dbc205..f967fd5 100644
--- a/nspanel_eu_code/buttonpage02.txt
+++ b/nspanel_eu_code/buttonpage02.txt
@@ -63,54 +63,12 @@ Variable (string) page_name
Text : buttonpage02
Max. Text Size: 12
-Variable (int32) button01conf
- Attributes
- ID : 50
- Scope: local
- Value: 0
-
-Variable (int32) button02conf
+Variable (int32) confirm
Attributes
ID : 51
Scope: local
Value: 0
-Variable (int32) button03conf
- Attributes
- ID : 52
- Scope: local
- Value: 0
-
-Variable (int32) button04conf
- Attributes
- ID : 53
- Scope: local
- Value: 0
-
-Variable (int32) button05conf
- Attributes
- ID : 54
- Scope: local
- Value: 0
-
-Variable (int32) button06conf
- Attributes
- ID : 55
- Scope: local
- Value: 0
-
-Variable (int32) button07conf
- Attributes
- ID : 56
- Scope: local
- Value: 0
-
-Variable (int32) button08conf
- Attributes
- ID : 57
- Scope: local
- Value: 0
-
Text button01text
Attributes
ID : 4
@@ -457,7 +415,8 @@ Hotspot button01
if(click_timer.en==1)
{
click_timer.en=0
- if(button01conf.val==1)
+ sys0=confirm.val&1
+ if(sys0>0)
{
confirm.body.txt=button01text.txt
confirm.page_id.val=dp
@@ -492,7 +451,8 @@ Hotspot button02
if(click_timer.en==1)
{
click_timer.en=0
- if(button02conf.val==1)
+ sys0=confirm.val&2
+ if(sys0>0)
{
confirm.body.txt=button02text.txt
confirm.page_id.val=dp
@@ -527,7 +487,8 @@ Hotspot button03
if(click_timer.en==1)
{
click_timer.en=0
- if(button03conf.val==1)
+ sys0=confirm.val&4
+ if(sys0>0)
{
confirm.body.txt=button03text.txt
confirm.page_id.val=dp
@@ -562,7 +523,8 @@ Hotspot button04
if(click_timer.en==1)
{
click_timer.en=0
- if(button04conf.val==1)
+ sys0=confirm.val&8
+ if(sys0>0)
{
confirm.body.txt=button04text.txt
confirm.page_id.val=dp
@@ -597,7 +559,8 @@ Hotspot button05
if(click_timer.en==1)
{
click_timer.en=0
- if(button05conf.val==1)
+ sys0=confirm.val&16
+ if(sys0>0)
{
confirm.body.txt=button05text.txt
confirm.page_id.val=dp
@@ -632,7 +595,8 @@ Hotspot button06
if(click_timer.en==1)
{
click_timer.en=0
- if(button06conf.val==1)
+ sys0=confirm.val&32
+ if(sys0>0)
{
confirm.body.txt=button06text.txt
confirm.page_id.val=dp
@@ -667,7 +631,8 @@ Hotspot button07
if(click_timer.en==1)
{
click_timer.en=0
- if(button07conf.val==1)
+ sys0=confirm.val&64
+ if(sys0>0)
{
confirm.body.txt=button07text.txt
confirm.page_id.val=dp
@@ -702,7 +667,8 @@ Hotspot button08
if(click_timer.en==1)
{
click_timer.en=0
- if(button08conf.val==1)
+ sys0=confirm.val&128
+ if(sys0>0)
{
confirm.body.txt=button08text.txt
confirm.page_id.val=dp
@@ -753,7 +719,7 @@ Timer click_timer
Timer wakeup_timer
Attributes
- ID : 58
+ ID : 50
Scope : local
Period (ms): 100
Enabled : yes
diff --git a/nspanel_eu_code/buttonpage03.txt b/nspanel_eu_code/buttonpage03.txt
index 64ea985..4d697f5 100644
--- a/nspanel_eu_code/buttonpage03.txt
+++ b/nspanel_eu_code/buttonpage03.txt
@@ -63,54 +63,12 @@ Variable (string) page_name
Text : buttonpage03
Max. Text Size: 12
-Variable (int32) button01conf
- Attributes
- ID : 50
- Scope: local
- Value: 0
-
-Variable (int32) button02conf
+Variable (int32) confirm
Attributes
ID : 51
Scope: local
Value: 0
-Variable (int32) button03conf
- Attributes
- ID : 52
- Scope: local
- Value: 0
-
-Variable (int32) button04conf
- Attributes
- ID : 53
- Scope: local
- Value: 0
-
-Variable (int32) button05conf
- Attributes
- ID : 54
- Scope: local
- Value: 0
-
-Variable (int32) button06conf
- Attributes
- ID : 55
- Scope: local
- Value: 0
-
-Variable (int32) button07conf
- Attributes
- ID : 56
- Scope: local
- Value: 0
-
-Variable (int32) button08conf
- Attributes
- ID : 57
- Scope: local
- Value: 0
-
Text button01text
Attributes
ID : 4
@@ -457,7 +415,8 @@ Hotspot button01
if(click_timer.en==1)
{
click_timer.en=0
- if(button01conf.val==1)
+ sys0=confirm.val&1
+ if(sys0>0)
{
confirm.body.txt=button01text.txt
confirm.page_id.val=dp
@@ -492,7 +451,8 @@ Hotspot button02
if(click_timer.en==1)
{
click_timer.en=0
- if(button02conf.val==1)
+ sys0=confirm.val&2
+ if(sys0>0)
{
confirm.body.txt=button02text.txt
confirm.page_id.val=dp
@@ -527,7 +487,8 @@ Hotspot button03
if(click_timer.en==1)
{
click_timer.en=0
- if(button03conf.val==1)
+ sys0=confirm.val&4
+ if(sys0>0)
{
confirm.body.txt=button03text.txt
confirm.page_id.val=dp
@@ -562,7 +523,8 @@ Hotspot button04
if(click_timer.en==1)
{
click_timer.en=0
- if(button04conf.val==1)
+ sys0=confirm.val&8
+ if(sys0>0)
{
confirm.body.txt=button04text.txt
confirm.page_id.val=dp
@@ -597,7 +559,8 @@ Hotspot button05
if(click_timer.en==1)
{
click_timer.en=0
- if(button05conf.val==1)
+ sys0=confirm.val&16
+ if(sys0>0)
{
confirm.body.txt=button05text.txt
confirm.page_id.val=dp
@@ -632,7 +595,8 @@ Hotspot button06
if(click_timer.en==1)
{
click_timer.en=0
- if(button06conf.val==1)
+ sys0=confirm.val&32
+ if(sys0>0)
{
confirm.body.txt=button06text.txt
confirm.page_id.val=dp
@@ -667,7 +631,8 @@ Hotspot button07
if(click_timer.en==1)
{
click_timer.en=0
- if(button07conf.val==1)
+ sys0=confirm.val&64
+ if(sys0>0)
{
confirm.body.txt=button07text.txt
confirm.page_id.val=dp
@@ -702,7 +667,8 @@ Hotspot button08
if(click_timer.en==1)
{
click_timer.en=0
- if(button08conf.val==1)
+ sys0=confirm.val&128
+ if(sys0>0)
{
confirm.body.txt=button08text.txt
confirm.page_id.val=dp
@@ -753,7 +719,7 @@ Timer click_timer
Timer wakeup_timer
Attributes
- ID : 58
+ ID : 50
Scope : local
Period (ms): 100
Enabled : yes
diff --git a/nspanel_eu_code/buttonpage04.txt b/nspanel_eu_code/buttonpage04.txt
index 3e4c608..549c392 100644
--- a/nspanel_eu_code/buttonpage04.txt
+++ b/nspanel_eu_code/buttonpage04.txt
@@ -63,54 +63,12 @@ Variable (string) page_name
Text : buttonpage04
Max. Text Size: 12
-Variable (int32) button01conf
- Attributes
- ID : 50
- Scope: local
- Value: 0
-
-Variable (int32) button02conf
+Variable (int32) confirm
Attributes
ID : 51
Scope: local
Value: 0
-Variable (int32) button03conf
- Attributes
- ID : 52
- Scope: local
- Value: 0
-
-Variable (int32) button04conf
- Attributes
- ID : 53
- Scope: local
- Value: 0
-
-Variable (int32) button05conf
- Attributes
- ID : 54
- Scope: local
- Value: 0
-
-Variable (int32) button06conf
- Attributes
- ID : 55
- Scope: local
- Value: 0
-
-Variable (int32) button07conf
- Attributes
- ID : 56
- Scope: local
- Value: 0
-
-Variable (int32) button08conf
- Attributes
- ID : 57
- Scope: local
- Value: 0
-
Text button01text
Attributes
ID : 4
@@ -457,7 +415,8 @@ Hotspot button01
if(click_timer.en==1)
{
click_timer.en=0
- if(button01conf.val==1)
+ sys0=confirm.val&1
+ if(sys0>0)
{
confirm.body.txt=button01text.txt
confirm.page_id.val=dp
@@ -492,7 +451,8 @@ Hotspot button02
if(click_timer.en==1)
{
click_timer.en=0
- if(button02conf.val==1)
+ sys0=confirm.val&2
+ if(sys0>0)
{
confirm.body.txt=button02text.txt
confirm.page_id.val=dp
@@ -527,7 +487,8 @@ Hotspot button03
if(click_timer.en==1)
{
click_timer.en=0
- if(button03conf.val==1)
+ sys0=confirm.val&4
+ if(sys0>0)
{
confirm.body.txt=button03text.txt
confirm.page_id.val=dp
@@ -562,7 +523,8 @@ Hotspot button04
if(click_timer.en==1)
{
click_timer.en=0
- if(button04conf.val==1)
+ sys0=confirm.val&8
+ if(sys0>0)
{
confirm.body.txt=button04text.txt
confirm.page_id.val=dp
@@ -597,7 +559,8 @@ Hotspot button05
if(click_timer.en==1)
{
click_timer.en=0
- if(button05conf.val==1)
+ sys0=confirm.val&16
+ if(sys0>0)
{
confirm.body.txt=button05text.txt
confirm.page_id.val=dp
@@ -632,7 +595,8 @@ Hotspot button06
if(click_timer.en==1)
{
click_timer.en=0
- if(button06conf.val==1)
+ sys0=confirm.val&32
+ if(sys0>0)
{
confirm.body.txt=button06text.txt
confirm.page_id.val=dp
@@ -667,7 +631,8 @@ Hotspot button07
if(click_timer.en==1)
{
click_timer.en=0
- if(button07conf.val==1)
+ sys0=confirm.val&64
+ if(sys0>0)
{
confirm.body.txt=button07text.txt
confirm.page_id.val=dp
@@ -702,7 +667,8 @@ Hotspot button08
if(click_timer.en==1)
{
click_timer.en=0
- if(button08conf.val==1)
+ sys0=confirm.val&128
+ if(sys0>0)
{
confirm.body.txt=button08text.txt
confirm.page_id.val=dp
@@ -753,7 +719,7 @@ Timer click_timer
Timer wakeup_timer
Attributes
- ID : 58
+ ID : 50
Scope : local
Period (ms): 100
Enabled : yes
diff --git a/nspanel_eu_code/climate.txt b/nspanel_eu_code/climate.txt
index 6292087..43a7102 100644
--- a/nspanel_eu_code/climate.txt
+++ b/nspanel_eu_code/climate.txt
@@ -120,7 +120,7 @@ Variable (string) back_page
Variable (int32) embedded
Attributes
ID : 46
- Scope: local
+ Scope: global
Value: 0
Variable (string) va2
@@ -147,6 +147,14 @@ Text current_temp
Text :
Max. Text Size : 10
+ Events
+ Touch Press Event
+ printh 91
+ prints "touchevent",0
+ printh 00
+ prints rand,0
+ printh FF FF FF
+
Text page_label
Attributes
ID : 6
@@ -157,6 +165,14 @@ Text page_label
Text :
Max. Text Size : 100
+ Events
+ Touch Press Event
+ printh 91
+ prints "touchevent",0
+ printh 00
+ prints rand,0
+ printh FF FF FF
+
Text current_icon
Attributes
ID : 8
@@ -167,6 +183,14 @@ Text current_icon
Text :
Max. Text Size : 10
+ Events
+ Touch Press Event
+ printh 91
+ prints "touchevent",0
+ printh 00
+ prints rand,0
+ printh FF FF FF
+
Text target_icon
Attributes
ID : 9
@@ -177,6 +201,14 @@ Text target_icon
Text :
Max. Text Size : 10
+ Events
+ Touch Press Event
+ printh 91
+ prints "touchevent",0
+ printh 00
+ prints rand,0
+ printh FF FF FF
+
Text value01_icon
Attributes
ID : 10
@@ -187,6 +219,14 @@ Text value01_icon
Text :
Max. Text Size : 10
+ Events
+ Touch Press Event
+ printh 91
+ prints "touchevent",0
+ printh 00
+ prints rand,0
+ printh FF FF FF
+
Text value01
Attributes
ID : 11
@@ -197,6 +237,14 @@ Text value01
Text :
Max. Text Size : 6
+ Events
+ Touch Press Event
+ printh 91
+ prints "touchevent",0
+ printh 00
+ prints rand,0
+ printh FF FF FF
+
Text value02_icon
Attributes
ID : 12
@@ -207,6 +255,14 @@ Text value02_icon
Text :
Max. Text Size : 10
+ Events
+ Touch Press Event
+ printh 91
+ prints "touchevent",0
+ printh 00
+ prints rand,0
+ printh FF FF FF
+
Text value02
Attributes
ID : 13
@@ -217,6 +273,14 @@ Text value02
Text :
Max. Text Size : 6
+ Events
+ Touch Press Event
+ printh 91
+ prints "touchevent",0
+ printh 00
+ prints rand,0
+ printh FF FF FF
+
Text value03_icon
Attributes
ID : 14
@@ -227,6 +291,14 @@ Text value03_icon
Text :
Max. Text Size : 10
+ Events
+ Touch Press Event
+ printh 91
+ prints "touchevent",0
+ printh 00
+ prints rand,0
+ printh FF FF FF
+
Text value03
Attributes
ID : 15
@@ -237,6 +309,14 @@ Text value03
Text :
Max. Text Size : 6
+ Events
+ Touch Press Event
+ printh 91
+ prints "touchevent",0
+ printh 00
+ prints rand,0
+ printh FF FF FF
+
Text value04_icon
Attributes
ID : 16
@@ -247,6 +327,14 @@ Text value04_icon
Text :
Max. Text Size : 10
+ Events
+ Touch Press Event
+ printh 91
+ prints "touchevent",0
+ printh 00
+ prints rand,0
+ printh FF FF FF
+
Text value04
Attributes
ID : 17
@@ -257,6 +345,14 @@ Text value04
Text :
Max. Text Size : 6
+ Events
+ Touch Press Event
+ printh 91
+ prints "touchevent",0
+ printh 00
+ prints rand,0
+ printh FF FF FF
+
Text button01_icon
Attributes
ID : 18
@@ -357,6 +453,14 @@ Text target_temp
Text :
Max. Text Size : 10
+ Events
+ Touch Press Event
+ printh 91
+ prints "touchevent",0
+ printh 00
+ prints rand,0
+ printh FF FF FF
+
Slider climateslider
Attributes
ID : 7
@@ -428,6 +532,11 @@ Hotspot decrease_temp
Events
Touch Press Event
+ printh 91
+ prints "touchevent",0
+ printh 00
+ prints rand,0
+ printh FF FF FF
if(climateslider.val>0)
{
climateslider.val--
@@ -452,6 +561,11 @@ Hotspot increase_temp
Events
Touch Press Event
+ printh 91
+ prints "touchevent",0
+ printh 00
+ prints rand,0
+ printh FF FF FF
if(climateslider.val0)
{
@@ -145,6 +182,13 @@ Text bt_vol_up
Max. Text Size : 3
Events
+ Touch Press Event
+ printh 91
+ prints "touchevent",0
+ printh 00
+ prints rand,0
+ printh FF FF FF
+
Touch Release Event
if(vol_slider.val<100)
{
@@ -171,6 +215,13 @@ Text bt_mute
Max. Text Size : 3
Events
+ Touch Press Event
+ printh 91
+ prints "touchevent",0
+ printh 00
+ prints rand,0
+ printh FF FF FF
+
Touch Release Event
if(is_muted.val==1)
{
@@ -197,6 +248,21 @@ Text time_current
Text :
Max. Text Size : 10
+ Events
+ Touch Press Event
+ printh 91
+ prints "touchevent",0
+ printh 00
+ prints rand,0
+ printh FF FF FF
+
+ Touch Release Event
+ printh 91
+ prints "touchevent",0
+ printh 00
+ prints rand,0
+ printh FF FF FF
+
Text time_total
Attributes
ID : 12
@@ -207,6 +273,21 @@ Text time_total
Text :
Max. Text Size : 10
+ Events
+ Touch Press Event
+ printh 91
+ prints "touchevent",0
+ printh 00
+ prints rand,0
+ printh FF FF FF
+
+ Touch Release Event
+ printh 91
+ prints "touchevent",0
+ printh 00
+ prints rand,0
+ printh FF FF FF
+
Text track
Attributes
ID : 13
@@ -217,6 +298,21 @@ Text track
Text :
Max. Text Size : 50
+ Events
+ Touch Press Event
+ printh 91
+ prints "touchevent",0
+ printh 00
+ prints rand,0
+ printh FF FF FF
+
+ Touch Release Event
+ printh 91
+ prints "touchevent",0
+ printh 00
+ prints rand,0
+ printh FF FF FF
+
Text artist
Attributes
ID : 14
@@ -227,6 +323,21 @@ Text artist
Text :
Max. Text Size : 50
+ Events
+ Touch Press Event
+ printh 91
+ prints "touchevent",0
+ printh 00
+ prints rand,0
+ printh FF FF FF
+
+ Touch Release Event
+ printh 91
+ prints "touchevent",0
+ printh 00
+ prints rand,0
+ printh FF FF FF
+
Text bt_prev
Attributes
ID : 15
@@ -238,6 +349,13 @@ Text bt_prev
Max. Text Size : 10
Events
+ Touch Press Event
+ printh 91
+ prints "touchevent",0
+ printh 00
+ prints rand,0
+ printh FF FF FF
+
Touch Release Event
lastclick.txt="{\"page\": \"media_player\", \"key\": \"media_previous_track\"}"
printh 92
@@ -258,6 +376,13 @@ Text bt_play_pause
Max. Text Size : 10
Events
+ Touch Press Event
+ printh 91
+ prints "touchevent",0
+ printh 00
+ prints rand,0
+ printh FF FF FF
+
Touch Release Event
printh 92
prints "localevent",0
@@ -266,7 +391,7 @@ Text bt_play_pause
printh 00
printh FF FF FF
-Text bt_stop
+Text bt_next
Attributes
ID : 17
Scope : local
@@ -277,25 +402,13 @@ Text bt_stop
Max. Text Size : 10
Events
- Touch Release Event
- printh 92
- prints "localevent",0
- printh 00
- prints "{\"page\": \"media_player\", \"key\": \"media_stop\"}",0
+ Touch Press Event
+ printh 91
+ prints "touchevent",0
printh 00
+ prints rand,0
printh FF FF FF
-Text bt_next
- Attributes
- ID : 18
- Scope : local
- Dragging : 0
- Send Component ID : disabled
- Associated Keyboard: none
- Text :
- Max. Text Size : 10
-
- Events
Touch Release Event
printh 92
prints "localevent",0
@@ -306,7 +419,7 @@ Text bt_next
Text bt_on_off
Attributes
- ID : 19
+ ID : 18
Scope : local
Dragging : 0
Send Component ID : disabled
@@ -315,6 +428,13 @@ Text bt_on_off
Max. Text Size : 10
Events
+ Touch Press Event
+ printh 91
+ prints "touchevent",0
+ printh 00
+ prints rand,0
+ printh FF FF FF
+
Touch Release Event
printh 92
prints "localevent",0
@@ -331,6 +451,21 @@ Progress Bar time_progress
Send Component ID: disabled
Value : 0
+ Events
+ Touch Press Event
+ printh 91
+ prints "touchevent",0
+ printh 00
+ prints rand,0
+ printh FF FF FF
+
+ Touch Release Event
+ printh 91
+ prints "touchevent",0
+ printh 00
+ prints rand,0
+ printh FF FF FF
+
Slider vol_slider
Attributes
ID : 5
@@ -342,6 +477,13 @@ Slider vol_slider
Lower range limit: 0
Events
+ Touch Press Event
+ printh 91
+ prints "touchevent",0
+ printh 00
+ prints rand,0
+ printh FF FF FF
+
Touch Release Event
covx vol_slider.val,va0.txt,0,0
vol_text.txt=va0.txt+"%"
@@ -383,7 +525,7 @@ Button button_back
Timer wakeup_timer
Attributes
- ID : 21
+ ID : 20
Scope : local
Period (ms): 100
Enabled : yes
@@ -406,7 +548,7 @@ Timer wakeup_timer
Timer timer0
Attributes
- ID : 22
+ ID : 21
Scope : local
Period (ms): 1000
Enabled : no
@@ -426,7 +568,7 @@ Timer timer0
Timer prg_timer
Attributes
- ID : 25
+ ID : 24
Scope : local
Period (ms): 1000
Enabled : no
diff --git a/nspanel_eu_code/power.page b/nspanel_eu_code/power.page
new file mode 100644
index 0000000..d15ea6a
Binary files /dev/null and b/nspanel_eu_code/power.page differ
diff --git a/nspanel_eu_code/power.txt b/nspanel_eu_code/power.txt
new file mode 100644
index 0000000..e69de29
diff --git a/nspanel_eu_code/screensaver.txt b/nspanel_eu_code/screensaver.txt
index d53450d..49e829d 100644
--- a/nspanel_eu_code/screensaver.txt
+++ b/nspanel_eu_code/screensaver.txt
@@ -26,7 +26,7 @@ Page screensaver
Variable (int32) orign
Attributes
ID : 2
- Scope: global
+ Scope: local
Value: 0
TouchCap wakeup
diff --git a/nspanel_eu_code/settings.txt b/nspanel_eu_code/settings.txt
index 6c82859..f45ba51 100644
--- a/nspanel_eu_code/settings.txt
+++ b/nspanel_eu_code/settings.txt
@@ -22,6 +22,8 @@ Page settings
prints "{\"page\": \"settings\", \"component\": \"currentpage\", \"value\": \"pagechange\"}",0
printh 00
printh FF FF FF
+ vis lbl_sleep,0
+ vis bt_sleep,0
Touch Press Event
printh 91
diff --git a/nspanel_us.HMI b/nspanel_us.HMI
index 10fe45b..ab6b62f 100644
Binary files a/nspanel_us.HMI and b/nspanel_us.HMI differ
diff --git a/nspanel_us.tft b/nspanel_us.tft
index 0f4e694..3841f64 100644
Binary files a/nspanel_us.tft and b/nspanel_us.tft differ
diff --git a/nspanel_us_code/Program.s.txt b/nspanel_us_code/Program.s.txt
index fbee574..52a40de 100644
--- a/nspanel_us_code/Program.s.txt
+++ b/nspanel_us_code/Program.s.txt
@@ -6,7 +6,6 @@ Program.s
int p=0,q=0,t=0,f=0
int dimdelta=0
int api=0 // 0 = disconnected from HA, 1 = connected to HA
- int sleep_mode=0
int is_alarm=0,is_entities=0,is_qrcode=0,is_notification=0
int brightness=100,brightness_dim=40
int display_mode=2 // 1 = EU, 2 = US, 3 = US landscape
diff --git a/nspanel_us_code/buttonpage01.txt b/nspanel_us_code/buttonpage01.txt
index c4e36a2..8fae1a1 100644
--- a/nspanel_us_code/buttonpage01.txt
+++ b/nspanel_us_code/buttonpage01.txt
@@ -63,54 +63,12 @@ Variable (string) page_name
Text : buttonpage01
Max. Text Size: 12
-Variable (int32) button01conf
- Attributes
- ID : 50
- Scope: local
- Value: 0
-
-Variable (int32) button02conf
+Variable (int32) confirm
Attributes
ID : 51
Scope: local
Value: 0
-Variable (int32) button03conf
- Attributes
- ID : 52
- Scope: local
- Value: 0
-
-Variable (int32) button04conf
- Attributes
- ID : 53
- Scope: local
- Value: 0
-
-Variable (int32) button05conf
- Attributes
- ID : 54
- Scope: local
- Value: 0
-
-Variable (int32) button06conf
- Attributes
- ID : 55
- Scope: local
- Value: 0
-
-Variable (int32) button07conf
- Attributes
- ID : 56
- Scope: local
- Value: 0
-
-Variable (int32) button08conf
- Attributes
- ID : 57
- Scope: local
- Value: 0
-
Text button01text
Attributes
ID : 4
@@ -457,7 +415,8 @@ Hotspot button01
if(click_timer.en==1)
{
click_timer.en=0
- if(button01conf.val==1)
+ sys0=confirm.val&1
+ if(sys0>0)
{
confirm.body.txt=button01text.txt
confirm.page_id.val=dp
@@ -492,7 +451,8 @@ Hotspot button02
if(click_timer.en==1)
{
click_timer.en=0
- if(button02conf.val==1)
+ sys0=confirm.val&2
+ if(sys0>0)
{
confirm.body.txt=button02text.txt
confirm.page_id.val=dp
@@ -527,7 +487,8 @@ Hotspot button03
if(click_timer.en==1)
{
click_timer.en=0
- if(button03conf.val==1)
+ sys0=confirm.val&4
+ if(sys0>0)
{
confirm.body.txt=button03text.txt
confirm.page_id.val=dp
@@ -562,7 +523,8 @@ Hotspot button04
if(click_timer.en==1)
{
click_timer.en=0
- if(button04conf.val==1)
+ sys0=confirm.val&8
+ if(sys0>0)
{
confirm.body.txt=button04text.txt
confirm.page_id.val=dp
@@ -597,7 +559,8 @@ Hotspot button05
if(click_timer.en==1)
{
click_timer.en=0
- if(button05conf.val==1)
+ sys0=confirm.val&16
+ if(sys0>0)
{
confirm.body.txt=button05text.txt
confirm.page_id.val=dp
@@ -632,7 +595,8 @@ Hotspot button06
if(click_timer.en==1)
{
click_timer.en=0
- if(button06conf.val==1)
+ sys0=confirm.val&32
+ if(sys0>0)
{
confirm.body.txt=button06text.txt
confirm.page_id.val=dp
@@ -667,7 +631,8 @@ Hotspot button07
if(click_timer.en==1)
{
click_timer.en=0
- if(button07conf.val==1)
+ sys0=confirm.val&64
+ if(sys0>0)
{
confirm.body.txt=button07text.txt
confirm.page_id.val=dp
@@ -702,7 +667,8 @@ Hotspot button08
if(click_timer.en==1)
{
click_timer.en=0
- if(button08conf.val==1)
+ sys0=confirm.val&128
+ if(sys0>0)
{
confirm.body.txt=button08text.txt
confirm.page_id.val=dp
@@ -753,7 +719,7 @@ Timer click_timer
Timer wakeup_timer
Attributes
- ID : 58
+ ID : 50
Scope : local
Period (ms): 100
Enabled : yes
diff --git a/nspanel_us_code/buttonpage02.txt b/nspanel_us_code/buttonpage02.txt
index f9e152d..45caef4 100644
--- a/nspanel_us_code/buttonpage02.txt
+++ b/nspanel_us_code/buttonpage02.txt
@@ -63,54 +63,12 @@ Variable (string) page_name
Text : buttonpage02
Max. Text Size: 12
-Variable (int32) button01conf
- Attributes
- ID : 50
- Scope: local
- Value: 0
-
-Variable (int32) button02conf
+Variable (int32) confirm
Attributes
ID : 51
Scope: local
Value: 0
-Variable (int32) button03conf
- Attributes
- ID : 52
- Scope: local
- Value: 0
-
-Variable (int32) button04conf
- Attributes
- ID : 53
- Scope: local
- Value: 0
-
-Variable (int32) button05conf
- Attributes
- ID : 54
- Scope: local
- Value: 0
-
-Variable (int32) button06conf
- Attributes
- ID : 55
- Scope: local
- Value: 0
-
-Variable (int32) button07conf
- Attributes
- ID : 56
- Scope: local
- Value: 0
-
-Variable (int32) button08conf
- Attributes
- ID : 57
- Scope: local
- Value: 0
-
Text button01text
Attributes
ID : 4
@@ -457,7 +415,8 @@ Hotspot button01
if(click_timer.en==1)
{
click_timer.en=0
- if(button01conf.val==1)
+ sys0=confirm.val&1
+ if(sys0>0)
{
confirm.body.txt=button01text.txt
confirm.page_id.val=dp
@@ -492,7 +451,8 @@ Hotspot button02
if(click_timer.en==1)
{
click_timer.en=0
- if(button02conf.val==1)
+ sys0=confirm.val&2
+ if(sys0>0)
{
confirm.body.txt=button02text.txt
confirm.page_id.val=dp
@@ -527,7 +487,8 @@ Hotspot button03
if(click_timer.en==1)
{
click_timer.en=0
- if(button03conf.val==1)
+ sys0=confirm.val&4
+ if(sys0>0)
{
confirm.body.txt=button03text.txt
confirm.page_id.val=dp
@@ -562,7 +523,8 @@ Hotspot button04
if(click_timer.en==1)
{
click_timer.en=0
- if(button04conf.val==1)
+ sys0=confirm.val&8
+ if(sys0>0)
{
confirm.body.txt=button04text.txt
confirm.page_id.val=dp
@@ -597,7 +559,8 @@ Hotspot button05
if(click_timer.en==1)
{
click_timer.en=0
- if(button05conf.val==1)
+ sys0=confirm.val&16
+ if(sys0>0)
{
confirm.body.txt=button05text.txt
confirm.page_id.val=dp
@@ -632,7 +595,8 @@ Hotspot button06
if(click_timer.en==1)
{
click_timer.en=0
- if(button06conf.val==1)
+ sys0=confirm.val&32
+ if(sys0>0)
{
confirm.body.txt=button06text.txt
confirm.page_id.val=dp
@@ -667,7 +631,8 @@ Hotspot button07
if(click_timer.en==1)
{
click_timer.en=0
- if(button07conf.val==1)
+ sys0=confirm.val&64
+ if(sys0>0)
{
confirm.body.txt=button07text.txt
confirm.page_id.val=dp
@@ -702,7 +667,8 @@ Hotspot button08
if(click_timer.en==1)
{
click_timer.en=0
- if(button08conf.val==1)
+ sys0=confirm.val&128
+ if(sys0>0)
{
confirm.body.txt=button08text.txt
confirm.page_id.val=dp
@@ -753,7 +719,7 @@ Timer click_timer
Timer wakeup_timer
Attributes
- ID : 58
+ ID : 50
Scope : local
Period (ms): 100
Enabled : yes
diff --git a/nspanel_us_code/buttonpage03.txt b/nspanel_us_code/buttonpage03.txt
index b0dbb68..1e7a3d4 100644
--- a/nspanel_us_code/buttonpage03.txt
+++ b/nspanel_us_code/buttonpage03.txt
@@ -63,54 +63,12 @@ Variable (string) page_name
Text : buttonpage03
Max. Text Size: 12
-Variable (int32) button01conf
- Attributes
- ID : 50
- Scope: local
- Value: 0
-
-Variable (int32) button02conf
+Variable (int32) confirm
Attributes
ID : 51
Scope: local
Value: 0
-Variable (int32) button03conf
- Attributes
- ID : 52
- Scope: local
- Value: 0
-
-Variable (int32) button04conf
- Attributes
- ID : 53
- Scope: local
- Value: 0
-
-Variable (int32) button05conf
- Attributes
- ID : 54
- Scope: local
- Value: 0
-
-Variable (int32) button06conf
- Attributes
- ID : 55
- Scope: local
- Value: 0
-
-Variable (int32) button07conf
- Attributes
- ID : 56
- Scope: local
- Value: 0
-
-Variable (int32) button08conf
- Attributes
- ID : 57
- Scope: local
- Value: 0
-
Text button01text
Attributes
ID : 4
@@ -457,7 +415,8 @@ Hotspot button01
if(click_timer.en==1)
{
click_timer.en=0
- if(button01conf.val==1)
+ sys0=confirm.val&1
+ if(sys0>0)
{
confirm.body.txt=button01text.txt
confirm.page_id.val=dp
@@ -492,7 +451,8 @@ Hotspot button02
if(click_timer.en==1)
{
click_timer.en=0
- if(button02conf.val==1)
+ sys0=confirm.val&2
+ if(sys0>0)
{
confirm.body.txt=button02text.txt
confirm.page_id.val=dp
@@ -527,7 +487,8 @@ Hotspot button03
if(click_timer.en==1)
{
click_timer.en=0
- if(button03conf.val==1)
+ sys0=confirm.val&4
+ if(sys0>0)
{
confirm.body.txt=button03text.txt
confirm.page_id.val=dp
@@ -562,7 +523,8 @@ Hotspot button04
if(click_timer.en==1)
{
click_timer.en=0
- if(button04conf.val==1)
+ sys0=confirm.val&8
+ if(sys0>0)
{
confirm.body.txt=button04text.txt
confirm.page_id.val=dp
@@ -597,7 +559,8 @@ Hotspot button05
if(click_timer.en==1)
{
click_timer.en=0
- if(button05conf.val==1)
+ sys0=confirm.val&16
+ if(sys0>0)
{
confirm.body.txt=button05text.txt
confirm.page_id.val=dp
@@ -632,7 +595,8 @@ Hotspot button06
if(click_timer.en==1)
{
click_timer.en=0
- if(button06conf.val==1)
+ sys0=confirm.val&32
+ if(sys0>0)
{
confirm.body.txt=button06text.txt
confirm.page_id.val=dp
@@ -667,7 +631,8 @@ Hotspot button07
if(click_timer.en==1)
{
click_timer.en=0
- if(button07conf.val==1)
+ sys0=confirm.val&64
+ if(sys0>0)
{
confirm.body.txt=button07text.txt
confirm.page_id.val=dp
@@ -702,7 +667,8 @@ Hotspot button08
if(click_timer.en==1)
{
click_timer.en=0
- if(button08conf.val==1)
+ sys0=confirm.val&128
+ if(sys0>0)
{
confirm.body.txt=button08text.txt
confirm.page_id.val=dp
@@ -753,7 +719,7 @@ Timer click_timer
Timer wakeup_timer
Attributes
- ID : 58
+ ID : 50
Scope : local
Period (ms): 100
Enabled : yes
diff --git a/nspanel_us_code/buttonpage04.txt b/nspanel_us_code/buttonpage04.txt
index f34210d..362b803 100644
--- a/nspanel_us_code/buttonpage04.txt
+++ b/nspanel_us_code/buttonpage04.txt
@@ -63,54 +63,12 @@ Variable (string) page_name
Text : buttonpage04
Max. Text Size: 12
-Variable (int32) button01conf
- Attributes
- ID : 50
- Scope: local
- Value: 0
-
-Variable (int32) button02conf
+Variable (int32) confirm
Attributes
ID : 51
Scope: local
Value: 0
-Variable (int32) button03conf
- Attributes
- ID : 52
- Scope: local
- Value: 0
-
-Variable (int32) button04conf
- Attributes
- ID : 53
- Scope: local
- Value: 0
-
-Variable (int32) button05conf
- Attributes
- ID : 54
- Scope: local
- Value: 0
-
-Variable (int32) button06conf
- Attributes
- ID : 55
- Scope: local
- Value: 0
-
-Variable (int32) button07conf
- Attributes
- ID : 56
- Scope: local
- Value: 0
-
-Variable (int32) button08conf
- Attributes
- ID : 57
- Scope: local
- Value: 0
-
Text button01text
Attributes
ID : 4
@@ -457,7 +415,8 @@ Hotspot button01
if(click_timer.en==1)
{
click_timer.en=0
- if(button01conf.val==1)
+ sys0=confirm.val&1
+ if(sys0>0)
{
confirm.body.txt=button01text.txt
confirm.page_id.val=dp
@@ -492,7 +451,8 @@ Hotspot button02
if(click_timer.en==1)
{
click_timer.en=0
- if(button02conf.val==1)
+ sys0=confirm.val&2
+ if(sys0>0)
{
confirm.body.txt=button02text.txt
confirm.page_id.val=dp
@@ -527,7 +487,8 @@ Hotspot button03
if(click_timer.en==1)
{
click_timer.en=0
- if(button03conf.val==1)
+ sys0=confirm.val&4
+ if(sys0>0)
{
confirm.body.txt=button03text.txt
confirm.page_id.val=dp
@@ -562,7 +523,8 @@ Hotspot button04
if(click_timer.en==1)
{
click_timer.en=0
- if(button04conf.val==1)
+ sys0=confirm.val&8
+ if(sys0>0)
{
confirm.body.txt=button04text.txt
confirm.page_id.val=dp
@@ -597,7 +559,8 @@ Hotspot button05
if(click_timer.en==1)
{
click_timer.en=0
- if(button05conf.val==1)
+ sys0=confirm.val&16
+ if(sys0>0)
{
confirm.body.txt=button05text.txt
confirm.page_id.val=dp
@@ -632,7 +595,8 @@ Hotspot button06
if(click_timer.en==1)
{
click_timer.en=0
- if(button06conf.val==1)
+ sys0=confirm.val&32
+ if(sys0>0)
{
confirm.body.txt=button06text.txt
confirm.page_id.val=dp
@@ -667,7 +631,8 @@ Hotspot button07
if(click_timer.en==1)
{
click_timer.en=0
- if(button07conf.val==1)
+ sys0=confirm.val&64
+ if(sys0>0)
{
confirm.body.txt=button07text.txt
confirm.page_id.val=dp
@@ -702,7 +667,8 @@ Hotspot button08
if(click_timer.en==1)
{
click_timer.en=0
- if(button08conf.val==1)
+ sys0=confirm.val&128
+ if(sys0>0)
{
confirm.body.txt=button08text.txt
confirm.page_id.val=dp
@@ -753,7 +719,7 @@ Timer click_timer
Timer wakeup_timer
Attributes
- ID : 58
+ ID : 50
Scope : local
Period (ms): 100
Enabled : yes
diff --git a/nspanel_us_code/climate.txt b/nspanel_us_code/climate.txt
index 829391b..56cf2d7 100644
--- a/nspanel_us_code/climate.txt
+++ b/nspanel_us_code/climate.txt
@@ -120,7 +120,7 @@ Variable (string) back_page
Variable (int32) embedded
Attributes
ID : 46
- Scope: local
+ Scope: global
Value: 0
Variable (string) va2
@@ -147,6 +147,14 @@ Text current_temp
Text :
Max. Text Size : 10
+ Events
+ Touch Press Event
+ printh 91
+ prints "touchevent",0
+ printh 00
+ prints rand,0
+ printh FF FF FF
+
Text page_label
Attributes
ID : 6
@@ -157,6 +165,14 @@ Text page_label
Text :
Max. Text Size : 100
+ Events
+ Touch Press Event
+ printh 91
+ prints "touchevent",0
+ printh 00
+ prints rand,0
+ printh FF FF FF
+
Text current_icon
Attributes
ID : 8
@@ -167,6 +183,14 @@ Text current_icon
Text :
Max. Text Size : 10
+ Events
+ Touch Press Event
+ printh 91
+ prints "touchevent",0
+ printh 00
+ prints rand,0
+ printh FF FF FF
+
Text target_icon
Attributes
ID : 9
@@ -177,6 +201,14 @@ Text target_icon
Text :
Max. Text Size : 10
+ Events
+ Touch Press Event
+ printh 91
+ prints "touchevent",0
+ printh 00
+ prints rand,0
+ printh FF FF FF
+
Text value01_icon
Attributes
ID : 10
@@ -187,6 +219,14 @@ Text value01_icon
Text :
Max. Text Size : 10
+ Events
+ Touch Press Event
+ printh 91
+ prints "touchevent",0
+ printh 00
+ prints rand,0
+ printh FF FF FF
+
Text value01
Attributes
ID : 11
@@ -197,6 +237,14 @@ Text value01
Text :
Max. Text Size : 6
+ Events
+ Touch Press Event
+ printh 91
+ prints "touchevent",0
+ printh 00
+ prints rand,0
+ printh FF FF FF
+
Text value02_icon
Attributes
ID : 12
@@ -207,6 +255,14 @@ Text value02_icon
Text :
Max. Text Size : 10
+ Events
+ Touch Press Event
+ printh 91
+ prints "touchevent",0
+ printh 00
+ prints rand,0
+ printh FF FF FF
+
Text value02
Attributes
ID : 13
@@ -217,6 +273,14 @@ Text value02
Text :
Max. Text Size : 6
+ Events
+ Touch Press Event
+ printh 91
+ prints "touchevent",0
+ printh 00
+ prints rand,0
+ printh FF FF FF
+
Text value03_icon
Attributes
ID : 14
@@ -227,6 +291,14 @@ Text value03_icon
Text :
Max. Text Size : 10
+ Events
+ Touch Press Event
+ printh 91
+ prints "touchevent",0
+ printh 00
+ prints rand,0
+ printh FF FF FF
+
Text value03
Attributes
ID : 15
@@ -237,6 +309,14 @@ Text value03
Text :
Max. Text Size : 6
+ Events
+ Touch Press Event
+ printh 91
+ prints "touchevent",0
+ printh 00
+ prints rand,0
+ printh FF FF FF
+
Text value04_icon
Attributes
ID : 16
@@ -247,6 +327,14 @@ Text value04_icon
Text :
Max. Text Size : 10
+ Events
+ Touch Press Event
+ printh 91
+ prints "touchevent",0
+ printh 00
+ prints rand,0
+ printh FF FF FF
+
Text value04
Attributes
ID : 17
@@ -257,6 +345,14 @@ Text value04
Text :
Max. Text Size : 6
+ Events
+ Touch Press Event
+ printh 91
+ prints "touchevent",0
+ printh 00
+ prints rand,0
+ printh FF FF FF
+
Text button01_icon
Attributes
ID : 18
@@ -357,6 +453,14 @@ Text target_temp
Text :
Max. Text Size : 10
+ Events
+ Touch Press Event
+ printh 91
+ prints "touchevent",0
+ printh 00
+ prints rand,0
+ printh FF FF FF
+
Slider climateslider
Attributes
ID : 7
@@ -402,6 +506,11 @@ Button button_back
Events
Touch Press Event
+ printh 91
+ prints "touchevent",0
+ printh 00
+ prints rand,0
+ printh FF FF FF
if(back_page.txt=="buttonpage01")
{
page buttonpage01
@@ -428,6 +537,11 @@ Hotspot decrease_temp
Events
Touch Press Event
+ printh 91
+ prints "touchevent",0
+ printh 00
+ prints rand,0
+ printh FF FF FF
if(climateslider.val>0)
{
climateslider.val--
@@ -452,6 +566,11 @@ Hotspot increase_temp
Events
Touch Press Event
+ printh 91
+ prints "touchevent",0
+ printh 00
+ prints rand,0
+ printh FF FF FF
if(climateslider.val0)
{
@@ -145,6 +182,13 @@ Text bt_vol_up
Max. Text Size : 3
Events
+ Touch Press Event
+ printh 91
+ prints "touchevent",0
+ printh 00
+ prints rand,0
+ printh FF FF FF
+
Touch Release Event
if(vol_slider.val<100)
{
@@ -171,6 +215,13 @@ Text bt_mute
Max. Text Size : 3
Events
+ Touch Press Event
+ printh 91
+ prints "touchevent",0
+ printh 00
+ prints rand,0
+ printh FF FF FF
+
Touch Release Event
if(is_muted.val==1)
{
@@ -197,6 +248,21 @@ Text time_current
Text :
Max. Text Size : 10
+ Events
+ Touch Press Event
+ printh 91
+ prints "touchevent",0
+ printh 00
+ prints rand,0
+ printh FF FF FF
+
+ Touch Release Event
+ printh 91
+ prints "touchevent",0
+ printh 00
+ prints rand,0
+ printh FF FF FF
+
Text time_total
Attributes
ID : 12
@@ -207,6 +273,21 @@ Text time_total
Text :
Max. Text Size : 10
+ Events
+ Touch Press Event
+ printh 91
+ prints "touchevent",0
+ printh 00
+ prints rand,0
+ printh FF FF FF
+
+ Touch Release Event
+ printh 91
+ prints "touchevent",0
+ printh 00
+ prints rand,0
+ printh FF FF FF
+
Text track
Attributes
ID : 13
@@ -217,6 +298,21 @@ Text track
Text :
Max. Text Size : 50
+ Events
+ Touch Press Event
+ printh 91
+ prints "touchevent",0
+ printh 00
+ prints rand,0
+ printh FF FF FF
+
+ Touch Release Event
+ printh 91
+ prints "touchevent",0
+ printh 00
+ prints rand,0
+ printh FF FF FF
+
Text artist
Attributes
ID : 14
@@ -227,6 +323,21 @@ Text artist
Text :
Max. Text Size : 50
+ Events
+ Touch Press Event
+ printh 91
+ prints "touchevent",0
+ printh 00
+ prints rand,0
+ printh FF FF FF
+
+ Touch Release Event
+ printh 91
+ prints "touchevent",0
+ printh 00
+ prints rand,0
+ printh FF FF FF
+
Text bt_prev
Attributes
ID : 15
@@ -238,6 +349,13 @@ Text bt_prev
Max. Text Size : 10
Events
+ Touch Press Event
+ printh 91
+ prints "touchevent",0
+ printh 00
+ prints rand,0
+ printh FF FF FF
+
Touch Release Event
printh 92
prints "localevent",0
@@ -257,6 +375,13 @@ Text bt_play_pause
Max. Text Size : 10
Events
+ Touch Press Event
+ printh 91
+ prints "touchevent",0
+ printh 00
+ prints rand,0
+ printh FF FF FF
+
Touch Release Event
printh 92
prints "localevent",0
@@ -265,7 +390,7 @@ Text bt_play_pause
printh 00
printh FF FF FF
-Text bt_stop
+Text bt_next
Attributes
ID : 17
Scope : local
@@ -276,25 +401,13 @@ Text bt_stop
Max. Text Size : 10
Events
- Touch Release Event
- printh 92
- prints "localevent",0
- printh 00
- prints "{\"page\": \"media_player\", \"key\": \"media_stop\"}",0
+ Touch Press Event
+ printh 91
+ prints "touchevent",0
printh 00
+ prints rand,0
printh FF FF FF
-Text bt_next
- Attributes
- ID : 18
- Scope : local
- Dragging : 0
- Send Component ID : disabled
- Associated Keyboard: none
- Text :
- Max. Text Size : 10
-
- Events
Touch Release Event
printh 92
prints "localevent",0
@@ -305,7 +418,7 @@ Text bt_next
Text bt_on_off
Attributes
- ID : 19
+ ID : 18
Scope : local
Dragging : 0
Send Component ID : disabled
@@ -314,6 +427,13 @@ Text bt_on_off
Max. Text Size : 10
Events
+ Touch Press Event
+ printh 91
+ prints "touchevent",0
+ printh 00
+ prints rand,0
+ printh FF FF FF
+
Touch Release Event
printh 92
prints "localevent",0
@@ -330,6 +450,21 @@ Progress Bar time_progress
Send Component ID: disabled
Value : 0
+ Events
+ Touch Press Event
+ printh 91
+ prints "touchevent",0
+ printh 00
+ prints rand,0
+ printh FF FF FF
+
+ Touch Release Event
+ printh 91
+ prints "touchevent",0
+ printh 00
+ prints rand,0
+ printh FF FF FF
+
Slider vol_slider
Attributes
ID : 5
@@ -341,6 +476,13 @@ Slider vol_slider
Lower range limit: 0
Events
+ Touch Press Event
+ printh 91
+ prints "touchevent",0
+ printh 00
+ prints rand,0
+ printh FF FF FF
+
Touch Release Event
covx vol_slider.val,va0.txt,0,0
vol_text.txt=va0.txt+"%"
@@ -382,7 +524,7 @@ Button button_back
Timer wakeup_timer
Attributes
- ID : 21
+ ID : 20
Scope : local
Period (ms): 100
Enabled : yes
@@ -405,7 +547,7 @@ Timer wakeup_timer
Timer timer0
Attributes
- ID : 22
+ ID : 21
Scope : local
Period (ms): 1000
Enabled : no
@@ -425,7 +567,7 @@ Timer timer0
Timer prg_timer
Attributes
- ID : 25
+ ID : 24
Scope : local
Period (ms): 1000
Enabled : no
diff --git a/nspanel_us_code/screensaver.txt b/nspanel_us_code/screensaver.txt
index d53450d..49e829d 100644
--- a/nspanel_us_code/screensaver.txt
+++ b/nspanel_us_code/screensaver.txt
@@ -26,7 +26,7 @@ Page screensaver
Variable (int32) orign
Attributes
ID : 2
- Scope: global
+ Scope: local
Value: 0
TouchCap wakeup
diff --git a/nspanel_us_code/settings.txt b/nspanel_us_code/settings.txt
index baa0c25..f610ccb 100644
--- a/nspanel_us_code/settings.txt
+++ b/nspanel_us_code/settings.txt
@@ -22,6 +22,8 @@ Page settings
prints "{\"page\": \"settings\", \"component\": \"currentpage\", \"value\": \"pagechange\"}",0
printh 00
printh FF FF FF
+ vis lbl_sleep,0
+ vis bt_sleep,0
Touch Press Event
printh 91
diff --git a/nspanel_us_land.HMI b/nspanel_us_land.HMI
index deef0e9..8045413 100644
Binary files a/nspanel_us_land.HMI and b/nspanel_us_land.HMI differ
diff --git a/nspanel_us_land.tft b/nspanel_us_land.tft
index 42e12ab..7646b7f 100644
Binary files a/nspanel_us_land.tft and b/nspanel_us_land.tft differ
diff --git a/nspanel_us_land_code/Program.s.txt b/nspanel_us_land_code/Program.s.txt
index 9bed1b0..0a45324 100644
--- a/nspanel_us_land_code/Program.s.txt
+++ b/nspanel_us_land_code/Program.s.txt
@@ -6,7 +6,6 @@ Program.s
int p=0,q=0,t=0,f=0
int dimdelta=0
int api=0 // 0 = disconnected from HA, 1 = connected to HA
- int sleep_mode=0
int is_alarm=0,is_entities=0,is_qrcode=0,is_notification=0
int brightness=100,brightness_dim=40
int display_mode=3 // 1 = EU, 2 = US, 3 = US landscape
diff --git a/nspanel_us_land_code/buttonpage01.txt b/nspanel_us_land_code/buttonpage01.txt
index ed156b5..5066361 100644
--- a/nspanel_us_land_code/buttonpage01.txt
+++ b/nspanel_us_land_code/buttonpage01.txt
@@ -63,54 +63,12 @@ Variable (string) page_name
Text : buttonpage01
Max. Text Size: 12
-Variable (int32) button01conf
- Attributes
- ID : 50
- Scope: local
- Value: 0
-
-Variable (int32) button02conf
+Variable (int32) confirm
Attributes
ID : 51
Scope: local
Value: 0
-Variable (int32) button03conf
- Attributes
- ID : 52
- Scope: local
- Value: 0
-
-Variable (int32) button04conf
- Attributes
- ID : 53
- Scope: local
- Value: 0
-
-Variable (int32) button05conf
- Attributes
- ID : 54
- Scope: local
- Value: 0
-
-Variable (int32) button06conf
- Attributes
- ID : 55
- Scope: local
- Value: 0
-
-Variable (int32) button07conf
- Attributes
- ID : 56
- Scope: local
- Value: 0
-
-Variable (int32) button08conf
- Attributes
- ID : 57
- Scope: local
- Value: 0
-
Text button01text
Attributes
ID : 4
@@ -457,7 +415,8 @@ Hotspot button01
if(click_timer.en==1)
{
click_timer.en=0
- if(button01conf.val==1)
+ sys0=confirm.val&1
+ if(sys0>0)
{
confirm.body.txt=button01text.txt
confirm.page_id.val=dp
@@ -492,7 +451,8 @@ Hotspot button02
if(click_timer.en==1)
{
click_timer.en=0
- if(button02conf.val==1)
+ sys0=confirm.val&2
+ if(sys0>0)
{
confirm.body.txt=button02text.txt
confirm.page_id.val=dp
@@ -527,7 +487,8 @@ Hotspot button03
if(click_timer.en==1)
{
click_timer.en=0
- if(button03conf.val==1)
+ sys0=confirm.val&4
+ if(sys0>0)
{
confirm.body.txt=button03text.txt
confirm.page_id.val=dp
@@ -562,7 +523,8 @@ Hotspot button04
if(click_timer.en==1)
{
click_timer.en=0
- if(button04conf.val==1)
+ sys0=confirm.val&8
+ if(sys0>0)
{
confirm.body.txt=button04text.txt
confirm.page_id.val=dp
@@ -597,7 +559,8 @@ Hotspot button05
if(click_timer.en==1)
{
click_timer.en=0
- if(button05conf.val==1)
+ sys0=confirm.val&16
+ if(sys0>0)
{
confirm.body.txt=button05text.txt
confirm.page_id.val=dp
@@ -632,7 +595,8 @@ Hotspot button06
if(click_timer.en==1)
{
click_timer.en=0
- if(button06conf.val==1)
+ sys0=confirm.val&32
+ if(sys0>0)
{
confirm.body.txt=button06text.txt
confirm.page_id.val=dp
@@ -667,7 +631,8 @@ Hotspot button07
if(click_timer.en==1)
{
click_timer.en=0
- if(button07conf.val==1)
+ sys0=confirm.val&64
+ if(sys0>0)
{
confirm.body.txt=button07text.txt
confirm.page_id.val=dp
@@ -702,7 +667,8 @@ Hotspot button08
if(click_timer.en==1)
{
click_timer.en=0
- if(button08conf.val==1)
+ sys0=confirm.val&128
+ if(sys0>0)
{
confirm.body.txt=button08text.txt
confirm.page_id.val=dp
@@ -753,7 +719,7 @@ Timer click_timer
Timer wakeup_timer
Attributes
- ID : 58
+ ID : 50
Scope : local
Period (ms): 100
Enabled : yes
diff --git a/nspanel_us_land_code/buttonpage02.txt b/nspanel_us_land_code/buttonpage02.txt
index d23037b..f651ef6 100644
--- a/nspanel_us_land_code/buttonpage02.txt
+++ b/nspanel_us_land_code/buttonpage02.txt
@@ -63,54 +63,12 @@ Variable (string) page_name
Text : buttonpage02
Max. Text Size: 12
-Variable (int32) button01conf
- Attributes
- ID : 50
- Scope: local
- Value: 0
-
-Variable (int32) button02conf
+Variable (int32) confirm
Attributes
ID : 51
Scope: local
Value: 0
-Variable (int32) button03conf
- Attributes
- ID : 52
- Scope: local
- Value: 0
-
-Variable (int32) button04conf
- Attributes
- ID : 53
- Scope: local
- Value: 0
-
-Variable (int32) button05conf
- Attributes
- ID : 54
- Scope: local
- Value: 0
-
-Variable (int32) button06conf
- Attributes
- ID : 55
- Scope: local
- Value: 0
-
-Variable (int32) button07conf
- Attributes
- ID : 56
- Scope: local
- Value: 0
-
-Variable (int32) button08conf
- Attributes
- ID : 57
- Scope: local
- Value: 0
-
Text button01text
Attributes
ID : 4
@@ -457,7 +415,8 @@ Hotspot button01
if(click_timer.en==1)
{
click_timer.en=0
- if(button01conf.val==1)
+ sys0=confirm.val&1
+ if(sys0>0)
{
confirm.body.txt=button01text.txt
confirm.page_id.val=dp
@@ -492,7 +451,8 @@ Hotspot button02
if(click_timer.en==1)
{
click_timer.en=0
- if(button02conf.val==1)
+ sys0=confirm.val&2
+ if(sys0>0)
{
confirm.body.txt=button02text.txt
confirm.page_id.val=dp
@@ -527,7 +487,8 @@ Hotspot button03
if(click_timer.en==1)
{
click_timer.en=0
- if(button03conf.val==1)
+ sys0=confirm.val&4
+ if(sys0>0)
{
confirm.body.txt=button03text.txt
confirm.page_id.val=dp
@@ -562,7 +523,8 @@ Hotspot button04
if(click_timer.en==1)
{
click_timer.en=0
- if(button04conf.val==1)
+ sys0=confirm.val&8
+ if(sys0>0)
{
confirm.body.txt=button04text.txt
confirm.page_id.val=dp
@@ -597,7 +559,8 @@ Hotspot button05
if(click_timer.en==1)
{
click_timer.en=0
- if(button05conf.val==1)
+ sys0=confirm.val&16
+ if(sys0>0)
{
confirm.body.txt=button05text.txt
confirm.page_id.val=dp
@@ -632,7 +595,8 @@ Hotspot button06
if(click_timer.en==1)
{
click_timer.en=0
- if(button06conf.val==1)
+ sys0=confirm.val&32
+ if(sys0>0)
{
confirm.body.txt=button06text.txt
confirm.page_id.val=dp
@@ -667,7 +631,8 @@ Hotspot button07
if(click_timer.en==1)
{
click_timer.en=0
- if(button07conf.val==1)
+ sys0=confirm.val&64
+ if(sys0>0)
{
confirm.body.txt=button07text.txt
confirm.page_id.val=dp
@@ -702,7 +667,8 @@ Hotspot button08
if(click_timer.en==1)
{
click_timer.en=0
- if(button08conf.val==1)
+ sys0=confirm.val&128
+ if(sys0>0)
{
confirm.body.txt=button08text.txt
confirm.page_id.val=dp
@@ -753,7 +719,7 @@ Timer click_timer
Timer wakeup_timer
Attributes
- ID : 58
+ ID : 50
Scope : local
Period (ms): 100
Enabled : yes
diff --git a/nspanel_us_land_code/buttonpage03.txt b/nspanel_us_land_code/buttonpage03.txt
index 84f65eb..5311424 100644
--- a/nspanel_us_land_code/buttonpage03.txt
+++ b/nspanel_us_land_code/buttonpage03.txt
@@ -63,54 +63,12 @@ Variable (string) page_name
Text : buttonpage03
Max. Text Size: 12
-Variable (int32) button01conf
- Attributes
- ID : 50
- Scope: local
- Value: 0
-
-Variable (int32) button02conf
+Variable (int32) confirm
Attributes
ID : 51
Scope: local
Value: 0
-Variable (int32) button03conf
- Attributes
- ID : 52
- Scope: local
- Value: 0
-
-Variable (int32) button04conf
- Attributes
- ID : 53
- Scope: local
- Value: 0
-
-Variable (int32) button05conf
- Attributes
- ID : 54
- Scope: local
- Value: 0
-
-Variable (int32) button06conf
- Attributes
- ID : 55
- Scope: local
- Value: 0
-
-Variable (int32) button07conf
- Attributes
- ID : 56
- Scope: local
- Value: 0
-
-Variable (int32) button08conf
- Attributes
- ID : 57
- Scope: local
- Value: 0
-
Text button01text
Attributes
ID : 4
@@ -457,7 +415,8 @@ Hotspot button01
if(click_timer.en==1)
{
click_timer.en=0
- if(button01conf.val==1)
+ sys0=confirm.val&1
+ if(sys0>0)
{
confirm.body.txt=button01text.txt
confirm.page_id.val=dp
@@ -492,7 +451,8 @@ Hotspot button02
if(click_timer.en==1)
{
click_timer.en=0
- if(button02conf.val==1)
+ sys0=confirm.val&2
+ if(sys0>0)
{
confirm.body.txt=button02text.txt
confirm.page_id.val=dp
@@ -527,7 +487,8 @@ Hotspot button03
if(click_timer.en==1)
{
click_timer.en=0
- if(button03conf.val==1)
+ sys0=confirm.val&4
+ if(sys0>0)
{
confirm.body.txt=button03text.txt
confirm.page_id.val=dp
@@ -562,7 +523,8 @@ Hotspot button04
if(click_timer.en==1)
{
click_timer.en=0
- if(button04conf.val==1)
+ sys0=confirm.val&8
+ if(sys0>0)
{
confirm.body.txt=button04text.txt
confirm.page_id.val=dp
@@ -597,7 +559,8 @@ Hotspot button05
if(click_timer.en==1)
{
click_timer.en=0
- if(button05conf.val==1)
+ sys0=confirm.val&16
+ if(sys0>0)
{
confirm.body.txt=button05text.txt
confirm.page_id.val=dp
@@ -632,7 +595,8 @@ Hotspot button06
if(click_timer.en==1)
{
click_timer.en=0
- if(button06conf.val==1)
+ sys0=confirm.val&32
+ if(sys0>0)
{
confirm.body.txt=button06text.txt
confirm.page_id.val=dp
@@ -667,7 +631,8 @@ Hotspot button07
if(click_timer.en==1)
{
click_timer.en=0
- if(button07conf.val==1)
+ sys0=confirm.val&64
+ if(sys0>0)
{
confirm.body.txt=button07text.txt
confirm.page_id.val=dp
@@ -702,7 +667,8 @@ Hotspot button08
if(click_timer.en==1)
{
click_timer.en=0
- if(button08conf.val==1)
+ sys0=confirm.val&128
+ if(sys0>0)
{
confirm.body.txt=button08text.txt
confirm.page_id.val=dp
@@ -753,7 +719,7 @@ Timer click_timer
Timer wakeup_timer
Attributes
- ID : 58
+ ID : 50
Scope : local
Period (ms): 100
Enabled : yes
diff --git a/nspanel_us_land_code/buttonpage04.txt b/nspanel_us_land_code/buttonpage04.txt
index 138400a..1dea0a3 100644
--- a/nspanel_us_land_code/buttonpage04.txt
+++ b/nspanel_us_land_code/buttonpage04.txt
@@ -63,54 +63,12 @@ Variable (string) page_name
Text : buttonpage04
Max. Text Size: 12
-Variable (int32) button01conf
- Attributes
- ID : 50
- Scope: local
- Value: 0
-
-Variable (int32) button02conf
+Variable (int32) confirm
Attributes
ID : 51
Scope: local
Value: 0
-Variable (int32) button03conf
- Attributes
- ID : 52
- Scope: local
- Value: 0
-
-Variable (int32) button04conf
- Attributes
- ID : 53
- Scope: local
- Value: 0
-
-Variable (int32) button05conf
- Attributes
- ID : 54
- Scope: local
- Value: 0
-
-Variable (int32) button06conf
- Attributes
- ID : 55
- Scope: local
- Value: 0
-
-Variable (int32) button07conf
- Attributes
- ID : 56
- Scope: local
- Value: 0
-
-Variable (int32) button08conf
- Attributes
- ID : 57
- Scope: local
- Value: 0
-
Text button01text
Attributes
ID : 4
@@ -457,7 +415,8 @@ Hotspot button01
if(click_timer.en==1)
{
click_timer.en=0
- if(button01conf.val==1)
+ sys0=confirm.val&1
+ if(sys0>0)
{
confirm.body.txt=button01text.txt
confirm.page_id.val=dp
@@ -492,7 +451,8 @@ Hotspot button02
if(click_timer.en==1)
{
click_timer.en=0
- if(button02conf.val==1)
+ sys0=confirm.val&2
+ if(sys0>0)
{
confirm.body.txt=button02text.txt
confirm.page_id.val=dp
@@ -527,7 +487,8 @@ Hotspot button03
if(click_timer.en==1)
{
click_timer.en=0
- if(button03conf.val==1)
+ sys0=confirm.val&4
+ if(sys0>0)
{
confirm.body.txt=button03text.txt
confirm.page_id.val=dp
@@ -562,7 +523,8 @@ Hotspot button04
if(click_timer.en==1)
{
click_timer.en=0
- if(button04conf.val==1)
+ sys0=confirm.val&8
+ if(sys0>0)
{
confirm.body.txt=button04text.txt
confirm.page_id.val=dp
@@ -597,7 +559,8 @@ Hotspot button05
if(click_timer.en==1)
{
click_timer.en=0
- if(button05conf.val==1)
+ sys0=confirm.val&16
+ if(sys0>0)
{
confirm.body.txt=button05text.txt
confirm.page_id.val=dp
@@ -632,7 +595,8 @@ Hotspot button06
if(click_timer.en==1)
{
click_timer.en=0
- if(button06conf.val==1)
+ sys0=confirm.val&32
+ if(sys0>0)
{
confirm.body.txt=button06text.txt
confirm.page_id.val=dp
@@ -667,7 +631,8 @@ Hotspot button07
if(click_timer.en==1)
{
click_timer.en=0
- if(button07conf.val==1)
+ sys0=confirm.val&64
+ if(sys0>0)
{
confirm.body.txt=button07text.txt
confirm.page_id.val=dp
@@ -702,7 +667,8 @@ Hotspot button08
if(click_timer.en==1)
{
click_timer.en=0
- if(button08conf.val==1)
+ sys0=confirm.val&128
+ if(sys0>0)
{
confirm.body.txt=button08text.txt
confirm.page_id.val=dp
@@ -753,7 +719,7 @@ Timer click_timer
Timer wakeup_timer
Attributes
- ID : 58
+ ID : 50
Scope : local
Period (ms): 100
Enabled : yes
diff --git a/nspanel_us_land_code/climate.txt b/nspanel_us_land_code/climate.txt
index 6292087..43a7102 100644
--- a/nspanel_us_land_code/climate.txt
+++ b/nspanel_us_land_code/climate.txt
@@ -120,7 +120,7 @@ Variable (string) back_page
Variable (int32) embedded
Attributes
ID : 46
- Scope: local
+ Scope: global
Value: 0
Variable (string) va2
@@ -147,6 +147,14 @@ Text current_temp
Text :
Max. Text Size : 10
+ Events
+ Touch Press Event
+ printh 91
+ prints "touchevent",0
+ printh 00
+ prints rand,0
+ printh FF FF FF
+
Text page_label
Attributes
ID : 6
@@ -157,6 +165,14 @@ Text page_label
Text :
Max. Text Size : 100
+ Events
+ Touch Press Event
+ printh 91
+ prints "touchevent",0
+ printh 00
+ prints rand,0
+ printh FF FF FF
+
Text current_icon
Attributes
ID : 8
@@ -167,6 +183,14 @@ Text current_icon
Text :
Max. Text Size : 10
+ Events
+ Touch Press Event
+ printh 91
+ prints "touchevent",0
+ printh 00
+ prints rand,0
+ printh FF FF FF
+
Text target_icon
Attributes
ID : 9
@@ -177,6 +201,14 @@ Text target_icon
Text :
Max. Text Size : 10
+ Events
+ Touch Press Event
+ printh 91
+ prints "touchevent",0
+ printh 00
+ prints rand,0
+ printh FF FF FF
+
Text value01_icon
Attributes
ID : 10
@@ -187,6 +219,14 @@ Text value01_icon
Text :
Max. Text Size : 10
+ Events
+ Touch Press Event
+ printh 91
+ prints "touchevent",0
+ printh 00
+ prints rand,0
+ printh FF FF FF
+
Text value01
Attributes
ID : 11
@@ -197,6 +237,14 @@ Text value01
Text :
Max. Text Size : 6
+ Events
+ Touch Press Event
+ printh 91
+ prints "touchevent",0
+ printh 00
+ prints rand,0
+ printh FF FF FF
+
Text value02_icon
Attributes
ID : 12
@@ -207,6 +255,14 @@ Text value02_icon
Text :
Max. Text Size : 10
+ Events
+ Touch Press Event
+ printh 91
+ prints "touchevent",0
+ printh 00
+ prints rand,0
+ printh FF FF FF
+
Text value02
Attributes
ID : 13
@@ -217,6 +273,14 @@ Text value02
Text :
Max. Text Size : 6
+ Events
+ Touch Press Event
+ printh 91
+ prints "touchevent",0
+ printh 00
+ prints rand,0
+ printh FF FF FF
+
Text value03_icon
Attributes
ID : 14
@@ -227,6 +291,14 @@ Text value03_icon
Text :
Max. Text Size : 10
+ Events
+ Touch Press Event
+ printh 91
+ prints "touchevent",0
+ printh 00
+ prints rand,0
+ printh FF FF FF
+
Text value03
Attributes
ID : 15
@@ -237,6 +309,14 @@ Text value03
Text :
Max. Text Size : 6
+ Events
+ Touch Press Event
+ printh 91
+ prints "touchevent",0
+ printh 00
+ prints rand,0
+ printh FF FF FF
+
Text value04_icon
Attributes
ID : 16
@@ -247,6 +327,14 @@ Text value04_icon
Text :
Max. Text Size : 10
+ Events
+ Touch Press Event
+ printh 91
+ prints "touchevent",0
+ printh 00
+ prints rand,0
+ printh FF FF FF
+
Text value04
Attributes
ID : 17
@@ -257,6 +345,14 @@ Text value04
Text :
Max. Text Size : 6
+ Events
+ Touch Press Event
+ printh 91
+ prints "touchevent",0
+ printh 00
+ prints rand,0
+ printh FF FF FF
+
Text button01_icon
Attributes
ID : 18
@@ -357,6 +453,14 @@ Text target_temp
Text :
Max. Text Size : 10
+ Events
+ Touch Press Event
+ printh 91
+ prints "touchevent",0
+ printh 00
+ prints rand,0
+ printh FF FF FF
+
Slider climateslider
Attributes
ID : 7
@@ -428,6 +532,11 @@ Hotspot decrease_temp
Events
Touch Press Event
+ printh 91
+ prints "touchevent",0
+ printh 00
+ prints rand,0
+ printh FF FF FF
if(climateslider.val>0)
{
climateslider.val--
@@ -452,6 +561,11 @@ Hotspot increase_temp
Events
Touch Press Event
+ printh 91
+ prints "touchevent",0
+ printh 00
+ prints rand,0
+ printh FF FF FF
if(climateslider.val0)
{
@@ -145,6 +182,13 @@ Text bt_vol_up
Max. Text Size : 3
Events
+ Touch Press Event
+ printh 91
+ prints "touchevent",0
+ printh 00
+ prints rand,0
+ printh FF FF FF
+
Touch Release Event
if(vol_slider.val<100)
{
@@ -171,6 +215,13 @@ Text bt_mute
Max. Text Size : 3
Events
+ Touch Press Event
+ printh 91
+ prints "touchevent",0
+ printh 00
+ prints rand,0
+ printh FF FF FF
+
Touch Release Event
if(is_muted.val==1)
{
@@ -197,6 +248,21 @@ Text time_current
Text :
Max. Text Size : 10
+ Events
+ Touch Press Event
+ printh 91
+ prints "touchevent",0
+ printh 00
+ prints rand,0
+ printh FF FF FF
+
+ Touch Release Event
+ printh 91
+ prints "touchevent",0
+ printh 00
+ prints rand,0
+ printh FF FF FF
+
Text time_total
Attributes
ID : 12
@@ -207,6 +273,21 @@ Text time_total
Text :
Max. Text Size : 10
+ Events
+ Touch Press Event
+ printh 91
+ prints "touchevent",0
+ printh 00
+ prints rand,0
+ printh FF FF FF
+
+ Touch Release Event
+ printh 91
+ prints "touchevent",0
+ printh 00
+ prints rand,0
+ printh FF FF FF
+
Text track
Attributes
ID : 13
@@ -217,6 +298,21 @@ Text track
Text :
Max. Text Size : 50
+ Events
+ Touch Press Event
+ printh 91
+ prints "touchevent",0
+ printh 00
+ prints rand,0
+ printh FF FF FF
+
+ Touch Release Event
+ printh 91
+ prints "touchevent",0
+ printh 00
+ prints rand,0
+ printh FF FF FF
+
Text artist
Attributes
ID : 14
@@ -227,6 +323,21 @@ Text artist
Text :
Max. Text Size : 50
+ Events
+ Touch Press Event
+ printh 91
+ prints "touchevent",0
+ printh 00
+ prints rand,0
+ printh FF FF FF
+
+ Touch Release Event
+ printh 91
+ prints "touchevent",0
+ printh 00
+ prints rand,0
+ printh FF FF FF
+
Text bt_prev
Attributes
ID : 15
@@ -238,6 +349,13 @@ Text bt_prev
Max. Text Size : 10
Events
+ Touch Press Event
+ printh 91
+ prints "touchevent",0
+ printh 00
+ prints rand,0
+ printh FF FF FF
+
Touch Release Event
lastclick.txt="{\"page\": \"media_player\", \"key\": \"media_previous_track\"}"
printh 92
@@ -258,6 +376,13 @@ Text bt_play_pause
Max. Text Size : 10
Events
+ Touch Press Event
+ printh 91
+ prints "touchevent",0
+ printh 00
+ prints rand,0
+ printh FF FF FF
+
Touch Release Event
printh 92
prints "localevent",0
@@ -266,7 +391,7 @@ Text bt_play_pause
printh 00
printh FF FF FF
-Text bt_stop
+Text bt_next
Attributes
ID : 17
Scope : local
@@ -277,25 +402,13 @@ Text bt_stop
Max. Text Size : 10
Events
- Touch Release Event
- printh 92
- prints "localevent",0
- printh 00
- prints "{\"page\": \"media_player\", \"key\": \"media_stop\"}",0
+ Touch Press Event
+ printh 91
+ prints "touchevent",0
printh 00
+ prints rand,0
printh FF FF FF
-Text bt_next
- Attributes
- ID : 18
- Scope : local
- Dragging : 0
- Send Component ID : disabled
- Associated Keyboard: none
- Text :
- Max. Text Size : 10
-
- Events
Touch Release Event
printh 92
prints "localevent",0
@@ -306,7 +419,7 @@ Text bt_next
Text bt_on_off
Attributes
- ID : 19
+ ID : 18
Scope : local
Dragging : 0
Send Component ID : disabled
@@ -315,6 +428,13 @@ Text bt_on_off
Max. Text Size : 10
Events
+ Touch Press Event
+ printh 91
+ prints "touchevent",0
+ printh 00
+ prints rand,0
+ printh FF FF FF
+
Touch Release Event
printh 92
prints "localevent",0
@@ -331,6 +451,21 @@ Progress Bar time_progress
Send Component ID: disabled
Value : 0
+ Events
+ Touch Press Event
+ printh 91
+ prints "touchevent",0
+ printh 00
+ prints rand,0
+ printh FF FF FF
+
+ Touch Release Event
+ printh 91
+ prints "touchevent",0
+ printh 00
+ prints rand,0
+ printh FF FF FF
+
Slider vol_slider
Attributes
ID : 5
@@ -342,6 +477,13 @@ Slider vol_slider
Lower range limit: 0
Events
+ Touch Press Event
+ printh 91
+ prints "touchevent",0
+ printh 00
+ prints rand,0
+ printh FF FF FF
+
Touch Release Event
covx vol_slider.val,va0.txt,0,0
vol_text.txt=va0.txt+"%"
@@ -383,7 +525,7 @@ Button button_back
Timer wakeup_timer
Attributes
- ID : 21
+ ID : 20
Scope : local
Period (ms): 100
Enabled : yes
@@ -406,7 +548,7 @@ Timer wakeup_timer
Timer timer0
Attributes
- ID : 22
+ ID : 21
Scope : local
Period (ms): 1000
Enabled : no
@@ -426,7 +568,7 @@ Timer timer0
Timer prg_timer
Attributes
- ID : 25
+ ID : 24
Scope : local
Period (ms): 1000
Enabled : no
diff --git a/nspanel_us_land_code/screensaver.txt b/nspanel_us_land_code/screensaver.txt
index d53450d..49e829d 100644
--- a/nspanel_us_land_code/screensaver.txt
+++ b/nspanel_us_land_code/screensaver.txt
@@ -26,7 +26,7 @@ Page screensaver
Variable (int32) orign
Attributes
ID : 2
- Scope: global
+ Scope: local
Value: 0
TouchCap wakeup
diff --git a/nspanel_us_land_code/settings.txt b/nspanel_us_land_code/settings.txt
index b7b3241..42ef3f2 100644
--- a/nspanel_us_land_code/settings.txt
+++ b/nspanel_us_land_code/settings.txt
@@ -22,6 +22,8 @@ Page settings
prints "{\"page\": \"settings\", \"component\": \"currentpage\", \"value\": \"pagechange\"}",0
printh 00
printh FF FF FF
+ vis lbl_sleep,0
+ vis bt_sleep,0
Touch Press Event
printh 91