Media_player - How can I create a simple on/off switch?

I’ve added my TV Cable Box using an integration and it all works fine and appears as a media_player. I’d like to be able to add a simple ON/OFF switch to turn it on and off; but can’t get my head around understanding how to do this. I’ve searched and can’t seem to find a current or suitable method or template. Yup, I’m not all that smart with this HA stuff. When it is on, the state is ‘playing’ and when off the state is ‘off’. I tried to listen for the events, but don’t seem to get any info. Appreciate any help

What I did in the end was add the following to my configuration.yaml. Was kinda hoping there was a better way, but at least it works - happy to hear if there is a ‘better’ way to do this.

switch:
  - platform: template
    switches:
      ziggo_box:
            value_template: "{{ is_state('media_player.ziggo', 'playing') }}"
            turn_on:
              service: media_player.turn_on
              data:
                entity_id: media_player.ziggo
            turn_off:
              service: media_player.turn_off
              data:
                entity_id: media_player.ziggo
            icon_template: >-
              {% if is_state('media_player.ziggo', 'playing') %}
                mdi:television-classic
              {% else %}
                mdi:television-classic-off
              {% endif %}