fix: wrong brightness text
This commit is contained in:
@@ -1453,7 +1453,7 @@ action:
|
|||||||
btn_bri_txt: >-
|
btn_bri_txt: >-
|
||||||
{%- if trigger.to_state.entity_id is match "light." and trigger.to_state.state == 'on' and trigger.to_state.attributes.brightness is defined -%} {{ (trigger.to_state.attributes.brightness | int * 100 /254) | round(0) }}%
|
{%- if trigger.to_state.entity_id is match "light." and trigger.to_state.state == 'on' and trigger.to_state.attributes.brightness is defined -%} {{ (trigger.to_state.attributes.brightness | int * 100 /254) | round(0) }}%
|
||||||
{%- elif trigger.to_state.entity_id is match "cover." and trigger.to_state.state == 'open' and trigger.to_state.attributes.current_position is defined -%} {{ (trigger.to_state.attributes.current_position | int) | round(0) }}%
|
{%- elif trigger.to_state.entity_id is match "cover." and trigger.to_state.state == 'open' and trigger.to_state.attributes.current_position is defined -%} {{ (trigger.to_state.attributes.current_position | int) | round(0) }}%
|
||||||
{%- else -%}
|
{%- else -%} 0
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
|
|
||||||
##### Button PIC #####
|
##### Button PIC #####
|
||||||
@@ -1486,10 +1486,20 @@ action:
|
|||||||
component: "{{ component_to_update }}text"
|
component: "{{ component_to_update }}text"
|
||||||
message: "{{ btn_label }}"
|
message: "{{ btn_label }}"
|
||||||
##### "BRIGHTNESS" Text #####
|
##### "BRIGHTNESS" Text #####
|
||||||
- service: "{{ command_text_printf }}"
|
- if:
|
||||||
data:
|
- condition: template
|
||||||
component: "{{ component_to_update }}bri"
|
value_template: "{{ btn_bri_txt == 0 }}"
|
||||||
message: "{{ btn_bri_txt }}"
|
then:
|
||||||
|
- service: "{{ command_text_printf }}"
|
||||||
|
data:
|
||||||
|
component: "{{ component_to_update }}bri"
|
||||||
|
message: " "
|
||||||
|
else:
|
||||||
|
- service: "{{ command_text_printf }}"
|
||||||
|
data:
|
||||||
|
component: "{{ component_to_update }}bri"
|
||||||
|
message: "{{ btn_bri_txt }}"
|
||||||
|
|
||||||
#### Left button press
|
#### Left button press
|
||||||
- conditions:
|
- conditions:
|
||||||
- condition: trigger
|
- condition: trigger
|
||||||
@@ -1913,9 +1923,9 @@ action:
|
|||||||
# BTN Label
|
# BTN Label
|
||||||
btn_label: "{{ repeat.item.button_label }}"
|
btn_label: "{{ repeat.item.button_label }}"
|
||||||
btn_bri_txt: >-
|
btn_bri_txt: >-
|
||||||
{%- if repeat.item.entity is match "light." and states(repeat.item.entity).state == 'on' and state_attr(repeat.item.entity, "brightness") != None -%} {{ (state_attr(repeat.item.entity, "brightness") | int(255) * 100 /254) | round(0) }}%
|
{%- if repeat.item.entity is match "light." and states(repeat.item.entity) == 'on' and state_attr(repeat.item.entity, "brightness") != None -%} {{ (state_attr(repeat.item.entity, "brightness") | int(255) * 100 /254) | round(0) }}%
|
||||||
{%- elif repeat.item.entity is match "cover." and states(repeat.item.entity).state == 'open' and state_attr(repeat.item.entity, "current_position") != None -%} {{ (state_attr(repeat.item.entity, "current_position") | int(100)) | round(0) }}%
|
{%- elif repeat.item.entity is match "cover." and states(repeat.item.entity) == 'open' and state_attr(repeat.item.entity, "current_position") != None -%} {{ (state_attr(repeat.item.entity, "current_position") | int(100)) | round(0) }}%
|
||||||
{%- else -%}
|
{%- else -%} 0
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
|
|
||||||
##### SET Buttons ####
|
##### SET Buttons ####
|
||||||
@@ -1962,11 +1972,20 @@ action:
|
|||||||
##### "BRIGHTNESS" Text #####
|
##### "BRIGHTNESS" Text #####
|
||||||
- delay:
|
- delay:
|
||||||
milliseconds: 11
|
milliseconds: 11
|
||||||
- service: "{{ command_text_printf }}"
|
- if:
|
||||||
data:
|
- condition: template
|
||||||
component: "{{ component_to_update }}bri"
|
value_template: "{{ btn_bri_txt == 0 }}"
|
||||||
message: "{{ btn_bri_txt }}"
|
then:
|
||||||
|
- service: "{{ command_text_printf }}"
|
||||||
|
data:
|
||||||
|
component: "{{ component_to_update }}bri"
|
||||||
|
message: " "
|
||||||
|
else:
|
||||||
|
- service: "{{ command_text_printf }}"
|
||||||
|
data:
|
||||||
|
component: "{{ component_to_update }}bri"
|
||||||
|
message: "{{ btn_bri_txt }}"
|
||||||
|
|
||||||
#### NSPanel boot init weather
|
#### NSPanel boot init weather
|
||||||
- choose:
|
- choose:
|
||||||
#### Default weather
|
#### Default weather
|
||||||
|
|||||||
Reference in New Issue
Block a user