npope / home-assistant-crestron-component

Integration for Home Assistant for the Crestron XSIG symbol
Apache License 2.0
60 stars 24 forks source link

Meida player- can't turn on from off #6

Open thesaabdr opened 2 years ago

thesaabdr commented 2 years ago

I have the media player working. If I set the source to something above 0, then I can select sources, set volume, etc in HA. If the source is 0, then I can't do anything in HA and it is grayed out. How can I select a source in HA from an off state?

natethelen commented 2 years ago

I have seen this, too, and haven't yet figured out the solution to the component. A work around would be to use a helper + an automation to call the select_source service on the media player.

natethelen commented 1 year ago

I ended up using the Mini Media Player (can get it using HACS) instead of the built-in one. It is a very nice component that allows you to choose sources when it is off (source == 0)

In addition, to share my setup:

I created a mini-media-player block for each of my "Players" (the music sources that in my case are Sonos) with an auto-entries (also available via HACS) mini-media-player for each of the active "Speakers" (the Crestron outputs). Then I added another auto-entries block that lists all the speakers that don't currently have a source so there is a single place to easily assign sources to speakers. Check it out:

views:
  - theme: Backend-selected
    title: Home Music
    badges: []
    cards:
      - type: custom:auto-entities
        card:
          type: entities
          title: Unassigned Speakers
        filter:
          include:
            - entity_id: media_player.*_speakers
              state: 'off'
              options:
                type: custom:mini-media-player
                group: true
                toggle_power: false
                hide:
                  controls: true
              sort:
                method: name
        show_empty: false
        unique: true

Then one of these for each Sonos (source)

      - type: entities
        entities:
          - type: custom:mini-media-player
            entity: media_player.main_floor
            artwork: cover
            group: true
            info: short
            hide:
              mute: true
              power: true
              source: true
          - type: custom:auto-entities
            card:
              type: entities
            filter:
              include:
                - entity_id: media_player.*_speakers
                  attributes:
                    source: Main Floor Sonos
                  options:
                    type: custom:mini-media-player
                    group: true
                    min_volume: 5
                    max_volume: 90
                    toggle_power: false
                    hide:
                      controls: true
                      mute: true
              sort:
                method: name
            show_empty: false
            unique: true
anouk commented 10 months ago

FYI I fixed this issued by updating the media_player.py its in my fork here

using this with simpl# on a Virtual 4 to control my HD-XSPA

you can use the logic of source 0 in crestron to handle shutdown/standby and anything other than 0 to power on / wake