Broadlink - TV State

Hi guys,

I have the next vertical-stack.
imagen
How can I manage the “state” or color of the remote of the script in base the binary sensor of the IP of the TV?

This is my configuration of the vertical-stack:

 type: vertical-stack
 cards:
   - type: custom:mini-media-player
     entity: media_player.android_tv
     icon: mdi:television
     artwork: cover
     hide:
       power: true
   - type: entities
     entities:
       - entity: script.tv
     show_header_toggle: false
     state_color: true

And this on my configuration.yaml:

binary_sensor:
  - platform: ping
    host: 192.168.0.140
    name: TV Ping
    scan_interval: 2
    count: 2

Should I create a switch on configuration.yaml with this sensor?

Thanks and regards!