Creating custom action button for entity

A little lost I got everything setup pretty easily but now I want to create a button the performs a specific action like a Power On/Off toggle. Below is the entity I’m trying to create the button for. I’ve looked around haven’t found any guide or docs on it. Just need someone to point me in the right direction.

I think you may find what you want in the template switch (https://www.home-assistant.io/integrations/switch.template/).

Thanks that got me in the right direction. I ended up re-doing the intergration and using the smartcast one. I can now get the status with the template however the toggle button on the dashboard isn’t working.


switch:
  - platform: template
    switches:
      theatortv:
        value_template: "{{ is_state('media_player.vizio_smartcast', 'on') }}"
        turn_on:
          service: switch.turn_on
          data:
            entity_id: media_player.vizio_smartcast_on
        turn_off:
          service: switch.turn_off
          data:
            entity_id: media_player.vizio_smartcast_off

int

I don’t have any experiences on Vizio thing, but i think you can try following.

        turn_on:
          service: media_player.turn_on
          data:
            entity_id: media_player.vizio_smartcast
        ...

How do you know what actions are available for each entity? Is there away to get a list?

I’ve found in the media player entity of home assistant (https://www.home-assistant.io/integrations/media_player/).

Light bulb just clicked on thanks. The first part of the entity id is the service. Stumbled upon node red which is the kind of programming I do.