Hi folks,
I have a simple (hopefully) want:
To turn on my DenonAVR1550H when I play content (ie. playing, not paused) on the SONOS device connected via Optical. The amp doesn’t seem to detect this input (HDMI CEC inpouts work a treat).
Have used NR for other automations (lights and some sensors). But can’t seem to get any sensible outputs for either my SONOS or Denon AVR in NR…
Is there a better way (happy to look at other automations if I’m nuts trying to do this in NR)?
Not sure where to explore…
So, just to get this right, when you play something on sonos, you need an automation to:
- Switch on the Denon
- switch to optical input
- (no stated by you) turn to some sensible volume level - in fact this should probably be done before 2.
Hi again,
Yes. Well articulated (much better than me).
I’m only just now reading about the NR Denon Contrib…
trigger:
platform: state
entity_id: media_player.sonos
to: 'playing'
action:
service: media_player.turn_on
entity_id: media_player.denon
service: media_player.volume_set
data:
entity_id: media_player.denon
volume_level: 0.3
service: media_player.select_source
data:
entity_id: media_player.denon
source: optical
or something like that!!
Pardon the ignorant question…
Your example above is an ‘automation’ in HA?
Rather than NR?
Which is fine, just trying to get my mental context right.
Sorry yes, you said you were amenable to other ideas…
Absolutely am.
Justed wanted to make sure I was reading it correctly. Only played in NR to date.
Gotta say the automations are much simpler to fathom.
There aren’t any issues running both (provided they don’t overlap)?
No issues at all afaik.
Come on, what I wrote is pretty simple
when the sonos state changes to playing, turn on the denon, turn the volume to 30% and change the input to optical.
Frankly node red has it’s uses, but is not needed most of the time.
Yep. You’re right about NR.
I’ll have a go at my first automation using your guidance above.
Seems logical and easy to navigate.
I’ll report back when I’ve had a crack.
Thanks again @nickrout
One more quick question…
I assume we can only set automation based on the entities and attributes we can see in home assistant?
In my case those visible in denonavr.
The node red notes use the commands and parameters based on the telnet commands which are vast in comparison to what homeassistant says it can see.
correct. but this forum is about using node red with home assistant. if you want general node red advice, I assume node red has its own forums.
Yeah.
I’m more interested in doing the automations the way you’ve laid it out in this thread.
So I’ll continue down this path.
Cheers,
Hi @nickrout,
So I think I’m in love with automations outside of NR!
You’ve opened my eyes. Thank you.
I do have two queries though.
In relation to the scenario above:
I can get
the AMP to turn on based on the state change of the SONOS device on the optical interface
(from ‘paused’ to ‘playing’)
change the interface of the AMP to the appropriate SONOS interface
I CANNOT get
the AMP to set it’s volume to say 0.65. It ALWAYS goes to 0 (see below) on power on state
I can get
the AMP to turn off when the state on the SONOS changes to ‘paused’
The logs don’t provide any info at all as so what might be failing - is there a separate automations log?
I’ve tried different combos of quote, apostrophes, on the volume_set service. No luck.
Question 1
Any clues on assigning the volume_set value? Where to look for detail…
Question 2
I’d like to check to make sure my AMP is indeed configured for the SONOS input before turning off. At the moment it turns off regardless of what it’s doing (against accidental trigger). So this would be a condition in Off automation, not sure how I check the input of the AMP in this process…
I’m running in a Linux Docker. So looked for logs per this:
https://developers.home-assistant.io/docs/en/hassio_debugging.html
The logs only show this:
2019-07-15 05:56:53 INFO (MainThread) [homeassistant.components.automation] Executing SONOS Denon ON
2019-07-15 05:56:53 INFO (MainThread) [homeassistant.helpers.script] Script SONOS Denon ON: Running script
2019-07-15 05:56:53 INFO (MainThread) [homeassistant.helpers.script] Script SONOS Denon ON: Executing step call service
2019-07-15 05:56:53 INFO (MainThread) [homeassistant.helpers.script] Script SONOS Denon ON: Executing step call service
2019-07-15 05:56:53 INFO (MainThread) [homeassistant.helpers.script] Script SONOS Denon ON: Executing step call service
/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py:851: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
InsecureRequestWarning)
2019-07-15 05:57:15 INFO (MainThread) [homeassistant.components.automation] Executing SONOS Denon OFF
2019-07-15 05:57:15 INFO (MainThread) [homeassistant.helpers.script] Script SONOS Denon OFF: Running script
2019-07-15 05:57:15 INFO (MainThread) [homeassistant.helpers.script] Script SONOS Denon OFF: Executing step call service
/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py:851: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
InsecureRequestWarning)
My code is below:
- id: '1563129872586'
alias: SONOS Denon ON
trigger:
- entity_id: media_player.rumpus
from: paused
platform: state
to: playing
condition:
- condition: state
entity_id: media_player.denonavr
state: 'off'
action:
- data:
entity_id: media_player.denonavr
service: media_player.turn_on
- data:
entity_id: media_player.denonavr
volume_level: '0.65'
service: media_player.volume_set
- data:
entity_id: media_player.denonavr
source: 'SONOS'
service: media_player.select_source
- id: '1563131103792'
alias: SONOS Denon OFF
trigger:
- entity_id: media_player.rumpus
from: 'playing'
platform: state
to: 'paused'
condition:
- condition: state
entity_id: media_player.denonavr
state: 'on'
action:
- data:
entity_id: media_player.denonavr
service: media_player.turn_off
The attributes on my amp are:
volume_level: 0.64
is_volume_muted: false
media_content_type: channel
media_title: SONOS
source: SONOS
source_list: AUX,AppleTV,Blu-ray,Bluetooth,DVD,Game,HEOS Music,Phono,SONOS,TV Audio,Tuner
sound_mode: STEREO
sound_mode_list: MUSIC,MOVIE,GAME,AUTO,VIRTUAL,PURE DIRECT,DOLBY DIGITAL,DTS SURROUND,MCH STEREO,STEREO,ALL ZONE STEREO
sound_mode_raw: Stereo
friendly_name: DenonAVR
supported_features: 69004
Can send through a complete log if needed…
Once again - thanks!
Take the quotes out from the ‘0.65’ - volume_set takes a float (ie a floating point number) whereas you are passing it text (enforced by the quotes). So
volume_level: 0.65
This now reads:
- data:
entity_id: media_player.denonavr
volume_level: 0.65
service: media_player.volume_set
Have restarted homeassistant service.
The media_player.denonavr now states:
volume_level: 0
does the order of the operators matter?
ie. from this
- data:
entity_id: media_player.denonavr
volume_level: '0.65'
service: media_player.volume_set
to this
- data:
service: media_player.volume_set
entity_id: media_player.denonavr
volume_level: '0.65'
would that matter?
Okay - my learning journey.
I added a delay of 5 seconds to see if that helped.
I think it’s done the trick…
media_player.denonavr
state on
volume_level: 0.65
YIPPEE :)
Now, my second query,
How would I check the source input as a condition in my OFF automation?
I’ll have a go again in the mean time.
Restarting home assistant won’t trigger the automation. Turning the sonos to “playing” or clicking “trigger” in the ui will trigger it.
Yup - restarted HAS service to force it to read the automations.yaml file again (after changes).
Do I not need to do this? Does it read it every time there’s a trigger?