Call different Service based on a condition

Hello,
I am trying to call a different service based on a variable (y variable in Honeycomb menu). If positive call Service “A”, else call Service “B”.

Any advice on how to do this?

Thank You

actions:
  - action: "{{ 'service A' if VARIABLE else 'service B' }}"

Would be clearer if you provide the service names, what the variable is, and where you’re calling this (script, automation, something else?).

You’ve tagged the topic “front-end” — was that intentional?

I am trying like you suggest but no success till now.
Here the snippet of code of the honeycomb menu:

tap_action:
  action: call-service
  service: honeycomb
  service_data:
    xy_pad:
      y:
        actions:
          action: "{{ if y > 0 'cover.open_cover' else 'cover.close_cover' }}"
          service_data:
          entity_id: cover.mycover

Thank You

Bottom of the Actions documentation:

It is not possible to use templates for actions. But calling a script is a good alternative.

Ok I can try with scripts.
So I have to call this new script from the action in my main code?
And how do I pass to the script the y variable?

Regards
Thanks

This looks like it might help. If this is what you are using, there seems to be a small amount of templating available in the xy_pad, but I have no expereince of working with this: