Solved, by Thomas, of course.
config.entityis the entity id, not the state object
see 🔹 Auto-entities - Automatically fill cards with entities - #134 by Mariusthvdb
type: custom:template-entity-row
style: |
:host {
--paper-item-icon-color:
{% set id = config.entity.split('.')[1] %}
{% set repo = 'input_boolean.' + id %}
{% if states(repo) == 'on' %} gold
{% else %} green
{% endif %}
;
resulting in:
short template version:
type: custom:template-entity-row
style: |
:host {
--paper-item-icon-color:
{% set id = config.entity.split('.')[1] %}
{% set repo = 'input_boolean.' + id %}
{{'gold' if is_state(repo,'on') else 'green'}}
;
