Custom button-card call-service how to customize parameters passed?

goal is, when card icon is clicked, to turn off lights if they are on and turn on lights with a specified color if they are off. it works fine for turning on. but when turn off is called it does not like the extra parameters brightness and xy_color instead of simply ignoring.

trying to figure out how do i not pass the brightness and xy_color parameter when the call is to the service turn_off?

for clarity, {{ lOn }} and {{ lOff }} are both lovelace_gen variables.

thank you.

type: custom:button-card
template: flash-half
variables:
  isFew: '[[[ return ( states[ "{{ lOn }}" ] !== undefined ? true : false ); ]]]'
entity: {{ lOff }}
tap_action:
  action: call-service
  service: '[[[ return (entity.state === "on" ? "homeassistant.turn_off" : "homeassistant.turn_on" ); ]]]'
  service_data:
    entity_id: '[[[ return (entity.state === "on" && variables.isFew ? "{{ lOn }}" : "{{ lOff }}" ); ]]]'
    brightness: '[[[ return (entity.state === "on" ? null : 33 ); ]]]'
    xy_color: '[[[ return (entity.state === "on" ? null : "[ 0.673, 0.323 ]" ); ]]]'

figured it out with entity.state and json:

tap_action:
  action: call-service
  service: '[[[ return (entity.state === "on" ? "homeassistant.turn_off" : "homeassistant.turn_on"); ]]]'
  service_data: >-
    [[[
      if (entity.state === 'on')
          return {"entity_id": "{{ lOff }}"};
      else
          return  {
                    "entity_id": (variables.isFew ? "{{ lOn }}" : "{{ lOff }}"),
                    "brightness": 33,
                    "xy_color": [ 0.673, 0.323 ]
                  };
    ]]]