I have a really basic icon_template on all my covers to correctly display the shutter icon as open/close.
This was all working well until 0.115, when template loop detection was introduced.
I do understand the issue, I’m self-referencing cover.office and unfortunately even after the change in template loop detection (this and also this) I’m still affected - all my templates are self-referencing.
I have 5 covers like these and was trying to use some sort of binary_sensor and use it in the icon_template to avoid self-referencing, but it was getting too messy so I stopped and came here asking for help/suggestion on an easier (cleaner) way.
Then use another entity, like an input_boolean, to serve as a proxy. For example, open_cover turns on the switch and an input_boolean. close_cover turns off the switch and the input_boolean. Use the input_boolean’s state to determine which icon to display.
I understand @felgy 's frustration. I have dozens of sensors like this one.
nest_connected:
friendly_name: Nest Connected
icon_template: "{{ 'mdi:smoke-detector' if is_state('binary_sensor.nest_connected','on') else 'mdi:alert-circle' }}"
device_class: connectivity
value_template: >
{{ is_state('binary_sensor.upstairs_thermostat_online','on')
or is_state('binary_sensor.upstairs_nest_protect_online','on')
or is_state('binary_sensor.upstairs_nest_protect_online','on') }}
So really my only option here is to more or less repeat the value template in the icon template. At the end of the day it’s not the end of the world but the code certainly isn’t as pretty.
This caught me by surprise. If there was any mention of this change I can’t find it anywhere in the release notes. Literally the only search results are the two git issues posted and this thread. I’m kinda surprised more people haven’t had a problem or mentioned it.
Anyway, as far as I can tell, this only throws a warning in the log, the templates still actually work. But the warnings bug me so now it looks like I’ve got a bunch of templates to fix.
In your case it still works because you have more than 1 template and only 1 is self-referencing. But I feel your pain with the warnings… even if it still works!
OK, I’m trying the input_boolean approach, but I can’t find a way to perform two action at once. This is, when I open the cover, I activate the switch AND update input_boolean status.
I do see a way via automation, but I’ll need 10 of them to cover all 5 blinds (open/close).
Sorry, I pasted wrong here, open_cover is spaced correctly.
I don’t believe we can issue more than one service in this template. I don’t get any error, but it just ignores the 1st one (switch.turn_on) and just changes the input_boolean.
Please consider marking my post (above) with the Solution tag. It will automatically place a check-mark next to the topic’s title which signals to other users that this topic has an accepted solution. It helps others users find answers to similar questions.
All in all, the changes @123 suggested allowed me to overcome the issue with loop detection and also keep the cover state even after HA reboot (something that I was struggling with). So… Not so bad then!