Change icon based on boolean state?


#1

Hi! I’m having some trouble with changing an icon based on a boolean state.
What I want to do is make the icon change from mdi:account to mdi:account-multiple when i change the “input_boolean.guest_mode” state to “on”.
Does anyone know how to do this?

views:
  - title: Main
    id: main
    #panel: true
    cards:
      - type: glance
        #title: Status
        entities:
          - entity: device_tracker.vetle_phone
          - entity: input_boolean.guest_mode
            tap_action: toggle
            name: Guest
            templates:
              icon: "if (state === 'on') return 'mdi:account-multiple'; else return 'mdi:account';"

#2

Maybe customize the sensor in your config and not in your lovelace UI