TL;DR : Automation of a dumb Yamaha receiver through Harmony Hub, NodeRed and a control through Lovelace and custom card.
This took me a while so I wanted to share this for some other folks that are in the same situation, maybe it’ll help someone.
Problem
I have a dumb Yamaha receiver, how dumb you ask? It doesn’t even have HDMI inputs. It’s connected to ceiling speakers. I thought it’s a good idea to make my house tony stark like and have Alexa answer from the ceiling, so I got an Echo input. It doesn’t have its own speakers, but can be connected via cable or bluetooth.
Three problems with this:
#1 Turning on the TV we also needed to turn on the right input on the very dumb Yamaha RX-V596 receiver. Then we needed to control its volume somehow.
#2 we have a toddler, and the receiver is exactly where she likes to reach, and it has a LOT of nice knobs to turn and buttons to press, so a lot of time, the whole thing would break.
#3 When the TV is OFF, we needed to remember to turn the input back to Alexa (as this is how we listen to music/Spotify)
First step : Harmony Hub to the rescue
Harmony hub was my first smart home thingie, and I still have that trusty sidekick to this day.
I’ve set up scenes there, that learned the Yamaha remote, and when asked to listen to music, it would switch inputs to Alexa inputs.
I’ve added Harmony to Alexa via a skill, so I was at least able to say “Alexa, watch TV” so it’ll switch inputs
Step 2 : Automation
After I’ve discovered the awesome that is nodeRED and added my TV (Roku TV) to HA as media_player, I was able to monitor it’s state and switch to the TV input automatically when TV was on, and switch back when TV was off.
[{"id":"c969f7e9.9f44a8","type":"api-call-service","z":"68c92213.38985c","name":"Yamaha: Switch input to \"Alexa\"","server":"ff7cb6b5.886398","version":1,"debugenabled":false,"service_domain":"remote","service":"turn_on","entityId":"remote.harmony_hub","data":"{\"activity\": \"Listen to Music\"}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":330,"y":180,"wires":[["caa7f37a.64e13"]]},{"id":"aec2eaea.64cce8","type":"trigger-state","z":"68c92213.38985c","name":"TV on/off","server":"ff7cb6b5.886398","exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityid":"media_player.living_room_tv_roku","entityidfiltertype":"exact","debugenabled":false,"constraints":[],"constraintsmustmatch":"all","outputs":4,"customoutputs":[{"outputId":"w8wg8fk8o9l","messageType":"default","messageValue":"","messageValueType":"json","comparatorPropertyType":"current_state","comparatorPropertyValue":"new_state.state","comparatorType":"includes","comparatorValue":"home,playing"},{"outputId":"rtcq5mwd7vc","messageType":"default","messageValue":"","messageValueType":"json","comparatorPropertyType":"current_state","comparatorPropertyValue":"new_state.state","comparatorType":"includes","comparatorValue":"standby,off"}],"outputinitially":false,"state_type":"str","x":80,"y":120,"wires":[[],[],["8a93544d.941408"],["c969f7e9.9f44a8"]]},{"id":"8a93544d.941408","type":"api-call-service","z":"68c92213.38985c","name":"Yamaha: Switch inputs to TV","server":"ff7cb6b5.886398","version":1,"debugenabled":false,"service_domain":"remote","service":"turn_on","entityId":"remote.harmony_hub","data":"{\"activity\": \"Watch Tv\"}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":320,"y":80,"wires":[["1239263c.931e7a"]]},{"id":"ff7cb6b5.886398","type":"server","z":"","name":"Home Assistant"}]
This has a trigger state node to check state of TV, and trigger a service call through Harmony Hub to turn on the right scene in Harmony. (I guess I could directly control the device but I already had scenes set up)
Step 3 : Toddler issue
Even if we had the TV on, and the input was the right one, our toddle would come in and play with inputs, switch input type (why is this a thing?) and do other miscellaneous damage, that would stop the household from being able to enjoy movie night (without me present to fix)
I fixed this by adding the following into lovelace:
This allows me and my wife to quickly change the input scene directly from lovelace and change volume.
Additionally this has a status detector so we can quickly see which input we’re on right now, and an additional click on the same input toggles something in Yamaha, so it may fix something our toddler did.
It took a while to set this up, and used custom button card for this thing which is ridiculously customizable
- cards:
- color_type: icon
entity: remote.harmony_hub
icon: 'mdi:amazon-alexa'
name: Alexa
color: var(--disabled-text-color)
state:
- color: 'rgba(3, 169, 244,1.0)'
value: >
[[[ return entity.attributes.current_activity == 'Listen to Music'
]]]
operator: template
tap_action:
action: call-service
haptic: success
service: remote.turn_on
service_data:
entity_id: remote.harmony_hub
activity: Listen to Music
type: 'custom:button-card'
- entity: remote.harmony_hub
name: TV
icon: 'mdi:television'
color: var(--disabled-text-color)
state:
- color: 'rgba(3, 169, 244,1.0)'
value: |
[[[ return entity.attributes.current_activity == 'Watch Tv' ]]]
operator: template
tap_action:
action: call-service
haptic: success
service: remote.turn_on
service_data:
entity_id: remote.harmony_hub
activity: Watch Tv
type: 'custom:button-card'
style: |
ha-card {
margin: 10px;
background: rgba(255,255,255,0.95)
}
type: horizontal-stack
- cards:
- color: 'rgba(3, 169, 244,1.0)'
color_type: icon
icon: 'mdi:volume-mute'
tap_action:
action: call-service
haptic: heavy
service: remote.send_command
service_data:
entity_id: remote.harmony_hub
device: 64132272
command: Mute
type: 'custom:button-card'
- action: call-service
color: 'rgba(3, 169, 244,1.0)'
color_type: icon
icon: 'mdi:volume-minus'
hold_action:
action: call-service
haptic: light
service: remote.send_command
repeat: 350
service_data:
entity_id: remote.harmony_hub
device: 64132272
command: VolumeDown
tap_action:
action: call-service
haptic: heavy
service: remote.send_command
service_data:
entity_id: remote.harmony_hub
device: 64132272
command: VolumeDown
type: 'custom:button-card'
- action: call-service
color: 'rgba(3, 169, 244,1.0)'
color_type: icon
icon: 'mdi:volume-plus'
tap_action:
action: call-service
haptic: heavy
service: remote.send_command
service_data:
entity_id: remote.harmony_hub
device: 64132272
command: VolumeUp
hold_action:
action: call-service
haptic: light
service: remote.send_command
repeat: 350
service_data:
entity_id: remote.harmony_hub
device: 64132272
command: VolumeUp
type: 'custom:button-card'
type: horizontal-stack
type: vertical-stack
Conclusion
I just am amazed by the fact that HA can serve as my automation platform and is customizable enough so that I can create a universal remote right inside it!
Next steps:
Create a universal media_player that will encompass the above and will allow to control everything from HA, not just volume.
Also I’d love to figure out how to have Alexa turn down the volume and speak over it like she does with music, I think it’s called demuxing or something like this, if theres’s anyone here who did this, I’d love to brainstorm!
Thoughts, opinions, questions and suggestions to how achieve the same better are welcome.
If you are interested, check out my full kit of smart home here: