diff --git a/Home_Assistant/blueprints/hasp_Apply_Theme.yaml b/Home_Assistant/blueprints/hasp_Apply_Theme.yaml
index 4872ca0..3d9c40d 100644
--- a/Home_Assistant/blueprints/hasp_Apply_Theme.yaml
+++ b/Home_Assistant/blueprints/hasp_Apply_Theme.yaml
@@ -283,39 +283,39 @@ action:
# Theme: Apply selected foreground color on change
- conditions:
- condition: template
- value_template: "{{ trigger.topic == selectedfgtopic }}"
+ value_template: "{{ (trigger.topic == selectedfgtopic) and ((selected_fgcolor|int) == -1) }}"
sequence:
- service: mqtt.publish
data:
topic: "{{commandtopic}}.pco"
- payload: "{{selectedfg}}"
+ payload: "{{trigger.payload}}"
#########################################################################
# Theme: Apply selected background color on change
- conditions:
- condition: template
- value_template: "{{ trigger.topic == selectedbgtopic }}"
+ value_template: "{{ (trigger.topic == selectedbgtopic) and ((selected_bgcolor|int) == -1) }}"
sequence:
- service: mqtt.publish
data:
topic: "{{commandtopic}}.bco"
- payload: "{{selectedbg}}"
+ payload: "{{trigger.payload}}"
#########################################################################
# Theme: Apply unselected foreground color on change
- conditions:
- condition: template
- value_template: "{{ trigger.topic == unselectedfgtopic }}"
+ value_template: "{{ (trigger.topic == unselectedfgtopic) and ((unselected_fgcolor|int) == -1) }}"
sequence:
- service: mqtt.publish
data:
topic: "{{commandtopic}}.pco2"
- payload: "{{unselectedfg}}"
+ payload: "{{trigger.payload}}"
#########################################################################
# Theme: Apply unselected background color on change
- conditions:
- condition: template
- value_template: "{{ trigger.topic == unselectedbgtopic }}"
+ value_template: "{{ (trigger.topic == unselectedbgtopic) and ((unselected_bgcolor|int) == -1) }}"
sequence:
- service: mqtt.publish
data:
topic: "{{commandtopic}}.bco2"
- payload: "{{unselectedbg}}"
+ payload: "{{trigger.payload}}"
diff --git a/Home_Assistant/blueprints/hasp_Display_Calendar_with_Icon.yaml b/Home_Assistant/blueprints/hasp_Display_Calendar_with_Icon.yaml
index 6703a46..6a3ed23 100644
--- a/Home_Assistant/blueprints/hasp_Display_Calendar_with_Icon.yaml
+++ b/Home_Assistant/blueprints/hasp_Display_Calendar_with_Icon.yaml
@@ -369,7 +369,7 @@ action:
# Any change to the button will remove the overlaid icon.
- conditions:
- condition: template
- value_template: "{{ trigger.topic == selectedfgtopic }}"
+ value_template: "{{ (trigger.topic == selectedfgtopic) and ((selected_fgcolor|int) == -1) }}"
sequence:
- service: mqtt.publish
data:
@@ -386,7 +386,7 @@ action:
# Theme: Apply selected background color on change
- conditions:
- condition: template
- value_template: "{{ trigger.topic == selectedbgtopic }}"
+ value_template: "{{ (trigger.topic == selectedbgtopic) and ((selected_bgcolor|int) == -1) }}"
sequence:
- service: mqtt.publish
data:
@@ -403,7 +403,7 @@ action:
# Theme: Apply unselected foreground color on change
- conditions:
- condition: template
- value_template: "{{ trigger.topic == unselectedfgtopic }}"
+ value_template: "{{ (trigger.topic == unselectedfgtopic) and ((unselected_fgcolor|int) == -1) }}"
sequence:
- service: mqtt.publish
data:
@@ -420,7 +420,7 @@ action:
# Theme: Apply unselected background color on change
- conditions:
- condition: template
- value_template: "{{ trigger.topic == unselectedbgtopic }}"
+ value_template: "{{ (trigger.topic == unselectedbgtopic) and ((unselected_bgcolor|int) == -1) }}"
sequence:
- service: mqtt.publish
data:
diff --git a/Home_Assistant/blueprints/hasp_Display_Clock_with_Icon.yaml b/Home_Assistant/blueprints/hasp_Display_Clock_with_Icon.yaml
index 4fb87b2..52872d6 100644
--- a/Home_Assistant/blueprints/hasp_Display_Clock_with_Icon.yaml
+++ b/Home_Assistant/blueprints/hasp_Display_Clock_with_Icon.yaml
@@ -372,7 +372,7 @@ action:
# Any change to the button will remove the overlaid icon.
- conditions:
- condition: template
- value_template: "{{ trigger.topic == selectedfgtopic }}"
+ value_template: "{{ (trigger.topic == selectedfgtopic) and ((selected_fgcolor|int) == -1) }}"
sequence:
- service: mqtt.publish
data:
@@ -389,7 +389,7 @@ action:
# Theme: Apply selected background color on change
- conditions:
- condition: template
- value_template: "{{ trigger.topic == selectedbgtopic }}"
+ value_template: "{{ (trigger.topic == selectedbgtopic) and ((selected_bgcolor|int) == -1) }}"
sequence:
- service: mqtt.publish
data:
@@ -406,7 +406,7 @@ action:
# Theme: Apply unselected foreground color on change
- conditions:
- condition: template
- value_template: "{{ trigger.topic == unselectedfgtopic }}"
+ value_template: "{{ (trigger.topic == unselectedfgtopic) and ((unselected_fgcolor|int) == -1) }}"
sequence:
- service: mqtt.publish
data:
@@ -423,7 +423,7 @@ action:
# Theme: Apply unselected background color on change
- conditions:
- condition: template
- value_template: "{{ trigger.topic == unselectedbgtopic }}"
+ value_template: "{{ (trigger.topic == unselectedbgtopic) and ((unselected_bgcolor|int) == -1) }}"
sequence:
- service: mqtt.publish
data:
diff --git a/Home_Assistant/blueprints/hasp_Display_Entity_State_or_Attribute.yaml b/Home_Assistant/blueprints/hasp_Display_Entity_State_or_Attribute.yaml
index e5c24c8..c8f4848 100644
--- a/Home_Assistant/blueprints/hasp_Display_Entity_State_or_Attribute.yaml
+++ b/Home_Assistant/blueprints/hasp_Display_Entity_State_or_Attribute.yaml
@@ -184,6 +184,42 @@ blueprint:
default: false
selector:
boolean:
+ selected_fgcolor:
+ name: "Selected foreground color"
+ description: 'Selected foreground color in Nextion RGB565 format (see "Nextion color codes" above for reference). -1 = Current theme selected foreground color.'
+ default: -1
+ selector:
+ number:
+ min: -1
+ max: 65535
+ mode: slider
+ selected_bgcolor:
+ name: "Selected background color"
+ description: 'Selected background color in Nextion RGB565 format (see "Nextion color codes" above for reference). -1 = Current theme selected background color.'
+ default: -1
+ selector:
+ number:
+ min: -1
+ max: 65535
+ mode: slider
+ unselected_fgcolor:
+ name: "Unselected foreground color"
+ description: 'Unselected foreground color in Nextion RGB565 format (see "Nextion color codes" above for reference). -1 = Current theme unselected foreground color.'
+ default: -1
+ selector:
+ number:
+ min: -1
+ max: 65535
+ mode: slider
+ unselected_bgcolor:
+ name: "Unselected background color"
+ description: 'Unselected background color in Nextion RGB565 format (see "Nextion color codes" above for reference). -1 = Current theme unselected background color.'
+ default: -1
+ selector:
+ number:
+ min: -1
+ max: 65535
+ mode: slider
mode: parallel
max_exceeded: silent
@@ -210,6 +246,10 @@ variables:
ycen: '{{ ycen_select.split(" - ")[0] | int }}'
wrap: !input wrap
title_case: !input title_case
+ selected_fgcolor: !input selected_fgcolor
+ selected_bgcolor: !input selected_bgcolor
+ unselected_fgcolor: !input unselected_fgcolor
+ unselected_bgcolor: !input unselected_bgcolor
haspobject: '{{ "p[" ~ hasppage ~ "].b[" ~ haspbutton ~ "]" }}'
commandtopic: '{{ "hasp/" ~ haspname ~ "/command/" ~ haspobject }}'
jsoncommandtopic: '{{ "hasp/" ~ haspname ~ "/command/json" }}'
@@ -238,53 +278,69 @@ variables:
unselectedfgtopic: '{{ "hasp/" ~ haspname ~ "/light/unselectedforegroundcolor/rgb" }}'
unselectedbgtopic: '{{ "hasp/" ~ haspname ~ "/light/unselectedbackgroundcolor/rgb" }}'
selectedfg: >-
- {%- set color = namespace() -%}
- {%- for entity in device_entities(haspdevice) -%}
- {%- if entity|regex_search("^light\..*_selected_foreground_color(?:_\d+|)$") -%}
- {%- set color.source=entity -%}
- {%- endif -%}
- {%- endfor -%}
- {%- set brightness = state_attr(color.source, "brightness")|int(default=255) / 255 -%}
- {%- set red=(state_attr(color.source, "rgb_color")[0] * brightness)|int(default=0) -%}
- {%- set green=(state_attr(color.source, "rgb_color")[1] * brightness)|int(default=0) -%}
- {%- set blue=(state_attr(color.source, "rgb_color")[2] * brightness)|int(default=0) -%}
- {{ (red|bitwise_and(248)*256) + (green|bitwise_and(252)*8) + (blue|bitwise_and(248)/8)|int }}
+ {%- if (selected_fgcolor|int) >= 0 -%}
+ {{ selected_fgcolor }}
+ {%- else -%}
+ {%- set color = namespace() -%}
+ {%- for entity in device_entities(haspdevice) -%}
+ {%- if entity|regex_search("^light\..*_selected_foreground_color(?:_\d+|)$") -%}
+ {%- set color.source=entity -%}
+ {%- endif -%}
+ {%- endfor -%}
+ {%- set brightness = state_attr(color.source, "brightness")|int(default=255) / 255 -%}
+ {%- set red=(state_attr(color.source, "rgb_color")[0] * brightness)|int(default=0) -%}
+ {%- set green=(state_attr(color.source, "rgb_color")[1] * brightness)|int(default=0) -%}
+ {%- set blue=(state_attr(color.source, "rgb_color")[2] * brightness)|int(default=0) -%}
+ {{ (red|bitwise_and(248)*256) + (green|bitwise_and(252)*8) + (blue|bitwise_and(248)/8)|int }}
+ {%- endif -%}
selectedbg: >-
- {%- set color = namespace() -%}
- {%- for entity in device_entities(haspdevice) -%}
- {%- if entity|regex_search("^light\..*_selected_background_color(?:_\d+|)$") -%}
- {%- set color.source=entity -%}
- {%- endif -%}
- {%- endfor -%}
- {%- set brightness = state_attr(color.source, "brightness")|int(default=255) / 255 -%}
- {%- set red=(state_attr(color.source, "rgb_color")[0] * brightness)|int(default=0) -%}
- {%- set green=(state_attr(color.source, "rgb_color")[1] * brightness)|int(default=0) -%}
- {%- set blue=(state_attr(color.source, "rgb_color")[2] * brightness)|int(default=0) -%}
- {{ (red|bitwise_and(248)*256) + (green|bitwise_and(252)*8) + (blue|bitwise_and(248)/8)|int }}
+ {%- if (selected_bgcolor|int) >= 0 -%}
+ {{ selected_bgcolor }}
+ {%- else -%}
+ {%- set color = namespace() -%}
+ {%- for entity in device_entities(haspdevice) -%}
+ {%- if entity|regex_search("^light\..*_selected_background_color(?:_\d+|)$") -%}
+ {%- set color.source=entity -%}
+ {%- endif -%}
+ {%- endfor -%}
+ {%- set brightness = state_attr(color.source, "brightness")|int(default=255) / 255 -%}
+ {%- set red=(state_attr(color.source, "rgb_color")[0] * brightness)|int(default=0) -%}
+ {%- set green=(state_attr(color.source, "rgb_color")[1] * brightness)|int(default=0) -%}
+ {%- set blue=(state_attr(color.source, "rgb_color")[2] * brightness)|int(default=0) -%}
+ {{ (red|bitwise_and(248)*256) + (green|bitwise_and(252)*8) + (blue|bitwise_and(248)/8)|int }}
+ {%- endif -%}
unselectedfg: >-
- {%- set color = namespace() -%}
- {%- for entity in device_entities(haspdevice) -%}
- {%- if entity|regex_search("^light\..*_unselected_foreground_color(?:_\d+|)$") -%}
- {%- set color.source=entity -%}
- {%- endif -%}
- {%- endfor -%}
- {%- set brightness = state_attr(color.source, "brightness")|int(default=255) / 255 -%}
- {%- set red=(state_attr(color.source, "rgb_color")[0] * brightness)|int(default=0) -%}
- {%- set green=(state_attr(color.source, "rgb_color")[1] * brightness)|int(default=0) -%}
- {%- set blue=(state_attr(color.source, "rgb_color")[2] * brightness)|int(default=0) -%}
- {{ (red|bitwise_and(248)*256) + (green|bitwise_and(252)*8) + (blue|bitwise_and(248)/8)|int }}
+ {%- if (unselected_fgcolor|int) >= 0 -%}
+ {{ unselected_fgcolor }}
+ {%- else -%}
+ {%- set color = namespace() -%}
+ {%- for entity in device_entities(haspdevice) -%}
+ {%- if entity|regex_search("^light\..*_unselected_foreground_color(?:_\d+|)$") -%}
+ {%- set color.source=entity -%}
+ {%- endif -%}
+ {%- endfor -%}
+ {%- set brightness = state_attr(color.source, "brightness")|int(default=255) / 255 -%}
+ {%- set red=(state_attr(color.source, "rgb_color")[0] * brightness)|int(default=0) -%}
+ {%- set green=(state_attr(color.source, "rgb_color")[1] * brightness)|int(default=0) -%}
+ {%- set blue=(state_attr(color.source, "rgb_color")[2] * brightness)|int(default=0) -%}
+ {{ (red|bitwise_and(248)*256) + (green|bitwise_and(252)*8) + (blue|bitwise_and(248)/8)|int }}
+ {%- endif -%}
unselectedbg: >-
- {%- set color = namespace() -%}
- {%- for entity in device_entities(haspdevice) -%}
- {%- if entity|regex_search("^light\..*_unselected_background_color(?:_\d+|)$") -%}
- {%- set color.source=entity -%}
- {%- endif -%}
- {%- endfor -%}
- {%- set brightness = state_attr(color.source, "brightness")|int(default=255) / 255 -%}
- {%- set red=(state_attr(color.source, "rgb_color")[0] * brightness)|int(default=0) -%}
- {%- set green=(state_attr(color.source, "rgb_color")[1] * brightness)|int(default=0) -%}
- {%- set blue=(state_attr(color.source, "rgb_color")[2] * brightness)|int(default=0) -%}
- {{ (red|bitwise_and(248)*256) + (green|bitwise_and(252)*8) + (blue|bitwise_and(248)/8)|int }}
+ {%- if (unselected_bgcolor|int) >= 0 -%}
+ {{ unselected_bgcolor }}
+ {%- else -%}
+ {%- set color = namespace() -%}
+ {%- for entity in device_entities(haspdevice) -%}
+ {%- if entity|regex_search("^light\..*_unselected_background_color(?:_\d+|)$") -%}
+ {%- set color.source=entity -%}
+ {%- endif -%}
+ {%- endfor -%}
+ {%- set brightness = state_attr(color.source, "brightness")|int(default=255) / 255 -%}
+ {%- set red=(state_attr(color.source, "rgb_color")[0] * brightness)|int(default=0) -%}
+ {%- set green=(state_attr(color.source, "rgb_color")[1] * brightness)|int(default=0) -%}
+ {%- set blue=(state_attr(color.source, "rgb_color")[2] * brightness)|int(default=0) -%}
+ {{ (red|bitwise_and(248)*256) + (green|bitwise_and(252)*8) + (blue|bitwise_and(248)/8)|int }}
+ {%- endif -%}
trigger_variables:
haspdevice: !input haspdevice
@@ -382,7 +438,7 @@ action:
# Theme: Apply selected foreground color on change
- conditions:
- condition: template
- value_template: "{{ trigger.topic == selectedfgtopic }}"
+ value_template: "{{ (trigger.topic == selectedfgtopic) and ((selected_fgcolor|int) == -1) }}"
sequence:
- service: mqtt.publish
data:
@@ -392,7 +448,7 @@ action:
# Theme: Apply selected background color on change
- conditions:
- condition: template
- value_template: "{{ trigger.topic == selectedbgtopic }}"
+ value_template: "{{ (trigger.topic == selectedbgtopic) and ((selected_bgcolor|int) == -1) }}"
sequence:
- service: mqtt.publish
data:
@@ -402,7 +458,7 @@ action:
# Theme: Apply unselected foreground color on change
- conditions:
- condition: template
- value_template: "{{ trigger.topic == unselectedfgtopic }}"
+ value_template: "{{ (trigger.topic == unselectedfgtopic) and ((unselected_fgcolor|int) == -1) }}"
sequence:
- service: mqtt.publish
data:
@@ -412,7 +468,7 @@ action:
# Theme: Apply unselected background color on change
- conditions:
- condition: template
- value_template: "{{ trigger.topic == unselectedbgtopic }}"
+ value_template: "{{ (trigger.topic == unselectedbgtopic) and ((unselected_bgcolor|int) == -1) }}"
sequence:
- service: mqtt.publish
data:
diff --git a/Home_Assistant/blueprints/hasp_Display_Template.yaml b/Home_Assistant/blueprints/hasp_Display_Template.yaml
index c4b5d8f..6803888 100644
--- a/Home_Assistant/blueprints/hasp_Display_Template.yaml
+++ b/Home_Assistant/blueprints/hasp_Display_Template.yaml
@@ -72,6 +72,28 @@ blueprint:
+ ## Nextion color codes
+
+
+
+ The Nextion environment utilizes RGB 565 encoding. [Use this handy convertor](https://nodtem66.github.io/nextion-hmi-color-convert/index.html) to select your colors and convert to the RGB 565 format.
+
+ Here are some example colors:
+
+ | Color | Code |
+ |--------|-------|
+ | White | 65535 |
+ | Black | 0 |
+ | Grey | 25388 |
+ | Red | 63488 |
+ | Green | 2016 |
+ | Blue | 31 |
+ | Yellow | 65504 |
+ | Orange | 64512 |
+ | Brown | 48192 |
+
+
+
domain: automation
input:
haspdevice:
@@ -157,6 +179,42 @@ blueprint:
default: false
selector:
boolean:
+ selected_fgcolor:
+ name: "Selected foreground color"
+ description: 'Selected foreground color in Nextion RGB565 format (see "Nextion color codes" above for reference). -1 = Current theme selected foreground color.'
+ default: -1
+ selector:
+ number:
+ min: -1
+ max: 65535
+ mode: slider
+ selected_bgcolor:
+ name: "Selected background color"
+ description: 'Selected background color in Nextion RGB565 format (see "Nextion color codes" above for reference). -1 = Current theme selected background color.'
+ default: -1
+ selector:
+ number:
+ min: -1
+ max: 65535
+ mode: slider
+ unselected_fgcolor:
+ name: "Unselected foreground color"
+ description: 'Unselected foreground color in Nextion RGB565 format (see "Nextion color codes" above for reference). -1 = Current theme unselected foreground color.'
+ default: -1
+ selector:
+ number:
+ min: -1
+ max: 65535
+ mode: slider
+ unselected_bgcolor:
+ name: "Unselected background color"
+ description: 'Unselected background color in Nextion RGB565 format (see "Nextion color codes" above for reference). -1 = Current theme unselected background color.'
+ default: -1
+ selector:
+ number:
+ min: -1
+ max: 65535
+ mode: slider
mode: parallel
max_exceeded: silent
@@ -180,6 +238,10 @@ variables:
ycen_select: !input ycen_select
ycen: '{{ ycen_select.split(" - ")[0] | int }}'
wrap: !input wrap
+ selected_fgcolor: !input selected_fgcolor
+ selected_bgcolor: !input selected_bgcolor
+ unselected_fgcolor: !input unselected_fgcolor
+ unselected_bgcolor: !input unselected_bgcolor
haspobject: '{{ "p[" ~ hasppage ~ "].b[" ~ haspbutton ~ "]" }}'
commandtopic: '{{ "hasp/" ~ haspname ~ "/command/" ~ haspobject }}'
jsoncommandtopic: '{{ "hasp/" ~ haspname ~ "/command/json" }}'
@@ -189,53 +251,69 @@ variables:
unselectedfgtopic: '{{ "hasp/" ~ haspname ~ "/light/unselectedforegroundcolor/rgb" }}'
unselectedbgtopic: '{{ "hasp/" ~ haspname ~ "/light/unselectedbackgroundcolor/rgb" }}'
selectedfg: >-
- {%- set color = namespace() -%}
- {%- for entity in device_entities(haspdevice) -%}
- {%- if entity|regex_search("^light\..*_selected_foreground_color(?:_\d+|)$") -%}
- {%- set color.source=entity -%}
- {%- endif -%}
- {%- endfor -%}
- {%- set brightness = state_attr(color.source, "brightness")|int(default=255) / 255 -%}
- {%- set red=(state_attr(color.source, "rgb_color")[0] * brightness)|int(default=0) -%}
- {%- set green=(state_attr(color.source, "rgb_color")[1] * brightness)|int(default=0) -%}
- {%- set blue=(state_attr(color.source, "rgb_color")[2] * brightness)|int(default=0) -%}
- {{ (red|bitwise_and(248)*256) + (green|bitwise_and(252)*8) + (blue|bitwise_and(248)/8)|int }}
+ {%- if (selected_fgcolor|int) >= 0 -%}
+ {{ selected_fgcolor }}
+ {%- else -%}
+ {%- set color = namespace() -%}
+ {%- for entity in device_entities(haspdevice) -%}
+ {%- if entity|regex_search("^light\..*_selected_foreground_color(?:_\d+|)$") -%}
+ {%- set color.source=entity -%}
+ {%- endif -%}
+ {%- endfor -%}
+ {%- set brightness = state_attr(color.source, "brightness")|int(default=255) / 255 -%}
+ {%- set red=(state_attr(color.source, "rgb_color")[0] * brightness)|int(default=0) -%}
+ {%- set green=(state_attr(color.source, "rgb_color")[1] * brightness)|int(default=0) -%}
+ {%- set blue=(state_attr(color.source, "rgb_color")[2] * brightness)|int(default=0) -%}
+ {{ (red|bitwise_and(248)*256) + (green|bitwise_and(252)*8) + (blue|bitwise_and(248)/8)|int }}
+ {%- endif -%}
selectedbg: >-
- {%- set color = namespace() -%}
- {%- for entity in device_entities(haspdevice) -%}
- {%- if entity|regex_search("^light\..*_selected_background_color(?:_\d+|)$") -%}
- {%- set color.source=entity -%}
- {%- endif -%}
- {%- endfor -%}
- {%- set brightness = state_attr(color.source, "brightness")|int(default=255) / 255 -%}
- {%- set red=(state_attr(color.source, "rgb_color")[0] * brightness)|int(default=0) -%}
- {%- set green=(state_attr(color.source, "rgb_color")[1] * brightness)|int(default=0) -%}
- {%- set blue=(state_attr(color.source, "rgb_color")[2] * brightness)|int(default=0) -%}
- {{ (red|bitwise_and(248)*256) + (green|bitwise_and(252)*8) + (blue|bitwise_and(248)/8)|int }}
+ {%- if (selected_bgcolor|int) >= 0 -%}
+ {{ selected_bgcolor }}
+ {%- else -%}
+ {%- set color = namespace() -%}
+ {%- for entity in device_entities(haspdevice) -%}
+ {%- if entity|regex_search("^light\..*_selected_background_color(?:_\d+|)$") -%}
+ {%- set color.source=entity -%}
+ {%- endif -%}
+ {%- endfor -%}
+ {%- set brightness = state_attr(color.source, "brightness")|int(default=255) / 255 -%}
+ {%- set red=(state_attr(color.source, "rgb_color")[0] * brightness)|int(default=0) -%}
+ {%- set green=(state_attr(color.source, "rgb_color")[1] * brightness)|int(default=0) -%}
+ {%- set blue=(state_attr(color.source, "rgb_color")[2] * brightness)|int(default=0) -%}
+ {{ (red|bitwise_and(248)*256) + (green|bitwise_and(252)*8) + (blue|bitwise_and(248)/8)|int }}
+ {%- endif -%}
unselectedfg: >-
- {%- set color = namespace() -%}
- {%- for entity in device_entities(haspdevice) -%}
- {%- if entity|regex_search("^light\..*_unselected_foreground_color(?:_\d+|)$") -%}
- {%- set color.source=entity -%}
- {%- endif -%}
- {%- endfor -%}
- {%- set brightness = state_attr(color.source, "brightness")|int(default=255) / 255 -%}
- {%- set red=(state_attr(color.source, "rgb_color")[0] * brightness)|int(default=0) -%}
- {%- set green=(state_attr(color.source, "rgb_color")[1] * brightness)|int(default=0) -%}
- {%- set blue=(state_attr(color.source, "rgb_color")[2] * brightness)|int(default=0) -%}
- {{ (red|bitwise_and(248)*256) + (green|bitwise_and(252)*8) + (blue|bitwise_and(248)/8)|int }}
+ {%- if (unselected_fgcolor|int) >= 0 -%}
+ {{ unselected_fgcolor }}
+ {%- else -%}
+ {%- set color = namespace() -%}
+ {%- for entity in device_entities(haspdevice) -%}
+ {%- if entity|regex_search("^light\..*_unselected_foreground_color(?:_\d+|)$") -%}
+ {%- set color.source=entity -%}
+ {%- endif -%}
+ {%- endfor -%}
+ {%- set brightness = state_attr(color.source, "brightness")|int(default=255) / 255 -%}
+ {%- set red=(state_attr(color.source, "rgb_color")[0] * brightness)|int(default=0) -%}
+ {%- set green=(state_attr(color.source, "rgb_color")[1] * brightness)|int(default=0) -%}
+ {%- set blue=(state_attr(color.source, "rgb_color")[2] * brightness)|int(default=0) -%}
+ {{ (red|bitwise_and(248)*256) + (green|bitwise_and(252)*8) + (blue|bitwise_and(248)/8)|int }}
+ {%- endif -%}
unselectedbg: >-
- {%- set color = namespace() -%}
- {%- for entity in device_entities(haspdevice) -%}
- {%- if entity|regex_search("^light\..*_unselected_background_color(?:_\d+|)$") -%}
- {%- set color.source=entity -%}
- {%- endif -%}
- {%- endfor -%}
- {%- set brightness = state_attr(color.source, "brightness")|int(default=255) / 255 -%}
- {%- set red=(state_attr(color.source, "rgb_color")[0] * brightness)|int(default=0) -%}
- {%- set green=(state_attr(color.source, "rgb_color")[1] * brightness)|int(default=0) -%}
- {%- set blue=(state_attr(color.source, "rgb_color")[2] * brightness)|int(default=0) -%}
- {{ (red|bitwise_and(248)*256) + (green|bitwise_and(252)*8) + (blue|bitwise_and(248)/8)|int }}
+ {%- if (unselected_bgcolor|int) >= 0 -%}
+ {{ unselected_bgcolor }}
+ {%- else -%}
+ {%- set color = namespace() -%}
+ {%- for entity in device_entities(haspdevice) -%}
+ {%- if entity|regex_search("^light\..*_unselected_background_color(?:_\d+|)$") -%}
+ {%- set color.source=entity -%}
+ {%- endif -%}
+ {%- endfor -%}
+ {%- set brightness = state_attr(color.source, "brightness")|int(default=255) / 255 -%}
+ {%- set red=(state_attr(color.source, "rgb_color")[0] * brightness)|int(default=0) -%}
+ {%- set green=(state_attr(color.source, "rgb_color")[1] * brightness)|int(default=0) -%}
+ {%- set blue=(state_attr(color.source, "rgb_color")[2] * brightness)|int(default=0) -%}
+ {{ (red|bitwise_and(248)*256) + (green|bitwise_and(252)*8) + (blue|bitwise_and(248)/8)|int }}
+ {%- endif -%}
trigger_variables:
haspdevice: !input haspdevice
@@ -355,7 +433,7 @@ action:
# Theme: Apply selected foreground color on change
- conditions:
- condition: template
- value_template: "{{ trigger.topic == selectedfgtopic }}"
+ value_template: "{{ (trigger.topic == selectedfgtopic) and ((selected_fgcolor|int) == -1) }}"
sequence:
- service: mqtt.publish
data:
@@ -365,7 +443,7 @@ action:
# Theme: Apply selected background color on change
- conditions:
- condition: template
- value_template: "{{ trigger.topic == selectedbgtopic }}"
+ value_template: "{{ (trigger.topic == selectedbgtopic) and ((selected_bgcolor|int) == -1) }}"
sequence:
- service: mqtt.publish
data:
@@ -375,7 +453,7 @@ action:
# Theme: Apply unselected foreground color on change
- conditions:
- condition: template
- value_template: "{{ trigger.topic == unselectedfgtopic }}"
+ value_template: "{{ (trigger.topic == unselectedfgtopic) and ((unselected_fgcolor|int) == -1) }}"
sequence:
- service: mqtt.publish
data:
@@ -385,7 +463,7 @@ action:
# Theme: Apply unselected background color on change
- conditions:
- condition: template
- value_template: "{{ trigger.topic == unselectedbgtopic }}"
+ value_template: "{{ (trigger.topic == unselectedbgtopic) and ((unselected_bgcolor|int) == -1) }}"
sequence:
- service: mqtt.publish
data:
diff --git a/Home_Assistant/blueprints/hasp_Display_Text.yaml b/Home_Assistant/blueprints/hasp_Display_Text.yaml
index 213554e..d189e8e 100644
--- a/Home_Assistant/blueprints/hasp_Display_Text.yaml
+++ b/Home_Assistant/blueprints/hasp_Display_Text.yaml
@@ -380,39 +380,39 @@ action:
# Theme: Apply selected foreground color on change
- conditions:
- condition: template
- value_template: "{{ trigger.topic == selectedfgtopic }}"
+ value_template: "{{ (trigger.topic == selectedfgtopic) and ((selected_fgcolor|int) == -1) }}"
sequence:
- service: mqtt.publish
data:
topic: "{{commandtopic}}.pco"
- payload: "{{selectedfg}}"
+ payload: "{{trigger.payload}}"
#########################################################################
# Theme: Apply selected background color on change
- conditions:
- condition: template
- value_template: "{{ trigger.topic == selectedbgtopic }}"
+ value_template: "{{ (trigger.topic == selectedbgtopic) and ((selected_bgcolor|int) == -1) }}"
sequence:
- service: mqtt.publish
data:
topic: "{{commandtopic}}.bco"
- payload: "{{selectedbg}}"
+ payload: "{{trigger.payload}}"
#########################################################################
# Theme: Apply unselected foreground color on change
- conditions:
- condition: template
- value_template: "{{ trigger.topic == unselectedfgtopic }}"
+ value_template: "{{ (trigger.topic == unselectedfgtopic) and ((unselected_fgcolor|int) == -1) }}"
sequence:
- service: mqtt.publish
data:
topic: "{{commandtopic}}.pco2"
- payload: "{{unselectedfg}}"
+ payload: "{{trigger.payload}}"
#########################################################################
# Theme: Apply unselected background color on change
- conditions:
- condition: template
- value_template: "{{ trigger.topic == unselectedbgtopic }}"
+ value_template: "{{ (trigger.topic == unselectedbgtopic) and ((unselected_bgcolor|int) == -1) }}"
sequence:
- service: mqtt.publish
data:
topic: "{{commandtopic}}.bco2"
- payload: "{{unselectedbg}}"
+ payload: "{{trigger.payload}}"
diff --git a/Home_Assistant/blueprints/hasp_Display_Weather_Condition.yaml b/Home_Assistant/blueprints/hasp_Display_Weather_Condition.yaml
index 0653bc9..b2967b8 100644
--- a/Home_Assistant/blueprints/hasp_Display_Weather_Condition.yaml
+++ b/Home_Assistant/blueprints/hasp_Display_Weather_Condition.yaml
@@ -60,6 +60,28 @@ blueprint:
+ ## Nextion color codes
+
+
+
+ The Nextion environment utilizes RGB 565 encoding. [Use this handy convertor](https://nodtem66.github.io/nextion-hmi-color-convert/index.html) to select your colors and convert to the RGB 565 format.
+
+ Here are some example colors:
+
+ | Color | Code |
+ |--------|-------|
+ | White | 65535 |
+ | Black | 0 |
+ | Grey | 25388 |
+ | Red | 63488 |
+ | Green | 2016 |
+ | Blue | 31 |
+ | Yellow | 65504 |
+ | Orange | 64512 |
+ | Brown | 48192 |
+
+
+
domain: automation
input:
haspdevice:
@@ -140,6 +162,42 @@ blueprint:
default: false
selector:
boolean:
+ selected_fgcolor:
+ name: "Selected foreground color"
+ description: 'Selected foreground color in Nextion RGB565 format (see "Nextion color codes" above for reference). -1 = Current theme selected foreground color.'
+ default: -1
+ selector:
+ number:
+ min: -1
+ max: 65535
+ mode: slider
+ selected_bgcolor:
+ name: "Selected background color"
+ description: 'Selected background color in Nextion RGB565 format (see "Nextion color codes" above for reference). -1 = Current theme selected background color.'
+ default: -1
+ selector:
+ number:
+ min: -1
+ max: 65535
+ mode: slider
+ unselected_fgcolor:
+ name: "Unselected foreground color"
+ description: 'Unselected foreground color in Nextion RGB565 format (see "Nextion color codes" above for reference). -1 = Current theme unselected foreground color.'
+ default: -1
+ selector:
+ number:
+ min: -1
+ max: 65535
+ mode: slider
+ unselected_bgcolor:
+ name: "Unselected background color"
+ description: 'Unselected background color in Nextion RGB565 format (see "Nextion color codes" above for reference). -1 = Current theme unselected background color.'
+ default: -1
+ selector:
+ number:
+ min: -1
+ max: 65535
+ mode: slider
mode: parallel
max_exceeded: silent
@@ -162,6 +220,10 @@ variables:
ycen_select: !input ycen_select
ycen: '{{ ycen_select.split(" - ")[0] | int }}'
wrap: !input wrap
+ selected_fgcolor: !input selected_fgcolor
+ selected_bgcolor: !input selected_bgcolor
+ unselected_fgcolor: !input unselected_fgcolor
+ unselected_bgcolor: !input unselected_bgcolor
haspobject: '{{ "p[" ~ hasppage ~ "].b[" ~ haspbutton ~ "]" }}'
commandtopic: '{{ "hasp/" ~ haspname ~ "/command/" ~ haspobject }}'
jsoncommandtopic: '{{ "hasp/" ~ haspname ~ "/command/json" }}'
@@ -173,53 +235,69 @@ variables:
unselectedfgtopic: '{{ "hasp/" ~ haspname ~ "/light/unselectedforegroundcolor/rgb" }}'
unselectedbgtopic: '{{ "hasp/" ~ haspname ~ "/light/unselectedbackgroundcolor/rgb" }}'
selectedfg: >-
- {%- set color = namespace() -%}
- {%- for entity in device_entities(haspdevice) -%}
- {%- if entity|regex_search("^light\..*_selected_foreground_color(?:_\d+|)$") -%}
- {%- set color.source=entity -%}
- {%- endif -%}
- {%- endfor -%}
- {%- set brightness = state_attr(color.source, "brightness")|int(default=255) / 255 -%}
- {%- set red=(state_attr(color.source, "rgb_color")[0] * brightness)|int(default=0) -%}
- {%- set green=(state_attr(color.source, "rgb_color")[1] * brightness)|int(default=0) -%}
- {%- set blue=(state_attr(color.source, "rgb_color")[2] * brightness)|int(default=0) -%}
- {{ (red|bitwise_and(248)*256) + (green|bitwise_and(252)*8) + (blue|bitwise_and(248)/8)|int }}
+ {%- if (selected_fgcolor|int) >= 0 -%}
+ {{ selected_fgcolor }}
+ {%- else -%}
+ {%- set color = namespace() -%}
+ {%- for entity in device_entities(haspdevice) -%}
+ {%- if entity|regex_search("^light\..*_selected_foreground_color(?:_\d+|)$") -%}
+ {%- set color.source=entity -%}
+ {%- endif -%}
+ {%- endfor -%}
+ {%- set brightness = state_attr(color.source, "brightness")|int(default=255) / 255 -%}
+ {%- set red=(state_attr(color.source, "rgb_color")[0] * brightness)|int(default=0) -%}
+ {%- set green=(state_attr(color.source, "rgb_color")[1] * brightness)|int(default=0) -%}
+ {%- set blue=(state_attr(color.source, "rgb_color")[2] * brightness)|int(default=0) -%}
+ {{ (red|bitwise_and(248)*256) + (green|bitwise_and(252)*8) + (blue|bitwise_and(248)/8)|int }}
+ {%- endif -%}
selectedbg: >-
- {%- set color = namespace() -%}
- {%- for entity in device_entities(haspdevice) -%}
- {%- if entity|regex_search("^light\..*_selected_background_color(?:_\d+|)$") -%}
- {%- set color.source=entity -%}
- {%- endif -%}
- {%- endfor -%}
- {%- set brightness = state_attr(color.source, "brightness")|int(default=255) / 255 -%}
- {%- set red=(state_attr(color.source, "rgb_color")[0] * brightness)|int(default=0) -%}
- {%- set green=(state_attr(color.source, "rgb_color")[1] * brightness)|int(default=0) -%}
- {%- set blue=(state_attr(color.source, "rgb_color")[2] * brightness)|int(default=0) -%}
- {{ (red|bitwise_and(248)*256) + (green|bitwise_and(252)*8) + (blue|bitwise_and(248)/8)|int }}
+ {%- if (selected_bgcolor|int) >= 0 -%}
+ {{ selected_bgcolor }}
+ {%- else -%}
+ {%- set color = namespace() -%}
+ {%- for entity in device_entities(haspdevice) -%}
+ {%- if entity|regex_search("^light\..*_selected_background_color(?:_\d+|)$") -%}
+ {%- set color.source=entity -%}
+ {%- endif -%}
+ {%- endfor -%}
+ {%- set brightness = state_attr(color.source, "brightness")|int(default=255) / 255 -%}
+ {%- set red=(state_attr(color.source, "rgb_color")[0] * brightness)|int(default=0) -%}
+ {%- set green=(state_attr(color.source, "rgb_color")[1] * brightness)|int(default=0) -%}
+ {%- set blue=(state_attr(color.source, "rgb_color")[2] * brightness)|int(default=0) -%}
+ {{ (red|bitwise_and(248)*256) + (green|bitwise_and(252)*8) + (blue|bitwise_and(248)/8)|int }}
+ {%- endif -%}
unselectedfg: >-
- {%- set color = namespace() -%}
- {%- for entity in device_entities(haspdevice) -%}
- {%- if entity|regex_search("^light\..*_unselected_foreground_color(?:_\d+|)$") -%}
- {%- set color.source=entity -%}
- {%- endif -%}
- {%- endfor -%}
- {%- set brightness = state_attr(color.source, "brightness")|int(default=255) / 255 -%}
- {%- set red=(state_attr(color.source, "rgb_color")[0] * brightness)|int(default=0) -%}
- {%- set green=(state_attr(color.source, "rgb_color")[1] * brightness)|int(default=0) -%}
- {%- set blue=(state_attr(color.source, "rgb_color")[2] * brightness)|int(default=0) -%}
- {{ (red|bitwise_and(248)*256) + (green|bitwise_and(252)*8) + (blue|bitwise_and(248)/8)|int }}
+ {%- if (unselected_fgcolor|int) >= 0 -%}
+ {{ unselected_fgcolor }}
+ {%- else -%}
+ {%- set color = namespace() -%}
+ {%- for entity in device_entities(haspdevice) -%}
+ {%- if entity|regex_search("^light\..*_unselected_foreground_color(?:_\d+|)$") -%}
+ {%- set color.source=entity -%}
+ {%- endif -%}
+ {%- endfor -%}
+ {%- set brightness = state_attr(color.source, "brightness")|int(default=255) / 255 -%}
+ {%- set red=(state_attr(color.source, "rgb_color")[0] * brightness)|int(default=0) -%}
+ {%- set green=(state_attr(color.source, "rgb_color")[1] * brightness)|int(default=0) -%}
+ {%- set blue=(state_attr(color.source, "rgb_color")[2] * brightness)|int(default=0) -%}
+ {{ (red|bitwise_and(248)*256) + (green|bitwise_and(252)*8) + (blue|bitwise_and(248)/8)|int }}
+ {%- endif -%}
unselectedbg: >-
- {%- set color = namespace() -%}
- {%- for entity in device_entities(haspdevice) -%}
- {%- if entity|regex_search("^light\..*_unselected_background_color(?:_\d+|)$") -%}
- {%- set color.source=entity -%}
- {%- endif -%}
- {%- endfor -%}
- {%- set brightness = state_attr(color.source, "brightness")|int(default=255) / 255 -%}
- {%- set red=(state_attr(color.source, "rgb_color")[0] * brightness)|int(default=0) -%}
- {%- set green=(state_attr(color.source, "rgb_color")[1] * brightness)|int(default=0) -%}
- {%- set blue=(state_attr(color.source, "rgb_color")[2] * brightness)|int(default=0) -%}
- {{ (red|bitwise_and(248)*256) + (green|bitwise_and(252)*8) + (blue|bitwise_and(248)/8)|int }}
+ {%- if (unselected_bgcolor|int) >= 0 -%}
+ {{ unselected_bgcolor }}
+ {%- else -%}
+ {%- set color = namespace() -%}
+ {%- for entity in device_entities(haspdevice) -%}
+ {%- if entity|regex_search("^light\..*_unselected_background_color(?:_\d+|)$") -%}
+ {%- set color.source=entity -%}
+ {%- endif -%}
+ {%- endfor -%}
+ {%- set brightness = state_attr(color.source, "brightness")|int(default=255) / 255 -%}
+ {%- set red=(state_attr(color.source, "rgb_color")[0] * brightness)|int(default=0) -%}
+ {%- set green=(state_attr(color.source, "rgb_color")[1] * brightness)|int(default=0) -%}
+ {%- set blue=(state_attr(color.source, "rgb_color")[2] * brightness)|int(default=0) -%}
+ {{ (red|bitwise_and(248)*256) + (green|bitwise_and(252)*8) + (blue|bitwise_and(248)/8)|int }}
+ {%- endif -%}
trigger_variables:
haspdevice: !input haspdevice
@@ -313,12 +391,10 @@ action:
sequence:
- choose:
#########################################################################
- # Theme: Apply selected foreground color when it changes.
- # If the page is currently active, delay a moment before applying the overlay
- # so it will fire after any other theme elements being applied.
+ # Theme: Apply selected foreground color on change
- conditions:
- condition: template
- value_template: "{{ trigger.topic == selectedfgtopic }}"
+ value_template: "{{ (trigger.topic == selectedfgtopic) and ((selected_fgcolor|int) == -1) }}"
sequence:
- service: mqtt.publish
data:
@@ -328,7 +404,7 @@ action:
# Theme: Apply selected background color on change
- conditions:
- condition: template
- value_template: "{{ trigger.topic == selectedbgtopic }}"
+ value_template: "{{ (trigger.topic == selectedbgtopic) and ((selected_bgcolor|int) == -1) }}"
sequence:
- service: mqtt.publish
data:
@@ -338,7 +414,7 @@ action:
# Theme: Apply unselected foreground color on change
- conditions:
- condition: template
- value_template: "{{ trigger.topic == unselectedfgtopic }}"
+ value_template: "{{ (trigger.topic == unselectedfgtopic) and ((unselected_fgcolor|int) == -1) }}"
sequence:
- service: mqtt.publish
data:
@@ -348,7 +424,7 @@ action:
# Theme: Apply unselected background color on change
- conditions:
- condition: template
- value_template: "{{ trigger.topic == unselectedbgtopic }}"
+ value_template: "{{ (trigger.topic == unselectedbgtopic) and ((unselected_bgcolor|int) == -1) }}"
sequence:
- service: mqtt.publish
data:
diff --git a/Home_Assistant/blueprints/hasp_Display_Weather_Condition_with_Icon.yaml b/Home_Assistant/blueprints/hasp_Display_Weather_Condition_with_Icon.yaml
index 5098550..5ba6dfd 100644
--- a/Home_Assistant/blueprints/hasp_Display_Weather_Condition_with_Icon.yaml
+++ b/Home_Assistant/blueprints/hasp_Display_Weather_Condition_with_Icon.yaml
@@ -457,7 +457,7 @@ action:
# Any change to the button will remove the overlaid icon.
- conditions:
- condition: template
- value_template: "{{ trigger.topic == selectedfgtopic }}"
+ value_template: "{{ (trigger.topic == selectedfgtopic) and ((selected_fgcolor|int) == -1) }}"
sequence:
- service: mqtt.publish
data:
@@ -474,7 +474,7 @@ action:
# Theme: Apply selected background color on change
- conditions:
- condition: template
- value_template: "{{ trigger.topic == selectedbgtopic }}"
+ value_template: "{{ (trigger.topic == selectedbgtopic) and ((selected_bgcolor|int) == -1) }}"
sequence:
- service: mqtt.publish
data:
@@ -491,7 +491,7 @@ action:
# Theme: Apply unselected foreground color on change
- conditions:
- condition: template
- value_template: "{{ trigger.topic == unselectedfgtopic }}"
+ value_template: "{{ (trigger.topic == unselectedfgtopic) and ((unselected_fgcolor|int) == -1) }}"
sequence:
- service: mqtt.publish
data:
@@ -508,7 +508,7 @@ action:
# Theme: Apply unselected background color on change
- conditions:
- condition: template
- value_template: "{{ trigger.topic == unselectedbgtopic }}"
+ value_template: "{{ (trigger.topic == unselectedbgtopic) and ((unselected_bgcolor|int) == -1) }}"
sequence:
- service: mqtt.publish
data:
diff --git a/Home_Assistant/blueprints/hasp_Display_Weather_Forecast.yaml b/Home_Assistant/blueprints/hasp_Display_Weather_Forecast.yaml
index bbfd0b5..620d45b 100644
--- a/Home_Assistant/blueprints/hasp_Display_Weather_Forecast.yaml
+++ b/Home_Assistant/blueprints/hasp_Display_Weather_Forecast.yaml
@@ -12,7 +12,9 @@ blueprint:

- ### HASPone Page and Button reference
+ ## HASPone Page and Button Reference
+
+ The images below show each available HASPone page along with the layout of available button objects.
@@ -58,6 +60,30 @@ blueprint:
  
+
+
+ ## Nextion color codes
+
+
+
+ The Nextion environment utilizes RGB 565 encoding. [Use this handy convertor](https://nodtem66.github.io/nextion-hmi-color-convert/index.html) to select your colors and convert to the RGB 565 format.
+
+ Here are some example colors:
+
+ | Color | Code |
+ |--------|-------|
+ | White | 65535 |
+ | Black | 0 |
+ | Grey | 25388 |
+ | Red | 63488 |
+ | Green | 2016 |
+ | Blue | 31 |
+ | Yellow | 65504 |
+ | Orange | 64512 |
+ | Brown | 48192 |
+
+
+
domain: automation
input:
haspdevice:
@@ -166,6 +192,42 @@ blueprint:
default: true
selector:
boolean:
+ selected_fgcolor:
+ name: "Selected foreground color"
+ description: 'Selected foreground color in Nextion RGB565 format (see "Nextion color codes" above for reference). -1 = Current theme selected foreground color.'
+ default: -1
+ selector:
+ number:
+ min: -1
+ max: 65535
+ mode: slider
+ selected_bgcolor:
+ name: "Selected background color"
+ description: 'Selected background color in Nextion RGB565 format (see "Nextion color codes" above for reference). -1 = Current theme selected background color.'
+ default: -1
+ selector:
+ number:
+ min: -1
+ max: 65535
+ mode: slider
+ unselected_fgcolor:
+ name: "Unselected foreground color"
+ description: 'Unselected foreground color in Nextion RGB565 format (see "Nextion color codes" above for reference). -1 = Current theme unselected foreground color.'
+ default: -1
+ selector:
+ number:
+ min: -1
+ max: 65535
+ mode: slider
+ unselected_bgcolor:
+ name: "Unselected background color"
+ description: 'Unselected background color in Nextion RGB565 format (see "Nextion color codes" above for reference). -1 = Current theme unselected background color.'
+ default: -1
+ selector:
+ number:
+ min: -1
+ max: 65535
+ mode: slider
mode: parallel
max_exceeded: silent
@@ -192,6 +254,10 @@ variables:
ycen: '{{ ycen_select.split(" - ")[0] | int }}'
wrap: !input wrap
title_case: !input title_case
+ selected_fgcolor: !input selected_fgcolor
+ selected_bgcolor: !input selected_bgcolor
+ unselected_fgcolor: !input unselected_fgcolor
+ unselected_bgcolor: !input unselected_bgcolor
haspobject: '{{ "p[" ~ hasppage ~ "].b[" ~ haspbutton ~ "]" }}'
commandtopic: '{{ "hasp/" ~ haspname ~ "/command/" ~ haspobject }}'
jsoncommandtopic: '{{ "hasp/" ~ haspname ~ "/command/json" }}'
@@ -200,9 +266,9 @@ variables:
{{ prefix }}
{%- endif -%}
{%- if title_case -%}
- {{ state_attr(weather_provider, "forecast")[forecast_index|int(default=0)].get(forecast_attribute) | title }}
+ {{ state_attr(weather_provider, "forecast")[forecast_index|int(default=0)].get(forecast_attribute)|replace("windy-variant","windy")|replace("clear-night","clear night")|replace("partlycloudy","partly cloudy")|replace("lightning-rainy","lightning & rain")|replace("snowy-rainy","snow & rain") | title }}
{%- else -%}
- {{ state_attr(weather_provider, "forecast")[forecast_index|int(default=0)].get(forecast_attribute) }}
+ {{ state_attr(weather_provider, "forecast")[forecast_index|int(default=0)].get(forecast_attribute)|replace("windy-variant","windy")|replace("clear-night","clear night")|replace("partlycloudy","partly cloudy")|replace("lightning-rainy","lightning & rain")|replace("snowy-rainy","snow & rain") }}
{%- endif -%}
isbr: "{% if wrap == true %}1{% else %}0{% endif %}"
selectedfgtopic: '{{ "hasp/" ~ haspname ~ "/light/selectedforegroundcolor/rgb" }}'
@@ -210,53 +276,69 @@ variables:
unselectedfgtopic: '{{ "hasp/" ~ haspname ~ "/light/unselectedforegroundcolor/rgb" }}'
unselectedbgtopic: '{{ "hasp/" ~ haspname ~ "/light/unselectedbackgroundcolor/rgb" }}'
selectedfg: >-
- {%- set color = namespace() -%}
- {%- for entity in device_entities(haspdevice) -%}
- {%- if entity|regex_search("^light\..*_selected_foreground_color(?:_\d+|)$") -%}
- {%- set color.source=entity -%}
- {%- endif -%}
- {%- endfor -%}
- {%- set brightness = state_attr(color.source, "brightness")|int(default=255) / 255 -%}
- {%- set red=(state_attr(color.source, "rgb_color")[0] * brightness)|int(default=0) -%}
- {%- set green=(state_attr(color.source, "rgb_color")[1] * brightness)|int(default=0) -%}
- {%- set blue=(state_attr(color.source, "rgb_color")[2] * brightness)|int(default=0) -%}
- {{ (red|bitwise_and(248)*256) + (green|bitwise_and(252)*8) + (blue|bitwise_and(248)/8)|int }}
+ {%- if (selected_fgcolor|int) >= 0 -%}
+ {{ selected_fgcolor }}
+ {%- else -%}
+ {%- set color = namespace() -%}
+ {%- for entity in device_entities(haspdevice) -%}
+ {%- if entity|regex_search("^light\..*_selected_foreground_color(?:_\d+|)$") -%}
+ {%- set color.source=entity -%}
+ {%- endif -%}
+ {%- endfor -%}
+ {%- set brightness = state_attr(color.source, "brightness")|int(default=255) / 255 -%}
+ {%- set red=(state_attr(color.source, "rgb_color")[0] * brightness)|int(default=0) -%}
+ {%- set green=(state_attr(color.source, "rgb_color")[1] * brightness)|int(default=0) -%}
+ {%- set blue=(state_attr(color.source, "rgb_color")[2] * brightness)|int(default=0) -%}
+ {{ (red|bitwise_and(248)*256) + (green|bitwise_and(252)*8) + (blue|bitwise_and(248)/8)|int }}
+ {%- endif -%}
selectedbg: >-
- {%- set color = namespace() -%}
- {%- for entity in device_entities(haspdevice) -%}
- {%- if entity|regex_search("^light\..*_selected_background_color(?:_\d+|)$") -%}
- {%- set color.source=entity -%}
- {%- endif -%}
- {%- endfor -%}
- {%- set brightness = state_attr(color.source, "brightness")|int(default=255) / 255 -%}
- {%- set red=(state_attr(color.source, "rgb_color")[0] * brightness)|int(default=0) -%}
- {%- set green=(state_attr(color.source, "rgb_color")[1] * brightness)|int(default=0) -%}
- {%- set blue=(state_attr(color.source, "rgb_color")[2] * brightness)|int(default=0) -%}
- {{ (red|bitwise_and(248)*256) + (green|bitwise_and(252)*8) + (blue|bitwise_and(248)/8)|int }}
+ {%- if (selected_bgcolor|int) >= 0 -%}
+ {{ selected_bgcolor }}
+ {%- else -%}
+ {%- set color = namespace() -%}
+ {%- for entity in device_entities(haspdevice) -%}
+ {%- if entity|regex_search("^light\..*_selected_background_color(?:_\d+|)$") -%}
+ {%- set color.source=entity -%}
+ {%- endif -%}
+ {%- endfor -%}
+ {%- set brightness = state_attr(color.source, "brightness")|int(default=255) / 255 -%}
+ {%- set red=(state_attr(color.source, "rgb_color")[0] * brightness)|int(default=0) -%}
+ {%- set green=(state_attr(color.source, "rgb_color")[1] * brightness)|int(default=0) -%}
+ {%- set blue=(state_attr(color.source, "rgb_color")[2] * brightness)|int(default=0) -%}
+ {{ (red|bitwise_and(248)*256) + (green|bitwise_and(252)*8) + (blue|bitwise_and(248)/8)|int }}
+ {%- endif -%}
unselectedfg: >-
- {%- set color = namespace() -%}
- {%- for entity in device_entities(haspdevice) -%}
- {%- if entity|regex_search("^light\..*_unselected_foreground_color(?:_\d+|)$") -%}
- {%- set color.source=entity -%}
- {%- endif -%}
- {%- endfor -%}
- {%- set brightness = state_attr(color.source, "brightness")|int(default=255) / 255 -%}
- {%- set red=(state_attr(color.source, "rgb_color")[0] * brightness)|int(default=0) -%}
- {%- set green=(state_attr(color.source, "rgb_color")[1] * brightness)|int(default=0) -%}
- {%- set blue=(state_attr(color.source, "rgb_color")[2] * brightness)|int(default=0) -%}
- {{ (red|bitwise_and(248)*256) + (green|bitwise_and(252)*8) + (blue|bitwise_and(248)/8)|int }}
+ {%- if (unselected_fgcolor|int) >= 0 -%}
+ {{ unselected_fgcolor }}
+ {%- else -%}
+ {%- set color = namespace() -%}
+ {%- for entity in device_entities(haspdevice) -%}
+ {%- if entity|regex_search("^light\..*_unselected_foreground_color(?:_\d+|)$") -%}
+ {%- set color.source=entity -%}
+ {%- endif -%}
+ {%- endfor -%}
+ {%- set brightness = state_attr(color.source, "brightness")|int(default=255) / 255 -%}
+ {%- set red=(state_attr(color.source, "rgb_color")[0] * brightness)|int(default=0) -%}
+ {%- set green=(state_attr(color.source, "rgb_color")[1] * brightness)|int(default=0) -%}
+ {%- set blue=(state_attr(color.source, "rgb_color")[2] * brightness)|int(default=0) -%}
+ {{ (red|bitwise_and(248)*256) + (green|bitwise_and(252)*8) + (blue|bitwise_and(248)/8)|int }}
+ {%- endif -%}
unselectedbg: >-
- {%- set color = namespace() -%}
- {%- for entity in device_entities(haspdevice) -%}
- {%- if entity|regex_search("^light\..*_unselected_background_color(?:_\d+|)$") -%}
- {%- set color.source=entity -%}
- {%- endif -%}
- {%- endfor -%}
- {%- set brightness = state_attr(color.source, "brightness")|int(default=255) / 255 -%}
- {%- set red=(state_attr(color.source, "rgb_color")[0] * brightness)|int(default=0) -%}
- {%- set green=(state_attr(color.source, "rgb_color")[1] * brightness)|int(default=0) -%}
- {%- set blue=(state_attr(color.source, "rgb_color")[2] * brightness)|int(default=0) -%}
- {{ (red|bitwise_and(248)*256) + (green|bitwise_and(252)*8) + (blue|bitwise_and(248)/8)|int }}
+ {%- if (unselected_bgcolor|int) >= 0 -%}
+ {{ unselected_bgcolor }}
+ {%- else -%}
+ {%- set color = namespace() -%}
+ {%- for entity in device_entities(haspdevice) -%}
+ {%- if entity|regex_search("^light\..*_unselected_background_color(?:_\d+|)$") -%}
+ {%- set color.source=entity -%}
+ {%- endif -%}
+ {%- endfor -%}
+ {%- set brightness = state_attr(color.source, "brightness")|int(default=255) / 255 -%}
+ {%- set red=(state_attr(color.source, "rgb_color")[0] * brightness)|int(default=0) -%}
+ {%- set green=(state_attr(color.source, "rgb_color")[1] * brightness)|int(default=0) -%}
+ {%- set blue=(state_attr(color.source, "rgb_color")[2] * brightness)|int(default=0) -%}
+ {{ (red|bitwise_and(248)*256) + (green|bitwise_and(252)*8) + (blue|bitwise_and(248)/8)|int }}
+ {%- endif -%}
trigger_variables:
haspdevice: !input haspdevice
@@ -350,7 +432,7 @@ action:
# Theme: Apply selected foreground color on change
- conditions:
- condition: template
- value_template: "{{ trigger.topic == selectedfgtopic }}"
+ value_template: "{{ (trigger.topic == selectedfgtopic) and ((selected_fgcolor|int) == -1) }}"
sequence:
- service: mqtt.publish
data:
@@ -360,7 +442,7 @@ action:
# Theme: Apply selected background color on change
- conditions:
- condition: template
- value_template: "{{ trigger.topic == selectedbgtopic }}"
+ value_template: "{{ (trigger.topic == selectedbgtopic) and ((selected_bgcolor|int) == -1) }}"
sequence:
- service: mqtt.publish
data:
@@ -370,7 +452,7 @@ action:
# Theme: Apply unselected foreground color on change
- conditions:
- condition: template
- value_template: "{{ trigger.topic == unselectedfgtopic }}"
+ value_template: "{{ (trigger.topic == unselectedfgtopic) and ((unselected_fgcolor|int) == -1) }}"
sequence:
- service: mqtt.publish
data:
@@ -380,7 +462,7 @@ action:
# Theme: Apply unselected background color on change
- conditions:
- condition: template
- value_template: "{{ trigger.topic == unselectedbgtopic }}"
+ value_template: "{{ (trigger.topic == unselectedbgtopic) and ((unselected_bgcolor|int) == -1) }}"
sequence:
- service: mqtt.publish
data:
diff --git a/images/hasp_Display_Calendar_with_Icon.png b/images/hasp_Display_Calendar_with_Icon.png
index bf88166..ee358f8 100644
Binary files a/images/hasp_Display_Calendar_with_Icon.png and b/images/hasp_Display_Calendar_with_Icon.png differ
diff --git a/images/hasp_Display_Clock_with_Icon.png b/images/hasp_Display_Clock_with_Icon.png
index f7205cc..f53fe6f 100644
Binary files a/images/hasp_Display_Clock_with_Icon.png and b/images/hasp_Display_Clock_with_Icon.png differ
diff --git a/images/hasp_Display_Weather_Condition_with_Icon.png b/images/hasp_Display_Weather_Condition_with_Icon.png
index 3e743e4..407c52b 100644
Binary files a/images/hasp_Display_Weather_Condition_with_Icon.png and b/images/hasp_Display_Weather_Condition_with_Icon.png differ
diff --git a/images/hasp_Display_Weather_Temperature_with_Icon_and_Colors.png b/images/hasp_Display_Weather_Temperature_with_Icon_and_Colors.png
index f7a68ed..3942d01 100644
Binary files a/images/hasp_Display_Weather_Temperature_with_Icon_and_Colors.png and b/images/hasp_Display_Weather_Temperature_with_Icon_and_Colors.png differ