Toggle lights with out entity or helpers

Hello All,
I would like to seek your help on optimize my code by not using any entity or helpers to toggle my lights in HA FloorPLan. for example:
- entity: binary_sensor.ring_salon_ding //REMOVE
element: clickable element // Use Element to toggle the lights
state_action:
service: floorplan.class_set
service_data:
class: |
>
switch (entity.state) {
case “on”:
return “ring-ding”;

          case "off":
            return "";

          default:
            return "";
        }