@joshlawless wrote:
I have a number of Bali blinds connected to my ISY controller and exposed to Home Assistant as lights.
I have attempted to create template covers for these blinds in my configuration file, based upon the status of the light as reported by ISY.
When the covers are closed, the lights are off, and no longer have a “brightness” attribute, so I have tried to create, with position templates, a way to handle this. But when the brightness of the light is “None”, and the position template sets the position of the cover template to 0, the UI of home assistant shows that the cover is “open”
Here is the relevant configuration:
nook_middle_window_blind: friendly_name: Nook Middle Window Blind position_template: >- {% if state_attr('light.nookmid_mc' , 'brightness') == None %} 0 {% elif state_attr('light.nookmid_mc' , 'brightness') > 0 %} {{ state_attr('light.nookmid_mc' , 'brightness') }} {% else %} 0 {% endif %} icon_template: >- {% if state_attr('light.nookmid_mc' , 'brightness') == None %} mdi:checkbox-blank {% elif state_attr('light.nookmid_mc' , 'brightness') == 100 %} mdi:checkbox-blank-outline {% elif state_attr('light.nookmid_mc' , 'brightness') > 0 %} mdi:gradient {% else %} mdi:checkbox-blank {% endif %} open_cover: service: light.turn_on data: entity_id: light.nookmid_mc brightness: 100 close_cover: service: light.turn_off data: entity_id: light.nookmid_mc stop_cover: service: light.turn_on data: entity_id: light.nookmid_mc set_cover_position: service: light.turn_on data_template: entity_id: light.nookmid_mc brightness: "{{position}}"
Just to confirm that the UI is reading this all correctly, I used the developers tools section and provide the following template for evaluation:
{{ states.light.nookmid_mc }} {{ states.cover.nook_middle_window_blind }} {% if state_attr('light.nookmid_mc' , 'brightness') == None %} 0 {% endif %}
The output of this evaluation is:
<template state light.nookmid_mc=off; friendly_name=NookMid MC, supported_features=1 @ 2020-04-09T12:54:32.657836-06:00> <template state cover.nook_middle_window_blind=open; friendly_name=Nook Middle Window Blind, icon=mdi:checkbox-blank, supported_features=15 @ 2020-04-09T12:54:32.090960-06:00> 0
Can anyone help explain why the cover state is “open” when the position_template is evaluating a “None” brightness as a 0?
Posts: 1
Participants: 1