Making one switch out of a broadcast

Using RPi4 /w HassIO and latest HA.
So i got a D-link W118 that i now got to work by Assistant-Relay-Hassio
i can use a broadcast to tell the google Home to turn on or turn off the light
I use this as a broadcast card in lovelace.

type: entities
entities:
  - action_name: Broadcast
    name: Assistant Relay
    service: rest_command.assistant_relay
    type: call-service
    service_data:
      command: turn on test

Is there a way to make this into a switch? So when i turn on the switch it broadcasts “turn on” and when i turn it off it broadcasts “turn off”

Solved it my self… i was making it too hard…
In switch.yaml :

    spotlys:
      turn_on:
        service: rest_command.assistant_relay
        data:
          command: turn on spotlys
      turn_off:
        service: rest_command.assistant_relay
        data:
          command: turn off spotlys

1 Like