Open zappasmart opened 4 years ago
Try adding sensor.test under the entities of the card-templater card, like this:
- type: 'custom:card-templater'
entities:
- input_boolean.test
- sensor.test
card:
type: sensor
entity: sensor.test
graph: line
theme_template: >-
{{ "OrangeTheme" if states.input_boolean.test.state == "on"
else "BlueTheme" }}
Without that, it may not refresh when the state of that entity changes.
Seems like a workaround, but it works, thanks!
@zappasmart I've just released a new beta version (0.0.8b3) which should fix an issue where, if entities which are not templated are updated, the card would not update. This should fix your issue and mean that you don't need to add sensor.test under the card-templater entities.
Can you please try this out and see if it helps? If you are using HACS you will need to enable Beta versions and, if not, you will need to download the latest pre-release version from Releases.
Just tried. Updated with 0.0.8b3 beta version, restarted home assistant, cleared browser cache. Unfortunately it's still not working.
Description of problem:
In my test I have a template sensor that changes value, name and icon based on an input boolean.
Displaying the template sensor in sensor or entities cards works well, state changes are correctly detected and value, name and icon properly updated when input boolean toggles.
However, if sensor or entities cards are surrounded by card-templater, they don't detect the input boolean state changes properly. I used the card-templater only to dinamically change the theme (a blue or orange theme), based on the input boolean state.
Input Boolean OFF
When input boolean is off, blue theme is correcly applied, card content is correctly displayed:
Input Boolean turned ON
When input boolean is turned on, orange theme is correctly applied but card content is not updated:
Input Boolean turned OFF
When input boolean is turned back off, blue theme is correctly applied but card content is wrongly updated:
configuration.yaml:
lovelace: