I just got this to work with an automation, should be the same I think. Devices are a raspberry pi squeezeplayer (hoolio) and a Yamaha AV-Receiver RX-V479 (kitchen_avr)
From the action part at the end of my automation you should be able use this:-
## note - hoolio is the name of my squuezebox media player
alias: Hoolio begins playing
trigger:
- platform: state
entity_id: media_player.hoolio
to: 'playing'
from: 'idle'
- platform: state
entity_id: media_player.hoolio
to: 'playing'
from: 'off'
action:
- service: media_player.turn_on
#change this to match your AVR
entity_id: media_player.kitchen_avr
- service: media_player.select_source
data:
#change this to match your AVR
entity_id: media_player.kitchen_avr
source: AV4
“media_player.kitchen_avr” is the name of my receiver in HASS - the input on the reciever for my squeezeplayer named hoolio is “AV4” - the source. in data:
You wouldn’t believe how much it pleases me to know I have finally helped someone else here instead of my usual leaching!
I should mention I also have the reverse of this set up in another automation - to turn the AVR off when playback has finished. No input source needed for switching off though.
Hi, I am still learning automation. FOr now I want just to press a switch/button and turn on AVR and put in the correct output.
How would I do that?
This below and then what?
action:
- service: media_player.turn_on
#change this to match your AVR
entity_id: media_player.kitchen_avr
- service: media_player.select_source
data:
#change this to match your AVR
entity_id: media_player.kitchen_avr
source: AV4
a click on the front-end. I got a amazon dash to test, nothing else as real switch though. I ordered some stuff (PIR sensors) but I don’t have them yet.
Ahh I have presence detection but its crap IMO, tried owntracks, gpslogger, netgear, all don’t work well. Very unreliable.
Trying to use ibeacon/bluetooth technology, but I am not there yet.
p.s. maybe with the new GPS Galileo system will work better, in Europe.
Ah - OK I misunderstood what you meant by button or switch.
I have the same problem with presence. For now I use an input boolean to prevent my welcome home routine running 10 times a night rather than just on the initial connection. I have given up on GPS.
Have a similar problem.
I have a script up and running, turning my mediacenter with all components on, incl. correct source, etc.
My plan is to switch it on and of via webui and echo dot for now.
As for the script I just have an activate button.
For the first instance the eco dot that switches a emulated hue needs an on and off switch.
Perfect would be a activate button with if case bolean that switches between on and off for the web interface and a hidden on off switch for the echo dot
Yeah thanks. Thats exactly what I wanted to do, but unfortunately it doesnt work for me. I get no errors and the switches/scripts are working but nothing happens when I change the bolean.
My working sllution is an automation:
input_boolean:
watch_movie:
name: Mediacenter
initial: off
I need some help… I want to make a script which checks if both TVs are off, if yes it turns on one of them and then check which one is open and changes the source. I have the code below. If I uncomment the commented part of the script it works only when both TVs are off. If one of them is turned on it gives me this error. Any ideas? The code is below
Entity ID is an invalid entity id for dictionary value @ data[‘entity_id’]
Yes but I don’t think that this is the case… What I mean, if I have both TVs off and run the script (with the commented part) the TV turns on and then it changes the source… If i run the script second time with one of the TVs already on is when i get the error. I will try what you are saying when i will be at home and i will tell you the results.
Do you know if/how i can put the commented part to run in the “else” statement? So first it will check if any of the TVs are open and then turn on one
I found the problem… It was in the first part where it checks if both TVs are off and if yes it turns on one… When One it was already turned on it was trying to run the turn on command without an entity_id so i change it a bit and actually it runs the turn on command even if the TV is already turned on… If someone knows how to optimize it tell me!!