realthk / asyncpioneer

Async Pioneer AVR for Home Assitant
27 stars 22 forks source link

Please help me with the speakers A+B #18

Open leodirob opened 3 years ago

leodirob commented 3 years ago

Hi! Thank you for your Async Pioneer AV amp. I love it! I'm a beginner in HA and I'm sorry if my question may be trivial. My VSX 923 works well in HA. I would like to activate the A, B, and A+B buttons on Mini Media Player like in your example. https://user-images.githubusercontent.com/5654575/53702516-1f760700-3e08-11e9-900b-435edf7fbfa7.png

But I don't understand where I haven to paste your code. If I put it in configuration.yaml he system gives me an error.

Can You Help Me?

realthk commented 3 years ago

It's very easy, just create scripts for every mode in scripts.yaml:

"speaker_a":
  alias: Select speaker A
  sequence:
    - service: media_player.pioneer_select_speaker
      data:
        entity_id: media_player.pioneer_avr
        speaker: "A"

"speaker_b":
  alias: Select speaker B
  sequence:
    - service: media_player.pioneer_select_speaker
      data:
        entity_id: media_player.pioneer_avr
        speaker: "B"

"speaker_a_b":
  alias: Select speaker A+B
  sequence:
    - service: media_player.pioneer_select_speaker
      data:
        entity_id: media_player.pioneer_avr
        speaker: "A+B"

and setup Mini Mediaplayer buttons for these (editing the config of this card in HA UI):

entity: media_player.pioneer_avr
info: scroll
shortcuts:
  buttons:
    - icon: 'mdi:speaker-wireless'
      id: script.speaker_a
      name: Speaker A
      type: script
    - icon: 'mdi:speaker-wireless'
      id: script.speaker_b
      name: Speaker B
      type: script
    - icon: 'mdi:speaker-wireless'
      id: script.speaker_a_b
      name: Speaker A+B
      type: script
  hide_when_off: true
source: full
type: 'custom:mini-media-player'

For additional features, check Mini Media Player

jtonk commented 3 years ago

from mini media player you can also directly control the pioneer_select_speaker service. No need to create the scripts.

  • icon: mdi:speaker type: service name: "AB" id: media_player.pioneer_select_speaker data: entity_id: media_player.pioneer_avr speaker: "A+B"
realthk commented 3 years ago

from mini media player you can also directly control the pioneer_select_speaker service. No need to create the scripts.

Indeed, you're right! I forgot the reason I was using scripts because of an extra relay to switch speaker set "B" between two rooms, and that required an additional control command (which I removed when pasting the script above).

leodirob commented 3 years ago

Thank you so much. It's very simple in this way.

Now, for me, the next adventure is to configure that controls with alexa using haaska. Do you know where I can find a tutorial to do that? Sorry for all this questions, but I've been learning HA for two weeks.

realthk commented 3 years ago

You find it on the haaska wiki setup page. Not an easy ride, but it works fine (BTW, this was also a reason to have script for switching, because HA scripts can be linked to voice commands) The method described on Home Assistant Alexa integration page did not work for me.

leodirob commented 3 years ago

Thank you I've already installed haaska and works fine. I would like to know if there is a tutorial to set up the mediaplayer using haaska. Now Alexa sees the pioneer vsx. I can turn on/off and change the volume, but not change the speakers or the source. Thanks for your invaluable help

realthk commented 3 years ago

For that, I was using a "Routine" set up in Alexa app. There you can link any voice command (like "speaker in bedroom") to any script created in Home Assistant (if you have "scripts" enabled under "include_domains:" in HA Alexa config)

leodirob commented 3 years ago

Great! With the scripts automatically appears in Alexa Scenes! It's perfect. There is a way to do the same to change the source? Really thank you