Make the media player as a light

Hi Guys,

Is there a way much like it can be done with a switch : https://www.home-assistant.io/components/light.switch/

to control media player as light?

What drugs are you on? (I want some)

2 Likes

create a template switch?

This is my entity for the media player : media_player.bedroom_tv

would you mind attach en example with my entity?

What are you trying to do?

i would like to Bedroom TV will show up like the Mibox, so i can control it like a light.

What do you mean “control it like a light”. Do you mean “turn it on and off”.

yes with blue switch at the right just like in the picture

You may want to look at the custom mini-media_player. It can turn your media player into a full blown jukebox or by selective hiding of buttons and controls, turn it into an on/off switch.

The link I provided has an example already.
You’ve not provided any code or what your tv brand/model is, so I’ll assume your bedroom tv is called media_player.bedroom_tv that it can be switched on, and that it has a state of on/off

your template switch would therefore look like this:

  - platform: template
    switches:
      skylight:
        value_template: "{{ is_state('media_player.bedroom_tv', 'on') }}"
        turn_on:
          service: media_player.turn_on
          data:
            entity_id: media_player.bedroom_tv
        turn_off:
          service: media_player.turn_off
          data:
            entity_id: media_player.bedroom_tv
1 Like

If you want to manage volume (as brightness) :

light:
 - platform: template
   lights:
    media_player_bedroom_tv_as_a_light:
     value_template: "{{ is_state('media_player.bedroom_tv', 'on') }}"
     level_template: "{{ (256 * state_attr('media_player.bedroom_tv', 'volume_level')| float )|int }}" 
     turn_on:
      service: media_player.turn_on
      data:
       entity_id: media_player.bedroom_tv
     turn_off:
      service: media_player.turn_off
      data:
       entity_id: media_player.bedroom_tv
     set_level :
      service: media_player.volume_set
      data_template:
       entity_id: media_player.bedroom_tv
       volume_level: "{{ ( brightness /256 )| float  }}"

I use this card for this:

Yes Dennis,
It’s good for lovelace, but Alexa don’t recognise media_player volume and recognise light brighness