Improved theme handling
@ -283,39 +283,39 @@ action:
|
|||||||
# Theme: Apply selected foreground color on change
|
# Theme: Apply selected foreground color on change
|
||||||
- conditions:
|
- conditions:
|
||||||
- condition: template
|
- condition: template
|
||||||
value_template: "{{ trigger.topic == selectedfgtopic }}"
|
value_template: "{{ (trigger.topic == selectedfgtopic) and ((selected_fgcolor|int) == -1) }}"
|
||||||
sequence:
|
sequence:
|
||||||
- service: mqtt.publish
|
- service: mqtt.publish
|
||||||
data:
|
data:
|
||||||
topic: "{{commandtopic}}.pco"
|
topic: "{{commandtopic}}.pco"
|
||||||
payload: "{{selectedfg}}"
|
payload: "{{trigger.payload}}"
|
||||||
#########################################################################
|
#########################################################################
|
||||||
# Theme: Apply selected background color on change
|
# Theme: Apply selected background color on change
|
||||||
- conditions:
|
- conditions:
|
||||||
- condition: template
|
- condition: template
|
||||||
value_template: "{{ trigger.topic == selectedbgtopic }}"
|
value_template: "{{ (trigger.topic == selectedbgtopic) and ((selected_bgcolor|int) == -1) }}"
|
||||||
sequence:
|
sequence:
|
||||||
- service: mqtt.publish
|
- service: mqtt.publish
|
||||||
data:
|
data:
|
||||||
topic: "{{commandtopic}}.bco"
|
topic: "{{commandtopic}}.bco"
|
||||||
payload: "{{selectedbg}}"
|
payload: "{{trigger.payload}}"
|
||||||
#########################################################################
|
#########################################################################
|
||||||
# Theme: Apply unselected foreground color on change
|
# Theme: Apply unselected foreground color on change
|
||||||
- conditions:
|
- conditions:
|
||||||
- condition: template
|
- condition: template
|
||||||
value_template: "{{ trigger.topic == unselectedfgtopic }}"
|
value_template: "{{ (trigger.topic == unselectedfgtopic) and ((unselected_fgcolor|int) == -1) }}"
|
||||||
sequence:
|
sequence:
|
||||||
- service: mqtt.publish
|
- service: mqtt.publish
|
||||||
data:
|
data:
|
||||||
topic: "{{commandtopic}}.pco2"
|
topic: "{{commandtopic}}.pco2"
|
||||||
payload: "{{unselectedfg}}"
|
payload: "{{trigger.payload}}"
|
||||||
#########################################################################
|
#########################################################################
|
||||||
# Theme: Apply unselected background color on change
|
# Theme: Apply unselected background color on change
|
||||||
- conditions:
|
- conditions:
|
||||||
- condition: template
|
- condition: template
|
||||||
value_template: "{{ trigger.topic == unselectedbgtopic }}"
|
value_template: "{{ (trigger.topic == unselectedbgtopic) and ((unselected_bgcolor|int) == -1) }}"
|
||||||
sequence:
|
sequence:
|
||||||
- service: mqtt.publish
|
- service: mqtt.publish
|
||||||
data:
|
data:
|
||||||
topic: "{{commandtopic}}.bco2"
|
topic: "{{commandtopic}}.bco2"
|
||||||
payload: "{{unselectedbg}}"
|
payload: "{{trigger.payload}}"
|
||||||
|
@ -369,7 +369,7 @@ action:
|
|||||||
# Any change to the button will remove the overlaid icon.
|
# Any change to the button will remove the overlaid icon.
|
||||||
- conditions:
|
- conditions:
|
||||||
- condition: template
|
- condition: template
|
||||||
value_template: "{{ trigger.topic == selectedfgtopic }}"
|
value_template: "{{ (trigger.topic == selectedfgtopic) and ((selected_fgcolor|int) == -1) }}"
|
||||||
sequence:
|
sequence:
|
||||||
- service: mqtt.publish
|
- service: mqtt.publish
|
||||||
data:
|
data:
|
||||||
@ -386,7 +386,7 @@ action:
|
|||||||
# Theme: Apply selected background color on change
|
# Theme: Apply selected background color on change
|
||||||
- conditions:
|
- conditions:
|
||||||
- condition: template
|
- condition: template
|
||||||
value_template: "{{ trigger.topic == selectedbgtopic }}"
|
value_template: "{{ (trigger.topic == selectedbgtopic) and ((selected_bgcolor|int) == -1) }}"
|
||||||
sequence:
|
sequence:
|
||||||
- service: mqtt.publish
|
- service: mqtt.publish
|
||||||
data:
|
data:
|
||||||
@ -403,7 +403,7 @@ action:
|
|||||||
# Theme: Apply unselected foreground color on change
|
# Theme: Apply unselected foreground color on change
|
||||||
- conditions:
|
- conditions:
|
||||||
- condition: template
|
- condition: template
|
||||||
value_template: "{{ trigger.topic == unselectedfgtopic }}"
|
value_template: "{{ (trigger.topic == unselectedfgtopic) and ((unselected_fgcolor|int) == -1) }}"
|
||||||
sequence:
|
sequence:
|
||||||
- service: mqtt.publish
|
- service: mqtt.publish
|
||||||
data:
|
data:
|
||||||
@ -420,7 +420,7 @@ action:
|
|||||||
# Theme: Apply unselected background color on change
|
# Theme: Apply unselected background color on change
|
||||||
- conditions:
|
- conditions:
|
||||||
- condition: template
|
- condition: template
|
||||||
value_template: "{{ trigger.topic == unselectedbgtopic }}"
|
value_template: "{{ (trigger.topic == unselectedbgtopic) and ((unselected_bgcolor|int) == -1) }}"
|
||||||
sequence:
|
sequence:
|
||||||
- service: mqtt.publish
|
- service: mqtt.publish
|
||||||
data:
|
data:
|
||||||
|
@ -372,7 +372,7 @@ action:
|
|||||||
# Any change to the button will remove the overlaid icon.
|
# Any change to the button will remove the overlaid icon.
|
||||||
- conditions:
|
- conditions:
|
||||||
- condition: template
|
- condition: template
|
||||||
value_template: "{{ trigger.topic == selectedfgtopic }}"
|
value_template: "{{ (trigger.topic == selectedfgtopic) and ((selected_fgcolor|int) == -1) }}"
|
||||||
sequence:
|
sequence:
|
||||||
- service: mqtt.publish
|
- service: mqtt.publish
|
||||||
data:
|
data:
|
||||||
@ -389,7 +389,7 @@ action:
|
|||||||
# Theme: Apply selected background color on change
|
# Theme: Apply selected background color on change
|
||||||
- conditions:
|
- conditions:
|
||||||
- condition: template
|
- condition: template
|
||||||
value_template: "{{ trigger.topic == selectedbgtopic }}"
|
value_template: "{{ (trigger.topic == selectedbgtopic) and ((selected_bgcolor|int) == -1) }}"
|
||||||
sequence:
|
sequence:
|
||||||
- service: mqtt.publish
|
- service: mqtt.publish
|
||||||
data:
|
data:
|
||||||
@ -406,7 +406,7 @@ action:
|
|||||||
# Theme: Apply unselected foreground color on change
|
# Theme: Apply unselected foreground color on change
|
||||||
- conditions:
|
- conditions:
|
||||||
- condition: template
|
- condition: template
|
||||||
value_template: "{{ trigger.topic == unselectedfgtopic }}"
|
value_template: "{{ (trigger.topic == unselectedfgtopic) and ((unselected_fgcolor|int) == -1) }}"
|
||||||
sequence:
|
sequence:
|
||||||
- service: mqtt.publish
|
- service: mqtt.publish
|
||||||
data:
|
data:
|
||||||
@ -423,7 +423,7 @@ action:
|
|||||||
# Theme: Apply unselected background color on change
|
# Theme: Apply unselected background color on change
|
||||||
- conditions:
|
- conditions:
|
||||||
- condition: template
|
- condition: template
|
||||||
value_template: "{{ trigger.topic == unselectedbgtopic }}"
|
value_template: "{{ (trigger.topic == unselectedbgtopic) and ((unselected_bgcolor|int) == -1) }}"
|
||||||
sequence:
|
sequence:
|
||||||
- service: mqtt.publish
|
- service: mqtt.publish
|
||||||
data:
|
data:
|
||||||
|
@ -184,6 +184,42 @@ blueprint:
|
|||||||
default: false
|
default: false
|
||||||
selector:
|
selector:
|
||||||
boolean:
|
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
|
mode: parallel
|
||||||
max_exceeded: silent
|
max_exceeded: silent
|
||||||
@ -210,6 +246,10 @@ variables:
|
|||||||
ycen: '{{ ycen_select.split(" - ")[0] | int }}'
|
ycen: '{{ ycen_select.split(" - ")[0] | int }}'
|
||||||
wrap: !input wrap
|
wrap: !input wrap
|
||||||
title_case: !input title_case
|
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 ~ "]" }}'
|
haspobject: '{{ "p[" ~ hasppage ~ "].b[" ~ haspbutton ~ "]" }}'
|
||||||
commandtopic: '{{ "hasp/" ~ haspname ~ "/command/" ~ haspobject }}'
|
commandtopic: '{{ "hasp/" ~ haspname ~ "/command/" ~ haspobject }}'
|
||||||
jsoncommandtopic: '{{ "hasp/" ~ haspname ~ "/command/json" }}'
|
jsoncommandtopic: '{{ "hasp/" ~ haspname ~ "/command/json" }}'
|
||||||
@ -238,53 +278,69 @@ variables:
|
|||||||
unselectedfgtopic: '{{ "hasp/" ~ haspname ~ "/light/unselectedforegroundcolor/rgb" }}'
|
unselectedfgtopic: '{{ "hasp/" ~ haspname ~ "/light/unselectedforegroundcolor/rgb" }}'
|
||||||
unselectedbgtopic: '{{ "hasp/" ~ haspname ~ "/light/unselectedbackgroundcolor/rgb" }}'
|
unselectedbgtopic: '{{ "hasp/" ~ haspname ~ "/light/unselectedbackgroundcolor/rgb" }}'
|
||||||
selectedfg: >-
|
selectedfg: >-
|
||||||
{%- set color = namespace() -%}
|
{%- if (selected_fgcolor|int) >= 0 -%}
|
||||||
{%- for entity in device_entities(haspdevice) -%}
|
{{ selected_fgcolor }}
|
||||||
{%- if entity|regex_search("^light\..*_selected_foreground_color(?:_\d+|)$") -%}
|
{%- else -%}
|
||||||
{%- set color.source=entity -%}
|
{%- set color = namespace() -%}
|
||||||
{%- endif -%}
|
{%- for entity in device_entities(haspdevice) -%}
|
||||||
{%- endfor -%}
|
{%- if entity|regex_search("^light\..*_selected_foreground_color(?:_\d+|)$") -%}
|
||||||
{%- set brightness = state_attr(color.source, "brightness")|int(default=255) / 255 -%}
|
{%- set color.source=entity -%}
|
||||||
{%- set red=(state_attr(color.source, "rgb_color")[0] * brightness)|int(default=0) -%}
|
{%- endif -%}
|
||||||
{%- set green=(state_attr(color.source, "rgb_color")[1] * brightness)|int(default=0) -%}
|
{%- endfor -%}
|
||||||
{%- set blue=(state_attr(color.source, "rgb_color")[2] * brightness)|int(default=0) -%}
|
{%- set brightness = state_attr(color.source, "brightness")|int(default=255) / 255 -%}
|
||||||
{{ (red|bitwise_and(248)*256) + (green|bitwise_and(252)*8) + (blue|bitwise_and(248)/8)|int }}
|
{%- 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: >-
|
selectedbg: >-
|
||||||
{%- set color = namespace() -%}
|
{%- if (selected_bgcolor|int) >= 0 -%}
|
||||||
{%- for entity in device_entities(haspdevice) -%}
|
{{ selected_bgcolor }}
|
||||||
{%- if entity|regex_search("^light\..*_selected_background_color(?:_\d+|)$") -%}
|
{%- else -%}
|
||||||
{%- set color.source=entity -%}
|
{%- set color = namespace() -%}
|
||||||
{%- endif -%}
|
{%- for entity in device_entities(haspdevice) -%}
|
||||||
{%- endfor -%}
|
{%- if entity|regex_search("^light\..*_selected_background_color(?:_\d+|)$") -%}
|
||||||
{%- set brightness = state_attr(color.source, "brightness")|int(default=255) / 255 -%}
|
{%- set color.source=entity -%}
|
||||||
{%- set red=(state_attr(color.source, "rgb_color")[0] * brightness)|int(default=0) -%}
|
{%- endif -%}
|
||||||
{%- set green=(state_attr(color.source, "rgb_color")[1] * brightness)|int(default=0) -%}
|
{%- endfor -%}
|
||||||
{%- set blue=(state_attr(color.source, "rgb_color")[2] * brightness)|int(default=0) -%}
|
{%- set brightness = state_attr(color.source, "brightness")|int(default=255) / 255 -%}
|
||||||
{{ (red|bitwise_and(248)*256) + (green|bitwise_and(252)*8) + (blue|bitwise_and(248)/8)|int }}
|
{%- 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: >-
|
unselectedfg: >-
|
||||||
{%- set color = namespace() -%}
|
{%- if (unselected_fgcolor|int) >= 0 -%}
|
||||||
{%- for entity in device_entities(haspdevice) -%}
|
{{ unselected_fgcolor }}
|
||||||
{%- if entity|regex_search("^light\..*_unselected_foreground_color(?:_\d+|)$") -%}
|
{%- else -%}
|
||||||
{%- set color.source=entity -%}
|
{%- set color = namespace() -%}
|
||||||
{%- endif -%}
|
{%- for entity in device_entities(haspdevice) -%}
|
||||||
{%- endfor -%}
|
{%- if entity|regex_search("^light\..*_unselected_foreground_color(?:_\d+|)$") -%}
|
||||||
{%- set brightness = state_attr(color.source, "brightness")|int(default=255) / 255 -%}
|
{%- set color.source=entity -%}
|
||||||
{%- set red=(state_attr(color.source, "rgb_color")[0] * brightness)|int(default=0) -%}
|
{%- endif -%}
|
||||||
{%- set green=(state_attr(color.source, "rgb_color")[1] * brightness)|int(default=0) -%}
|
{%- endfor -%}
|
||||||
{%- set blue=(state_attr(color.source, "rgb_color")[2] * brightness)|int(default=0) -%}
|
{%- set brightness = state_attr(color.source, "brightness")|int(default=255) / 255 -%}
|
||||||
{{ (red|bitwise_and(248)*256) + (green|bitwise_and(252)*8) + (blue|bitwise_and(248)/8)|int }}
|
{%- 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: >-
|
unselectedbg: >-
|
||||||
{%- set color = namespace() -%}
|
{%- if (unselected_bgcolor|int) >= 0 -%}
|
||||||
{%- for entity in device_entities(haspdevice) -%}
|
{{ unselected_bgcolor }}
|
||||||
{%- if entity|regex_search("^light\..*_unselected_background_color(?:_\d+|)$") -%}
|
{%- else -%}
|
||||||
{%- set color.source=entity -%}
|
{%- set color = namespace() -%}
|
||||||
{%- endif -%}
|
{%- for entity in device_entities(haspdevice) -%}
|
||||||
{%- endfor -%}
|
{%- if entity|regex_search("^light\..*_unselected_background_color(?:_\d+|)$") -%}
|
||||||
{%- set brightness = state_attr(color.source, "brightness")|int(default=255) / 255 -%}
|
{%- set color.source=entity -%}
|
||||||
{%- set red=(state_attr(color.source, "rgb_color")[0] * brightness)|int(default=0) -%}
|
{%- endif -%}
|
||||||
{%- set green=(state_attr(color.source, "rgb_color")[1] * brightness)|int(default=0) -%}
|
{%- endfor -%}
|
||||||
{%- set blue=(state_attr(color.source, "rgb_color")[2] * brightness)|int(default=0) -%}
|
{%- set brightness = state_attr(color.source, "brightness")|int(default=255) / 255 -%}
|
||||||
{{ (red|bitwise_and(248)*256) + (green|bitwise_and(252)*8) + (blue|bitwise_and(248)/8)|int }}
|
{%- 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:
|
trigger_variables:
|
||||||
haspdevice: !input haspdevice
|
haspdevice: !input haspdevice
|
||||||
@ -382,7 +438,7 @@ action:
|
|||||||
# Theme: Apply selected foreground color on change
|
# Theme: Apply selected foreground color on change
|
||||||
- conditions:
|
- conditions:
|
||||||
- condition: template
|
- condition: template
|
||||||
value_template: "{{ trigger.topic == selectedfgtopic }}"
|
value_template: "{{ (trigger.topic == selectedfgtopic) and ((selected_fgcolor|int) == -1) }}"
|
||||||
sequence:
|
sequence:
|
||||||
- service: mqtt.publish
|
- service: mqtt.publish
|
||||||
data:
|
data:
|
||||||
@ -392,7 +448,7 @@ action:
|
|||||||
# Theme: Apply selected background color on change
|
# Theme: Apply selected background color on change
|
||||||
- conditions:
|
- conditions:
|
||||||
- condition: template
|
- condition: template
|
||||||
value_template: "{{ trigger.topic == selectedbgtopic }}"
|
value_template: "{{ (trigger.topic == selectedbgtopic) and ((selected_bgcolor|int) == -1) }}"
|
||||||
sequence:
|
sequence:
|
||||||
- service: mqtt.publish
|
- service: mqtt.publish
|
||||||
data:
|
data:
|
||||||
@ -402,7 +458,7 @@ action:
|
|||||||
# Theme: Apply unselected foreground color on change
|
# Theme: Apply unselected foreground color on change
|
||||||
- conditions:
|
- conditions:
|
||||||
- condition: template
|
- condition: template
|
||||||
value_template: "{{ trigger.topic == unselectedfgtopic }}"
|
value_template: "{{ (trigger.topic == unselectedfgtopic) and ((unselected_fgcolor|int) == -1) }}"
|
||||||
sequence:
|
sequence:
|
||||||
- service: mqtt.publish
|
- service: mqtt.publish
|
||||||
data:
|
data:
|
||||||
@ -412,7 +468,7 @@ action:
|
|||||||
# Theme: Apply unselected background color on change
|
# Theme: Apply unselected background color on change
|
||||||
- conditions:
|
- conditions:
|
||||||
- condition: template
|
- condition: template
|
||||||
value_template: "{{ trigger.topic == unselectedbgtopic }}"
|
value_template: "{{ (trigger.topic == unselectedbgtopic) and ((unselected_bgcolor|int) == -1) }}"
|
||||||
sequence:
|
sequence:
|
||||||
- service: mqtt.publish
|
- service: mqtt.publish
|
||||||
data:
|
data:
|
||||||
|
@ -72,6 +72,28 @@ blueprint:
|
|||||||
|
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
|
## Nextion color codes
|
||||||
|
|
||||||
|
<details>
|
||||||
|
|
||||||
|
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 |
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
domain: automation
|
domain: automation
|
||||||
input:
|
input:
|
||||||
haspdevice:
|
haspdevice:
|
||||||
@ -157,6 +179,42 @@ blueprint:
|
|||||||
default: false
|
default: false
|
||||||
selector:
|
selector:
|
||||||
boolean:
|
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
|
mode: parallel
|
||||||
max_exceeded: silent
|
max_exceeded: silent
|
||||||
@ -180,6 +238,10 @@ variables:
|
|||||||
ycen_select: !input ycen_select
|
ycen_select: !input ycen_select
|
||||||
ycen: '{{ ycen_select.split(" - ")[0] | int }}'
|
ycen: '{{ ycen_select.split(" - ")[0] | int }}'
|
||||||
wrap: !input wrap
|
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 ~ "]" }}'
|
haspobject: '{{ "p[" ~ hasppage ~ "].b[" ~ haspbutton ~ "]" }}'
|
||||||
commandtopic: '{{ "hasp/" ~ haspname ~ "/command/" ~ haspobject }}'
|
commandtopic: '{{ "hasp/" ~ haspname ~ "/command/" ~ haspobject }}'
|
||||||
jsoncommandtopic: '{{ "hasp/" ~ haspname ~ "/command/json" }}'
|
jsoncommandtopic: '{{ "hasp/" ~ haspname ~ "/command/json" }}'
|
||||||
@ -189,53 +251,69 @@ variables:
|
|||||||
unselectedfgtopic: '{{ "hasp/" ~ haspname ~ "/light/unselectedforegroundcolor/rgb" }}'
|
unselectedfgtopic: '{{ "hasp/" ~ haspname ~ "/light/unselectedforegroundcolor/rgb" }}'
|
||||||
unselectedbgtopic: '{{ "hasp/" ~ haspname ~ "/light/unselectedbackgroundcolor/rgb" }}'
|
unselectedbgtopic: '{{ "hasp/" ~ haspname ~ "/light/unselectedbackgroundcolor/rgb" }}'
|
||||||
selectedfg: >-
|
selectedfg: >-
|
||||||
{%- set color = namespace() -%}
|
{%- if (selected_fgcolor|int) >= 0 -%}
|
||||||
{%- for entity in device_entities(haspdevice) -%}
|
{{ selected_fgcolor }}
|
||||||
{%- if entity|regex_search("^light\..*_selected_foreground_color(?:_\d+|)$") -%}
|
{%- else -%}
|
||||||
{%- set color.source=entity -%}
|
{%- set color = namespace() -%}
|
||||||
{%- endif -%}
|
{%- for entity in device_entities(haspdevice) -%}
|
||||||
{%- endfor -%}
|
{%- if entity|regex_search("^light\..*_selected_foreground_color(?:_\d+|)$") -%}
|
||||||
{%- set brightness = state_attr(color.source, "brightness")|int(default=255) / 255 -%}
|
{%- set color.source=entity -%}
|
||||||
{%- set red=(state_attr(color.source, "rgb_color")[0] * brightness)|int(default=0) -%}
|
{%- endif -%}
|
||||||
{%- set green=(state_attr(color.source, "rgb_color")[1] * brightness)|int(default=0) -%}
|
{%- endfor -%}
|
||||||
{%- set blue=(state_attr(color.source, "rgb_color")[2] * brightness)|int(default=0) -%}
|
{%- set brightness = state_attr(color.source, "brightness")|int(default=255) / 255 -%}
|
||||||
{{ (red|bitwise_and(248)*256) + (green|bitwise_and(252)*8) + (blue|bitwise_and(248)/8)|int }}
|
{%- 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: >-
|
selectedbg: >-
|
||||||
{%- set color = namespace() -%}
|
{%- if (selected_bgcolor|int) >= 0 -%}
|
||||||
{%- for entity in device_entities(haspdevice) -%}
|
{{ selected_bgcolor }}
|
||||||
{%- if entity|regex_search("^light\..*_selected_background_color(?:_\d+|)$") -%}
|
{%- else -%}
|
||||||
{%- set color.source=entity -%}
|
{%- set color = namespace() -%}
|
||||||
{%- endif -%}
|
{%- for entity in device_entities(haspdevice) -%}
|
||||||
{%- endfor -%}
|
{%- if entity|regex_search("^light\..*_selected_background_color(?:_\d+|)$") -%}
|
||||||
{%- set brightness = state_attr(color.source, "brightness")|int(default=255) / 255 -%}
|
{%- set color.source=entity -%}
|
||||||
{%- set red=(state_attr(color.source, "rgb_color")[0] * brightness)|int(default=0) -%}
|
{%- endif -%}
|
||||||
{%- set green=(state_attr(color.source, "rgb_color")[1] * brightness)|int(default=0) -%}
|
{%- endfor -%}
|
||||||
{%- set blue=(state_attr(color.source, "rgb_color")[2] * brightness)|int(default=0) -%}
|
{%- set brightness = state_attr(color.source, "brightness")|int(default=255) / 255 -%}
|
||||||
{{ (red|bitwise_and(248)*256) + (green|bitwise_and(252)*8) + (blue|bitwise_and(248)/8)|int }}
|
{%- 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: >-
|
unselectedfg: >-
|
||||||
{%- set color = namespace() -%}
|
{%- if (unselected_fgcolor|int) >= 0 -%}
|
||||||
{%- for entity in device_entities(haspdevice) -%}
|
{{ unselected_fgcolor }}
|
||||||
{%- if entity|regex_search("^light\..*_unselected_foreground_color(?:_\d+|)$") -%}
|
{%- else -%}
|
||||||
{%- set color.source=entity -%}
|
{%- set color = namespace() -%}
|
||||||
{%- endif -%}
|
{%- for entity in device_entities(haspdevice) -%}
|
||||||
{%- endfor -%}
|
{%- if entity|regex_search("^light\..*_unselected_foreground_color(?:_\d+|)$") -%}
|
||||||
{%- set brightness = state_attr(color.source, "brightness")|int(default=255) / 255 -%}
|
{%- set color.source=entity -%}
|
||||||
{%- set red=(state_attr(color.source, "rgb_color")[0] * brightness)|int(default=0) -%}
|
{%- endif -%}
|
||||||
{%- set green=(state_attr(color.source, "rgb_color")[1] * brightness)|int(default=0) -%}
|
{%- endfor -%}
|
||||||
{%- set blue=(state_attr(color.source, "rgb_color")[2] * brightness)|int(default=0) -%}
|
{%- set brightness = state_attr(color.source, "brightness")|int(default=255) / 255 -%}
|
||||||
{{ (red|bitwise_and(248)*256) + (green|bitwise_and(252)*8) + (blue|bitwise_and(248)/8)|int }}
|
{%- 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: >-
|
unselectedbg: >-
|
||||||
{%- set color = namespace() -%}
|
{%- if (unselected_bgcolor|int) >= 0 -%}
|
||||||
{%- for entity in device_entities(haspdevice) -%}
|
{{ unselected_bgcolor }}
|
||||||
{%- if entity|regex_search("^light\..*_unselected_background_color(?:_\d+|)$") -%}
|
{%- else -%}
|
||||||
{%- set color.source=entity -%}
|
{%- set color = namespace() -%}
|
||||||
{%- endif -%}
|
{%- for entity in device_entities(haspdevice) -%}
|
||||||
{%- endfor -%}
|
{%- if entity|regex_search("^light\..*_unselected_background_color(?:_\d+|)$") -%}
|
||||||
{%- set brightness = state_attr(color.source, "brightness")|int(default=255) / 255 -%}
|
{%- set color.source=entity -%}
|
||||||
{%- set red=(state_attr(color.source, "rgb_color")[0] * brightness)|int(default=0) -%}
|
{%- endif -%}
|
||||||
{%- set green=(state_attr(color.source, "rgb_color")[1] * brightness)|int(default=0) -%}
|
{%- endfor -%}
|
||||||
{%- set blue=(state_attr(color.source, "rgb_color")[2] * brightness)|int(default=0) -%}
|
{%- set brightness = state_attr(color.source, "brightness")|int(default=255) / 255 -%}
|
||||||
{{ (red|bitwise_and(248)*256) + (green|bitwise_and(252)*8) + (blue|bitwise_and(248)/8)|int }}
|
{%- 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:
|
trigger_variables:
|
||||||
haspdevice: !input haspdevice
|
haspdevice: !input haspdevice
|
||||||
@ -355,7 +433,7 @@ action:
|
|||||||
# Theme: Apply selected foreground color on change
|
# Theme: Apply selected foreground color on change
|
||||||
- conditions:
|
- conditions:
|
||||||
- condition: template
|
- condition: template
|
||||||
value_template: "{{ trigger.topic == selectedfgtopic }}"
|
value_template: "{{ (trigger.topic == selectedfgtopic) and ((selected_fgcolor|int) == -1) }}"
|
||||||
sequence:
|
sequence:
|
||||||
- service: mqtt.publish
|
- service: mqtt.publish
|
||||||
data:
|
data:
|
||||||
@ -365,7 +443,7 @@ action:
|
|||||||
# Theme: Apply selected background color on change
|
# Theme: Apply selected background color on change
|
||||||
- conditions:
|
- conditions:
|
||||||
- condition: template
|
- condition: template
|
||||||
value_template: "{{ trigger.topic == selectedbgtopic }}"
|
value_template: "{{ (trigger.topic == selectedbgtopic) and ((selected_bgcolor|int) == -1) }}"
|
||||||
sequence:
|
sequence:
|
||||||
- service: mqtt.publish
|
- service: mqtt.publish
|
||||||
data:
|
data:
|
||||||
@ -375,7 +453,7 @@ action:
|
|||||||
# Theme: Apply unselected foreground color on change
|
# Theme: Apply unselected foreground color on change
|
||||||
- conditions:
|
- conditions:
|
||||||
- condition: template
|
- condition: template
|
||||||
value_template: "{{ trigger.topic == unselectedfgtopic }}"
|
value_template: "{{ (trigger.topic == unselectedfgtopic) and ((unselected_fgcolor|int) == -1) }}"
|
||||||
sequence:
|
sequence:
|
||||||
- service: mqtt.publish
|
- service: mqtt.publish
|
||||||
data:
|
data:
|
||||||
@ -385,7 +463,7 @@ action:
|
|||||||
# Theme: Apply unselected background color on change
|
# Theme: Apply unselected background color on change
|
||||||
- conditions:
|
- conditions:
|
||||||
- condition: template
|
- condition: template
|
||||||
value_template: "{{ trigger.topic == unselectedbgtopic }}"
|
value_template: "{{ (trigger.topic == unselectedbgtopic) and ((unselected_bgcolor|int) == -1) }}"
|
||||||
sequence:
|
sequence:
|
||||||
- service: mqtt.publish
|
- service: mqtt.publish
|
||||||
data:
|
data:
|
||||||
|
@ -380,39 +380,39 @@ action:
|
|||||||
# Theme: Apply selected foreground color on change
|
# Theme: Apply selected foreground color on change
|
||||||
- conditions:
|
- conditions:
|
||||||
- condition: template
|
- condition: template
|
||||||
value_template: "{{ trigger.topic == selectedfgtopic }}"
|
value_template: "{{ (trigger.topic == selectedfgtopic) and ((selected_fgcolor|int) == -1) }}"
|
||||||
sequence:
|
sequence:
|
||||||
- service: mqtt.publish
|
- service: mqtt.publish
|
||||||
data:
|
data:
|
||||||
topic: "{{commandtopic}}.pco"
|
topic: "{{commandtopic}}.pco"
|
||||||
payload: "{{selectedfg}}"
|
payload: "{{trigger.payload}}"
|
||||||
#########################################################################
|
#########################################################################
|
||||||
# Theme: Apply selected background color on change
|
# Theme: Apply selected background color on change
|
||||||
- conditions:
|
- conditions:
|
||||||
- condition: template
|
- condition: template
|
||||||
value_template: "{{ trigger.topic == selectedbgtopic }}"
|
value_template: "{{ (trigger.topic == selectedbgtopic) and ((selected_bgcolor|int) == -1) }}"
|
||||||
sequence:
|
sequence:
|
||||||
- service: mqtt.publish
|
- service: mqtt.publish
|
||||||
data:
|
data:
|
||||||
topic: "{{commandtopic}}.bco"
|
topic: "{{commandtopic}}.bco"
|
||||||
payload: "{{selectedbg}}"
|
payload: "{{trigger.payload}}"
|
||||||
#########################################################################
|
#########################################################################
|
||||||
# Theme: Apply unselected foreground color on change
|
# Theme: Apply unselected foreground color on change
|
||||||
- conditions:
|
- conditions:
|
||||||
- condition: template
|
- condition: template
|
||||||
value_template: "{{ trigger.topic == unselectedfgtopic }}"
|
value_template: "{{ (trigger.topic == unselectedfgtopic) and ((unselected_fgcolor|int) == -1) }}"
|
||||||
sequence:
|
sequence:
|
||||||
- service: mqtt.publish
|
- service: mqtt.publish
|
||||||
data:
|
data:
|
||||||
topic: "{{commandtopic}}.pco2"
|
topic: "{{commandtopic}}.pco2"
|
||||||
payload: "{{unselectedfg}}"
|
payload: "{{trigger.payload}}"
|
||||||
#########################################################################
|
#########################################################################
|
||||||
# Theme: Apply unselected background color on change
|
# Theme: Apply unselected background color on change
|
||||||
- conditions:
|
- conditions:
|
||||||
- condition: template
|
- condition: template
|
||||||
value_template: "{{ trigger.topic == unselectedbgtopic }}"
|
value_template: "{{ (trigger.topic == unselectedbgtopic) and ((unselected_bgcolor|int) == -1) }}"
|
||||||
sequence:
|
sequence:
|
||||||
- service: mqtt.publish
|
- service: mqtt.publish
|
||||||
data:
|
data:
|
||||||
topic: "{{commandtopic}}.bco2"
|
topic: "{{commandtopic}}.bco2"
|
||||||
payload: "{{unselectedbg}}"
|
payload: "{{trigger.payload}}"
|
||||||
|
@ -60,6 +60,28 @@ blueprint:
|
|||||||
|
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
|
## Nextion color codes
|
||||||
|
|
||||||
|
<details>
|
||||||
|
|
||||||
|
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 |
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
domain: automation
|
domain: automation
|
||||||
input:
|
input:
|
||||||
haspdevice:
|
haspdevice:
|
||||||
@ -140,6 +162,42 @@ blueprint:
|
|||||||
default: false
|
default: false
|
||||||
selector:
|
selector:
|
||||||
boolean:
|
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
|
mode: parallel
|
||||||
max_exceeded: silent
|
max_exceeded: silent
|
||||||
@ -162,6 +220,10 @@ variables:
|
|||||||
ycen_select: !input ycen_select
|
ycen_select: !input ycen_select
|
||||||
ycen: '{{ ycen_select.split(" - ")[0] | int }}'
|
ycen: '{{ ycen_select.split(" - ")[0] | int }}'
|
||||||
wrap: !input wrap
|
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 ~ "]" }}'
|
haspobject: '{{ "p[" ~ hasppage ~ "].b[" ~ haspbutton ~ "]" }}'
|
||||||
commandtopic: '{{ "hasp/" ~ haspname ~ "/command/" ~ haspobject }}'
|
commandtopic: '{{ "hasp/" ~ haspname ~ "/command/" ~ haspobject }}'
|
||||||
jsoncommandtopic: '{{ "hasp/" ~ haspname ~ "/command/json" }}'
|
jsoncommandtopic: '{{ "hasp/" ~ haspname ~ "/command/json" }}'
|
||||||
@ -173,53 +235,69 @@ variables:
|
|||||||
unselectedfgtopic: '{{ "hasp/" ~ haspname ~ "/light/unselectedforegroundcolor/rgb" }}'
|
unselectedfgtopic: '{{ "hasp/" ~ haspname ~ "/light/unselectedforegroundcolor/rgb" }}'
|
||||||
unselectedbgtopic: '{{ "hasp/" ~ haspname ~ "/light/unselectedbackgroundcolor/rgb" }}'
|
unselectedbgtopic: '{{ "hasp/" ~ haspname ~ "/light/unselectedbackgroundcolor/rgb" }}'
|
||||||
selectedfg: >-
|
selectedfg: >-
|
||||||
{%- set color = namespace() -%}
|
{%- if (selected_fgcolor|int) >= 0 -%}
|
||||||
{%- for entity in device_entities(haspdevice) -%}
|
{{ selected_fgcolor }}
|
||||||
{%- if entity|regex_search("^light\..*_selected_foreground_color(?:_\d+|)$") -%}
|
{%- else -%}
|
||||||
{%- set color.source=entity -%}
|
{%- set color = namespace() -%}
|
||||||
{%- endif -%}
|
{%- for entity in device_entities(haspdevice) -%}
|
||||||
{%- endfor -%}
|
{%- if entity|regex_search("^light\..*_selected_foreground_color(?:_\d+|)$") -%}
|
||||||
{%- set brightness = state_attr(color.source, "brightness")|int(default=255) / 255 -%}
|
{%- set color.source=entity -%}
|
||||||
{%- set red=(state_attr(color.source, "rgb_color")[0] * brightness)|int(default=0) -%}
|
{%- endif -%}
|
||||||
{%- set green=(state_attr(color.source, "rgb_color")[1] * brightness)|int(default=0) -%}
|
{%- endfor -%}
|
||||||
{%- set blue=(state_attr(color.source, "rgb_color")[2] * brightness)|int(default=0) -%}
|
{%- set brightness = state_attr(color.source, "brightness")|int(default=255) / 255 -%}
|
||||||
{{ (red|bitwise_and(248)*256) + (green|bitwise_and(252)*8) + (blue|bitwise_and(248)/8)|int }}
|
{%- 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: >-
|
selectedbg: >-
|
||||||
{%- set color = namespace() -%}
|
{%- if (selected_bgcolor|int) >= 0 -%}
|
||||||
{%- for entity in device_entities(haspdevice) -%}
|
{{ selected_bgcolor }}
|
||||||
{%- if entity|regex_search("^light\..*_selected_background_color(?:_\d+|)$") -%}
|
{%- else -%}
|
||||||
{%- set color.source=entity -%}
|
{%- set color = namespace() -%}
|
||||||
{%- endif -%}
|
{%- for entity in device_entities(haspdevice) -%}
|
||||||
{%- endfor -%}
|
{%- if entity|regex_search("^light\..*_selected_background_color(?:_\d+|)$") -%}
|
||||||
{%- set brightness = state_attr(color.source, "brightness")|int(default=255) / 255 -%}
|
{%- set color.source=entity -%}
|
||||||
{%- set red=(state_attr(color.source, "rgb_color")[0] * brightness)|int(default=0) -%}
|
{%- endif -%}
|
||||||
{%- set green=(state_attr(color.source, "rgb_color")[1] * brightness)|int(default=0) -%}
|
{%- endfor -%}
|
||||||
{%- set blue=(state_attr(color.source, "rgb_color")[2] * brightness)|int(default=0) -%}
|
{%- set brightness = state_attr(color.source, "brightness")|int(default=255) / 255 -%}
|
||||||
{{ (red|bitwise_and(248)*256) + (green|bitwise_and(252)*8) + (blue|bitwise_and(248)/8)|int }}
|
{%- 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: >-
|
unselectedfg: >-
|
||||||
{%- set color = namespace() -%}
|
{%- if (unselected_fgcolor|int) >= 0 -%}
|
||||||
{%- for entity in device_entities(haspdevice) -%}
|
{{ unselected_fgcolor }}
|
||||||
{%- if entity|regex_search("^light\..*_unselected_foreground_color(?:_\d+|)$") -%}
|
{%- else -%}
|
||||||
{%- set color.source=entity -%}
|
{%- set color = namespace() -%}
|
||||||
{%- endif -%}
|
{%- for entity in device_entities(haspdevice) -%}
|
||||||
{%- endfor -%}
|
{%- if entity|regex_search("^light\..*_unselected_foreground_color(?:_\d+|)$") -%}
|
||||||
{%- set brightness = state_attr(color.source, "brightness")|int(default=255) / 255 -%}
|
{%- set color.source=entity -%}
|
||||||
{%- set red=(state_attr(color.source, "rgb_color")[0] * brightness)|int(default=0) -%}
|
{%- endif -%}
|
||||||
{%- set green=(state_attr(color.source, "rgb_color")[1] * brightness)|int(default=0) -%}
|
{%- endfor -%}
|
||||||
{%- set blue=(state_attr(color.source, "rgb_color")[2] * brightness)|int(default=0) -%}
|
{%- set brightness = state_attr(color.source, "brightness")|int(default=255) / 255 -%}
|
||||||
{{ (red|bitwise_and(248)*256) + (green|bitwise_and(252)*8) + (blue|bitwise_and(248)/8)|int }}
|
{%- 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: >-
|
unselectedbg: >-
|
||||||
{%- set color = namespace() -%}
|
{%- if (unselected_bgcolor|int) >= 0 -%}
|
||||||
{%- for entity in device_entities(haspdevice) -%}
|
{{ unselected_bgcolor }}
|
||||||
{%- if entity|regex_search("^light\..*_unselected_background_color(?:_\d+|)$") -%}
|
{%- else -%}
|
||||||
{%- set color.source=entity -%}
|
{%- set color = namespace() -%}
|
||||||
{%- endif -%}
|
{%- for entity in device_entities(haspdevice) -%}
|
||||||
{%- endfor -%}
|
{%- if entity|regex_search("^light\..*_unselected_background_color(?:_\d+|)$") -%}
|
||||||
{%- set brightness = state_attr(color.source, "brightness")|int(default=255) / 255 -%}
|
{%- set color.source=entity -%}
|
||||||
{%- set red=(state_attr(color.source, "rgb_color")[0] * brightness)|int(default=0) -%}
|
{%- endif -%}
|
||||||
{%- set green=(state_attr(color.source, "rgb_color")[1] * brightness)|int(default=0) -%}
|
{%- endfor -%}
|
||||||
{%- set blue=(state_attr(color.source, "rgb_color")[2] * brightness)|int(default=0) -%}
|
{%- set brightness = state_attr(color.source, "brightness")|int(default=255) / 255 -%}
|
||||||
{{ (red|bitwise_and(248)*256) + (green|bitwise_and(252)*8) + (blue|bitwise_and(248)/8)|int }}
|
{%- 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:
|
trigger_variables:
|
||||||
haspdevice: !input haspdevice
|
haspdevice: !input haspdevice
|
||||||
@ -313,12 +391,10 @@ action:
|
|||||||
sequence:
|
sequence:
|
||||||
- choose:
|
- choose:
|
||||||
#########################################################################
|
#########################################################################
|
||||||
# Theme: Apply selected foreground color when it changes.
|
# Theme: Apply selected foreground color on change
|
||||||
# If the page is currently active, delay a moment before applying the overlay
|
|
||||||
# so it will fire after any other theme elements being applied.
|
|
||||||
- conditions:
|
- conditions:
|
||||||
- condition: template
|
- condition: template
|
||||||
value_template: "{{ trigger.topic == selectedfgtopic }}"
|
value_template: "{{ (trigger.topic == selectedfgtopic) and ((selected_fgcolor|int) == -1) }}"
|
||||||
sequence:
|
sequence:
|
||||||
- service: mqtt.publish
|
- service: mqtt.publish
|
||||||
data:
|
data:
|
||||||
@ -328,7 +404,7 @@ action:
|
|||||||
# Theme: Apply selected background color on change
|
# Theme: Apply selected background color on change
|
||||||
- conditions:
|
- conditions:
|
||||||
- condition: template
|
- condition: template
|
||||||
value_template: "{{ trigger.topic == selectedbgtopic }}"
|
value_template: "{{ (trigger.topic == selectedbgtopic) and ((selected_bgcolor|int) == -1) }}"
|
||||||
sequence:
|
sequence:
|
||||||
- service: mqtt.publish
|
- service: mqtt.publish
|
||||||
data:
|
data:
|
||||||
@ -338,7 +414,7 @@ action:
|
|||||||
# Theme: Apply unselected foreground color on change
|
# Theme: Apply unselected foreground color on change
|
||||||
- conditions:
|
- conditions:
|
||||||
- condition: template
|
- condition: template
|
||||||
value_template: "{{ trigger.topic == unselectedfgtopic }}"
|
value_template: "{{ (trigger.topic == unselectedfgtopic) and ((unselected_fgcolor|int) == -1) }}"
|
||||||
sequence:
|
sequence:
|
||||||
- service: mqtt.publish
|
- service: mqtt.publish
|
||||||
data:
|
data:
|
||||||
@ -348,7 +424,7 @@ action:
|
|||||||
# Theme: Apply unselected background color on change
|
# Theme: Apply unselected background color on change
|
||||||
- conditions:
|
- conditions:
|
||||||
- condition: template
|
- condition: template
|
||||||
value_template: "{{ trigger.topic == unselectedbgtopic }}"
|
value_template: "{{ (trigger.topic == unselectedbgtopic) and ((unselected_bgcolor|int) == -1) }}"
|
||||||
sequence:
|
sequence:
|
||||||
- service: mqtt.publish
|
- service: mqtt.publish
|
||||||
data:
|
data:
|
||||||
|
@ -457,7 +457,7 @@ action:
|
|||||||
# Any change to the button will remove the overlaid icon.
|
# Any change to the button will remove the overlaid icon.
|
||||||
- conditions:
|
- conditions:
|
||||||
- condition: template
|
- condition: template
|
||||||
value_template: "{{ trigger.topic == selectedfgtopic }}"
|
value_template: "{{ (trigger.topic == selectedfgtopic) and ((selected_fgcolor|int) == -1) }}"
|
||||||
sequence:
|
sequence:
|
||||||
- service: mqtt.publish
|
- service: mqtt.publish
|
||||||
data:
|
data:
|
||||||
@ -474,7 +474,7 @@ action:
|
|||||||
# Theme: Apply selected background color on change
|
# Theme: Apply selected background color on change
|
||||||
- conditions:
|
- conditions:
|
||||||
- condition: template
|
- condition: template
|
||||||
value_template: "{{ trigger.topic == selectedbgtopic }}"
|
value_template: "{{ (trigger.topic == selectedbgtopic) and ((selected_bgcolor|int) == -1) }}"
|
||||||
sequence:
|
sequence:
|
||||||
- service: mqtt.publish
|
- service: mqtt.publish
|
||||||
data:
|
data:
|
||||||
@ -491,7 +491,7 @@ action:
|
|||||||
# Theme: Apply unselected foreground color on change
|
# Theme: Apply unselected foreground color on change
|
||||||
- conditions:
|
- conditions:
|
||||||
- condition: template
|
- condition: template
|
||||||
value_template: "{{ trigger.topic == unselectedfgtopic }}"
|
value_template: "{{ (trigger.topic == unselectedfgtopic) and ((unselected_fgcolor|int) == -1) }}"
|
||||||
sequence:
|
sequence:
|
||||||
- service: mqtt.publish
|
- service: mqtt.publish
|
||||||
data:
|
data:
|
||||||
@ -508,7 +508,7 @@ action:
|
|||||||
# Theme: Apply unselected background color on change
|
# Theme: Apply unselected background color on change
|
||||||
- conditions:
|
- conditions:
|
||||||
- condition: template
|
- condition: template
|
||||||
value_template: "{{ trigger.topic == unselectedbgtopic }}"
|
value_template: "{{ (trigger.topic == unselectedbgtopic) and ((unselected_bgcolor|int) == -1) }}"
|
||||||
sequence:
|
sequence:
|
||||||
- service: mqtt.publish
|
- service: mqtt.publish
|
||||||
data:
|
data:
|
||||||
|
@ -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.
|
||||||
|
|
||||||
<details>
|
<details>
|
||||||
|
|
||||||
@ -58,6 +60,30 @@ blueprint:
|
|||||||
|
|
||||||
  
|
  
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
## Nextion color codes
|
||||||
|
|
||||||
|
<details>
|
||||||
|
|
||||||
|
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 |
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
domain: automation
|
domain: automation
|
||||||
input:
|
input:
|
||||||
haspdevice:
|
haspdevice:
|
||||||
@ -166,6 +192,42 @@ blueprint:
|
|||||||
default: true
|
default: true
|
||||||
selector:
|
selector:
|
||||||
boolean:
|
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
|
mode: parallel
|
||||||
max_exceeded: silent
|
max_exceeded: silent
|
||||||
@ -192,6 +254,10 @@ variables:
|
|||||||
ycen: '{{ ycen_select.split(" - ")[0] | int }}'
|
ycen: '{{ ycen_select.split(" - ")[0] | int }}'
|
||||||
wrap: !input wrap
|
wrap: !input wrap
|
||||||
title_case: !input title_case
|
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 ~ "]" }}'
|
haspobject: '{{ "p[" ~ hasppage ~ "].b[" ~ haspbutton ~ "]" }}'
|
||||||
commandtopic: '{{ "hasp/" ~ haspname ~ "/command/" ~ haspobject }}'
|
commandtopic: '{{ "hasp/" ~ haspname ~ "/command/" ~ haspobject }}'
|
||||||
jsoncommandtopic: '{{ "hasp/" ~ haspname ~ "/command/json" }}'
|
jsoncommandtopic: '{{ "hasp/" ~ haspname ~ "/command/json" }}'
|
||||||
@ -200,9 +266,9 @@ variables:
|
|||||||
{{ prefix }}
|
{{ prefix }}
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
{%- if title_case -%}
|
{%- 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 -%}
|
{%- 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 -%}
|
{%- endif -%}
|
||||||
isbr: "{% if wrap == true %}1{% else %}0{% endif %}"
|
isbr: "{% if wrap == true %}1{% else %}0{% endif %}"
|
||||||
selectedfgtopic: '{{ "hasp/" ~ haspname ~ "/light/selectedforegroundcolor/rgb" }}'
|
selectedfgtopic: '{{ "hasp/" ~ haspname ~ "/light/selectedforegroundcolor/rgb" }}'
|
||||||
@ -210,53 +276,69 @@ variables:
|
|||||||
unselectedfgtopic: '{{ "hasp/" ~ haspname ~ "/light/unselectedforegroundcolor/rgb" }}'
|
unselectedfgtopic: '{{ "hasp/" ~ haspname ~ "/light/unselectedforegroundcolor/rgb" }}'
|
||||||
unselectedbgtopic: '{{ "hasp/" ~ haspname ~ "/light/unselectedbackgroundcolor/rgb" }}'
|
unselectedbgtopic: '{{ "hasp/" ~ haspname ~ "/light/unselectedbackgroundcolor/rgb" }}'
|
||||||
selectedfg: >-
|
selectedfg: >-
|
||||||
{%- set color = namespace() -%}
|
{%- if (selected_fgcolor|int) >= 0 -%}
|
||||||
{%- for entity in device_entities(haspdevice) -%}
|
{{ selected_fgcolor }}
|
||||||
{%- if entity|regex_search("^light\..*_selected_foreground_color(?:_\d+|)$") -%}
|
{%- else -%}
|
||||||
{%- set color.source=entity -%}
|
{%- set color = namespace() -%}
|
||||||
{%- endif -%}
|
{%- for entity in device_entities(haspdevice) -%}
|
||||||
{%- endfor -%}
|
{%- if entity|regex_search("^light\..*_selected_foreground_color(?:_\d+|)$") -%}
|
||||||
{%- set brightness = state_attr(color.source, "brightness")|int(default=255) / 255 -%}
|
{%- set color.source=entity -%}
|
||||||
{%- set red=(state_attr(color.source, "rgb_color")[0] * brightness)|int(default=0) -%}
|
{%- endif -%}
|
||||||
{%- set green=(state_attr(color.source, "rgb_color")[1] * brightness)|int(default=0) -%}
|
{%- endfor -%}
|
||||||
{%- set blue=(state_attr(color.source, "rgb_color")[2] * brightness)|int(default=0) -%}
|
{%- set brightness = state_attr(color.source, "brightness")|int(default=255) / 255 -%}
|
||||||
{{ (red|bitwise_and(248)*256) + (green|bitwise_and(252)*8) + (blue|bitwise_and(248)/8)|int }}
|
{%- 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: >-
|
selectedbg: >-
|
||||||
{%- set color = namespace() -%}
|
{%- if (selected_bgcolor|int) >= 0 -%}
|
||||||
{%- for entity in device_entities(haspdevice) -%}
|
{{ selected_bgcolor }}
|
||||||
{%- if entity|regex_search("^light\..*_selected_background_color(?:_\d+|)$") -%}
|
{%- else -%}
|
||||||
{%- set color.source=entity -%}
|
{%- set color = namespace() -%}
|
||||||
{%- endif -%}
|
{%- for entity in device_entities(haspdevice) -%}
|
||||||
{%- endfor -%}
|
{%- if entity|regex_search("^light\..*_selected_background_color(?:_\d+|)$") -%}
|
||||||
{%- set brightness = state_attr(color.source, "brightness")|int(default=255) / 255 -%}
|
{%- set color.source=entity -%}
|
||||||
{%- set red=(state_attr(color.source, "rgb_color")[0] * brightness)|int(default=0) -%}
|
{%- endif -%}
|
||||||
{%- set green=(state_attr(color.source, "rgb_color")[1] * brightness)|int(default=0) -%}
|
{%- endfor -%}
|
||||||
{%- set blue=(state_attr(color.source, "rgb_color")[2] * brightness)|int(default=0) -%}
|
{%- set brightness = state_attr(color.source, "brightness")|int(default=255) / 255 -%}
|
||||||
{{ (red|bitwise_and(248)*256) + (green|bitwise_and(252)*8) + (blue|bitwise_and(248)/8)|int }}
|
{%- 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: >-
|
unselectedfg: >-
|
||||||
{%- set color = namespace() -%}
|
{%- if (unselected_fgcolor|int) >= 0 -%}
|
||||||
{%- for entity in device_entities(haspdevice) -%}
|
{{ unselected_fgcolor }}
|
||||||
{%- if entity|regex_search("^light\..*_unselected_foreground_color(?:_\d+|)$") -%}
|
{%- else -%}
|
||||||
{%- set color.source=entity -%}
|
{%- set color = namespace() -%}
|
||||||
{%- endif -%}
|
{%- for entity in device_entities(haspdevice) -%}
|
||||||
{%- endfor -%}
|
{%- if entity|regex_search("^light\..*_unselected_foreground_color(?:_\d+|)$") -%}
|
||||||
{%- set brightness = state_attr(color.source, "brightness")|int(default=255) / 255 -%}
|
{%- set color.source=entity -%}
|
||||||
{%- set red=(state_attr(color.source, "rgb_color")[0] * brightness)|int(default=0) -%}
|
{%- endif -%}
|
||||||
{%- set green=(state_attr(color.source, "rgb_color")[1] * brightness)|int(default=0) -%}
|
{%- endfor -%}
|
||||||
{%- set blue=(state_attr(color.source, "rgb_color")[2] * brightness)|int(default=0) -%}
|
{%- set brightness = state_attr(color.source, "brightness")|int(default=255) / 255 -%}
|
||||||
{{ (red|bitwise_and(248)*256) + (green|bitwise_and(252)*8) + (blue|bitwise_and(248)/8)|int }}
|
{%- 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: >-
|
unselectedbg: >-
|
||||||
{%- set color = namespace() -%}
|
{%- if (unselected_bgcolor|int) >= 0 -%}
|
||||||
{%- for entity in device_entities(haspdevice) -%}
|
{{ unselected_bgcolor }}
|
||||||
{%- if entity|regex_search("^light\..*_unselected_background_color(?:_\d+|)$") -%}
|
{%- else -%}
|
||||||
{%- set color.source=entity -%}
|
{%- set color = namespace() -%}
|
||||||
{%- endif -%}
|
{%- for entity in device_entities(haspdevice) -%}
|
||||||
{%- endfor -%}
|
{%- if entity|regex_search("^light\..*_unselected_background_color(?:_\d+|)$") -%}
|
||||||
{%- set brightness = state_attr(color.source, "brightness")|int(default=255) / 255 -%}
|
{%- set color.source=entity -%}
|
||||||
{%- set red=(state_attr(color.source, "rgb_color")[0] * brightness)|int(default=0) -%}
|
{%- endif -%}
|
||||||
{%- set green=(state_attr(color.source, "rgb_color")[1] * brightness)|int(default=0) -%}
|
{%- endfor -%}
|
||||||
{%- set blue=(state_attr(color.source, "rgb_color")[2] * brightness)|int(default=0) -%}
|
{%- set brightness = state_attr(color.source, "brightness")|int(default=255) / 255 -%}
|
||||||
{{ (red|bitwise_and(248)*256) + (green|bitwise_and(252)*8) + (blue|bitwise_and(248)/8)|int }}
|
{%- 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:
|
trigger_variables:
|
||||||
haspdevice: !input haspdevice
|
haspdevice: !input haspdevice
|
||||||
@ -350,7 +432,7 @@ action:
|
|||||||
# Theme: Apply selected foreground color on change
|
# Theme: Apply selected foreground color on change
|
||||||
- conditions:
|
- conditions:
|
||||||
- condition: template
|
- condition: template
|
||||||
value_template: "{{ trigger.topic == selectedfgtopic }}"
|
value_template: "{{ (trigger.topic == selectedfgtopic) and ((selected_fgcolor|int) == -1) }}"
|
||||||
sequence:
|
sequence:
|
||||||
- service: mqtt.publish
|
- service: mqtt.publish
|
||||||
data:
|
data:
|
||||||
@ -360,7 +442,7 @@ action:
|
|||||||
# Theme: Apply selected background color on change
|
# Theme: Apply selected background color on change
|
||||||
- conditions:
|
- conditions:
|
||||||
- condition: template
|
- condition: template
|
||||||
value_template: "{{ trigger.topic == selectedbgtopic }}"
|
value_template: "{{ (trigger.topic == selectedbgtopic) and ((selected_bgcolor|int) == -1) }}"
|
||||||
sequence:
|
sequence:
|
||||||
- service: mqtt.publish
|
- service: mqtt.publish
|
||||||
data:
|
data:
|
||||||
@ -370,7 +452,7 @@ action:
|
|||||||
# Theme: Apply unselected foreground color on change
|
# Theme: Apply unselected foreground color on change
|
||||||
- conditions:
|
- conditions:
|
||||||
- condition: template
|
- condition: template
|
||||||
value_template: "{{ trigger.topic == unselectedfgtopic }}"
|
value_template: "{{ (trigger.topic == unselectedfgtopic) and ((unselected_fgcolor|int) == -1) }}"
|
||||||
sequence:
|
sequence:
|
||||||
- service: mqtt.publish
|
- service: mqtt.publish
|
||||||
data:
|
data:
|
||||||
@ -380,7 +462,7 @@ action:
|
|||||||
# Theme: Apply unselected background color on change
|
# Theme: Apply unselected background color on change
|
||||||
- conditions:
|
- conditions:
|
||||||
- condition: template
|
- condition: template
|
||||||
value_template: "{{ trigger.topic == unselectedbgtopic }}"
|
value_template: "{{ (trigger.topic == unselectedbgtopic) and ((unselected_bgcolor|int) == -1) }}"
|
||||||
sequence:
|
sequence:
|
||||||
- service: mqtt.publish
|
- service: mqtt.publish
|
||||||
data:
|
data:
|
||||||
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.0 KiB |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.7 KiB |