From 8f8189b963e3b16ff4e495b1dc032e98ea923dc0 Mon Sep 17 00:00:00 2001 From: Chris Date: Sun, 30 Oct 2022 21:26:55 +0100 Subject: [PATCH] fix: avoid using not defined attributes --- blueprint.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/blueprint.yaml b/blueprint.yaml index a2573d6..446b595 100644 --- a/blueprint.yaml +++ b/blueprint.yaml @@ -1536,9 +1536,9 @@ action: {%- elif trigger.entity_id == entity32 -%} {{ entity32_name }} {%- endif -%} btn_bri_txt: >- - {%- if trigger.to_state.entity_id is match "light." and trigger.to_state.state == 'on' -%} {{ (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' -%} {{ (trigger.to_state.attributes.current_position | int) | round(0) }}% - {%- else -%} " " + {%- 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) }}% + {%- else -%} {%- endif -%} ##### Button PIC #####