Entity based on a switch condition

Hello there,

can anyone help me with a condition?

type: custom:button-card
aspect_ratio: 1.4/0.1
color_type: card
styles:
  card:
    - padding: 0.01em
    - white-space: normal
    - font-size: 1.5em
state:
  - value: 'on'
    color: black
    name: >-
      [[[ return `<font color="red">Cucina Auto(ON)</font>
      ${states['sensor.tempcucina'].state}° -
      ${states['sensor.humcucina'].state}%` ]]]
  - value: 'off'
    color: black
    name: >-
      [[[ return `<font color="white">Cucina Auto(OFF)</font>
      ${states['sensor.tempcucina'].state}° -
      ${states['sensor.humcucina'].state}%` ]]]
entity: automation.estate_cucina_auto_temp

I would to change the automation based on a state of a switch, example:

 entity: |
     [[[ if (states['switch.pdc_inverno_18_23'].state === 'on')
       return `automation.termocamino_auto_cuci_temp`;
     else
       return `automation.estate_cucina_auto_temp`;
     ]]]

Thanks