Customize python created entities: attributes 'templates"

Hi
Not sure What you’re saying, since all the other attributes work as expected.
See the Icon or show_last_changed.

Icon is set via the variable declared in the python . That’s why I hoped icon_color could be templated too.

00

below is an example of a script that uses templates:

    hass.states.set(entity_id, groups_count[idx], {
      'friendly_name': fname,
      'desc' : badges_desc[idx],
      'unit_of_measurement': badge,
      'entity_picture': picture,
      'templates': { 'theme': theme }
    })

and the theme is ‘templated’ as follows:

    themelist = groups_theme[idx].split('|')
    if len(themelist) > 1:
        try:
            theme = themelist[groups_count[idx]]
        except IndexError:
            theme = 'green_badge'
    else:
        theme = 'black_badge'