Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 101645

Switch to switch between HDMI MAIN and SUB

$
0
0

@frelev wrote:

I´m struggling with creating a simple switch that switches between the two outputs on my ONKYO receiver. In the end I would like to have a nice icon for this in lovelace showing a projector when hdmi main is selected and TV when hdmi sub is selected.
That´s why I thought input_boolean would be the right way to go instead of an input_select. But I do not get it to behave as expected, it toggles when I click it.
I tried to put a template switch in between but no go :cry:

Code:

input_boolean:
  onkyo_hdmi:
    name: Onkyo HDMI switch
    initial: on




automation:
# Change to SUB
  - alias: Set Onkyo HDMI SUB
    trigger:
      platform: state
      entity_id: input_boolean.onkyo_hdmi
      to: "off"
    condition:
    - condition: state
      entity_id: media_player.onkyo
      state: "on"
    action:
      - service: media_player.onkyo_select_hdmi_output
        data:
          entity_id: media_player.onkyo
          hdmi_output: out-sub
  - alias: Set Onkyo HDMI MAIN
    trigger:
      platform: state
      entity_id: input_boolean.onkyo_hdmi
      to: "on"
    condition:
    - condition: state
      entity_id: media_player.onkyo
      state: "on"
    action:
      - service: media_player.onkyo_select_hdmi_output
        data:
          entity_id: media_player.onkyo
          hdmi_output: out

Lovelace card:

color: auto
entity: input_boolean.onkyo_hdmi
icon: >-
  [[[ if (entity.state = "off") return "mdi:television-classic"; else return
  "mdi:projector" ]]]
name: '[[[ if (entity.state = "off") return "Hdmi TV"; else return "Projector" ]]]'
type: 'custom:button-card'

The automation itself works when testing it but maybe a script is more suitable?

Any ideas why this is not working or what would be the best approach?

Thanks!

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 101645

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>