State-Label tap_action Service_Data (variable?)

Hi,

I’m trying to put a state-label (or a state-icon) on my floorplan and make it turn the air conditioner on or off. Below I have my state-label and I can get it to work if I use ‘tap’ for ON and ‘hold’ for OFF. In the below example the hold_action works, and the tap_action would work to turn the air conditioner on if I used a similar service_data.

However, I’d like to just use a tap_action to turn it on or off, setting the service_data depending on the sensor.ac_status.state (‘on’ or ‘off’). Is this possible or am I going about it all wrong?

Oh, this example is in my ui_lovelace.yaml.

          - type: state-label
            entity: sensor.ac_status
            prefix: "A/C - "
            tap_action:
              action: call-service
              service_data:
                data: 'if (sensor.ac_status.state === "on") return {"SystemON":"off"}; else return {"SystemON":"on"};'
                url: http://192.168.1.192/SystemON
              service: shell_command.ac_toggle
            hold_action:
              action: call-service
              service_data:
                data: '{"SystemON":"off"}'
                url: http://192.168.1.192/SystemON
              service: shell_command.ac_toggle
            style:
              top: 81.2%
              left: 56.5%
              font-size: 20px

Thanks.