Icon colour based on script running

I have mushroom chip button that runs a script for my heating boost for 30 mins, but I have no way of telling that the script is running. I want the icon to change colour whilst it is running and revert back to normal when it is not. What is the best way to do this, as below does not work?

type: custom:mushroom-chips-card
chips:
  - type: template
    entity: script.myscript
    name: Boost Heating
    icon: mdi:fire
    content_info: name
    icon_color: '{{ ''amber'' if states(''script.myscript'') == ''on'' else none'' }}'
    tap_action:
      action: toggle

Use the last_triggered attribute of your script:


icon_color: |
  {% set last = states.script.my_script.attributes.last_triggered %}
  {% set condition = last is not none and now() - last < timedelta(minutes=30) %}
  {{ 'amber' if condition else 'grey' }}

Thank you.

This would work, however if I manually stop the heating boost before 30 mins the icon will stay amber.

If script is running then the current attribute is greater than 0, so you can test for that. Usually it is 1 but script that can run in parallel can have 2 or higher.

What you have should also work (on scripts, not on automations - the current attribute works there too), but there are quotes after none, but not before. Test your template in developer tools first.

Then use the state of your heating boost entity as additional argument.