I have a cover template whose state portion looks like this:
cover:
- platform: template
covers:
garage_door:
friendly_name: "Garage Door"
value_template: "{{ is_state('binary_sensor.garage_door_sensor', 'off') }}"
Prior to 0.115.0b0, this used to properly return open/closed based on the state of the binary_sensor, but I now get the following error message in the log, and the cover template always has a state of "open":
2020-09-07 16:06:11 ERROR (MainThread) [homeassistant.components.template.cover] Received invalid cover is_on state: False. Expected: open, closed, true, false
If I evaluate the template in the dev tools, it looks like it is returning True and False:

I know there's some translation that goes into what gets displayed and it can be different from what's actually returned, but in this case it looks like it's the same.
This returns the correct value:
icon_template: >-
{% if is_state('binary_sensor.garage_door_sensor', 'off') %}
mdi:garage-open
{% else %}
mdi:garage
{% endif %}
So the template engine is properly interpreting True/False as boolean true/false, but maybe just the cover template no longer likes the value?
I've worked around it for now by changing the template to:
value_template: "{{ 'open' if is_state('binary_sensor.garage_door_sensor', 'off') else 'closed' }}"
configuration.yamlcover:
- platform: template
covers:
garage_door:
friendly_name: "Garage Door"
value_template: "{{ is_state('binary_sensor.garage_door_sensor', 'off') }}"
2020-09-07 16:04:50 ERROR (MainThread) [homeassistant.components.template.cover] Received invalid cover is_on state: False. Expected: open, closed, true, false
We might have previously automatically made these .lower()
Yup there was a .lower
state = self._template.async_render().lower()
Need to check light as well
It鈥檚 completely inconsistent as to which templates did lower and which didn鈥檛. I鈥檒l audit them tomorrow and adjust
Hey there @phracturedblue, @tetienne, mind taking a look at this issue as its been labeled with an integration (template) you are listed as a codeowner for? Thanks!
(message by CodeOwnersMention)
Most helpful comment
It鈥檚 completely inconsistent as to which templates did lower and which didn鈥檛. I鈥檒l audit them tomorrow and adjust