If else conditions in tap_action on lovelace picture element card

Hello,

I have a picture element card for floor plan and trying to turn ON/OFF my TV with tap_action.

I am trying to achieve the following inside a tap_action on lovelace picture element card,

if (media_player.lg_webos_tv_cx is "off"):
   call_service - wake_on_lan.send_magic_packet
else if (media_player.lg_webos_tv_cx is "on"):
   call_service - media_player.turn_off

I searched around and I saw posts from a 2020 saying that only way to use conditions in lovelace fields is through calling a script. So that is what I am doing now but I really prefer having all the code for the lovelace card in the card config itself.

Reason for this post is,
There have been a lot of improvements and feature additions to home assistant but I didn’t find information about whether we can use conditions in tap_action on lovelace.

Question: Is it possible to use conditionals via templating or otherwise in lovelace fields directly.

Current solution (works fine):
Tap action in lovelace card:

tap_action:
  action: call-service
  service: script.lovelace_floor_plan_tv_tap_action_to_on_off

.
Script:

alias: Lovelace floor-plan TV tap-action to ON/OFF
sequence:
  - if:
      - condition: device
        device_id: xxxxxxxxxxxxx
        domain: media_player
        entity_id: media_player.lg_webos_tv_cx
        type: is_off
    then:
      - service: wake_on_lan.send_magic_packet
        data:
          mac: XX:XX:XX:XX:XX:XX
    else:
      - if:
          - condition: device
            device_id: xxxxxxxxxxxxx
            domain: media_player
            entity_id: media_player.lg_webos_tv_cx
            type: is_on
        then:
          - service: media_player.turn_off
            data: {}
            target:
              entity_id: media_player.lg_webos_tv_cx
mode: single
icon: mdi:television

Regards,
Vaibhav

Using the script is the best way. Otherwise you have to use this:

OK. Thanks.
I think I will stick with the script. One less custom card to keep track of.