Hi everybody, this is my first post here, and I searched for what I am looking for but I cannot seem to find it. I am brand new to Home Assistant, although I have been lurking for probably 2 years now. My Raspberry pi should be here in a couple of days and am very excited to get started.
For my first automation, I am wanting to automatically turn on my stereo via smart plug when I cast music to my chromecast audio. Is there a way to intercept the google cast and automatically turn on the smart outlet when casting to that particular chromecast audio? I have tasker installed on my phone if that is needed, but I would rather not have to go that route if possible.
Side question for those of you who use NodeRed, since I am setting up my HA from scratch, should I start setting up my automations using NodeRed from the start, or use the default yaml HA configuration for this? I have experience using python and modelbuilder (in ArcMap if anyone is familiar) so the idea of flows is fairly comfortable with me.
Yes, you will be able to turn on/off an outlet when casting starts on your Chromecast Audio. Youâll need to setup the Chromecast as a media_player in HA and make sure it has constant power supplied to it (ie. not plugged in to a switched usb outlet on your stereo or tv). Then you can setup an automation that watches for a âplayingâ state on that media_player and triggers the outlet.
I havenât used NodeRed, so I canât answer the 2nd question.
Sure, that sounds like a simple Automation, which is a great place to start. Once both the Chromecast and the Outlet are configured as components in HA, your Automation could be triggered whenever the state of the Chromecast is âplayingâ or âpausedâ (or alternatively, not âidleâ or âoffâ). Presumably youâd also want to turn the Outlet off when the Chromecast is not playing, and so begins your journey down the rabbit hole.
Iâm in the process of converting most of my Automations from .yaml to Node-RED. Having to get NR configured in addition to HA can be a relatively big pain (especially over SSL) so you might want to start with .yaml just to get up and running and get your feet wet. Iâve also found that some of the more complex Automations (that require scripting) are easier to do in .yaml, and in some cases, practically impossible to do in NR. That being said, most Automations (including your example) are much easier to create in NR.
eg:
In .yaml youâd be doing something like this:
âŚby obtaining the syntax from the HA documentation then referring to the Developerâs tools > States page in your HA instance to locate the component names and states.
In Node-RED youâd be doing something like this:
âŚby choosing from drop-down listsâŚ
âŚ
âŚ
But either way, there are some brilliant people in these forums to help you along.
- id: Cast_Music_Family
alias: Family Music
trigger:
- platform: state
entity_id: media_player.family_room_speaker
to: playing
from: idle
- platform: state
entity_id: media_player.family_room_speaker
to: playing
from: 'off'
action:
- service: switch.turn_on
entity_id: switch.vsx_power
In Nodered its easier with an event node for the media player entity.
Hey guys, so I have been butting my head against this ever since I initially posted here. For whatever reason, I cannot get this to work.
This is my code. At first I thought that it was the chromecast audio giving me issues, so I changed triggers to see if that fixed it. Unfortunately, it did not.
The automation runs correctly when I call it through the services tab. On my about tab, I am getting several errors, few of which relate to my automation (I think):
Error doing job: SSL error errno:1 reason: WRONG_VERSION_NUMBER Traceback (most recent call last): File âuvloop/sslproto.pyxâ, line 504, in uvloop.loop.SSLProtocol.data_received File âuvloop/sslproto.pyxâ, line 204, in uvloop.loop._SSLPipe.feed_ssldata File âuvloop/sslproto.pyxâ, line 171, in uvloop.loop._SSLPipe.feed_ssldata File â/usr/local/lib/python3.7/ssl.pyâ, line 763, in do_handshake self._sslobj.do_handshake() ssl.SSLError: [SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1056)
Error doing job: SSL handshake failed Traceback (most recent call last): File âuvloop/handles/stream.pyxâ, line 609, in uvloop.loop.UVStream._on_eof File âuvloop/sslproto.pyxâ, line 171, in uvloop.loop._SSLPipe.feed_ssldata File â/usr/local/lib/python3.7/ssl.pyâ, line 763, in do_handshake self._sslobj.do_handshake() ssl.SSLError: [SSL: VERSION_TOO_LOW] version too low (_ssl.c:1056)
Error doing job: SSL error errno:1 reason: HTTP_REQUEST Traceback (most recent call last): File âuvloop/sslproto.pyxâ, line 504, in uvloop.loop.SSLProtocol.data_received File âuvloop/sslproto.pyxâ, line 204, in uvloop.loop._SSLPipe.feed_ssldata File âuvloop/sslproto.pyxâ, line 171, in uvloop.loop._SSLPipe.feed_ssldata File â/usr/local/lib/python3.7/ssl.pyâ, line 763, in do_handshake self._sslobj.do_handshake() ssl.SSLError: [SSL: HTTP_REQUEST] http request (_ssl.c:1056)
Update of light.led_controller is taking over 10 seconds
Error doing job: Fatal error on transport TCPTransport (error status in uv_stream_t.read callback) TimeoutError: [Errno 110] Operation timed out
Error doing job: SSL error errno:1 reason: KRB5_S_INIT Traceback (most recent call last): File âuvloop/sslproto.pyxâ, line 504, in uvloop.loop.SSLProtocol.data_received File âuvloop/sslproto.pyxâ, line 204, in uvloop.loop._SSLPipe.feed_ssldata File âuvloop/sslproto.pyxâ, line 189, in uvloop.loop._SSLPipe.feed_ssldata File â/usr/local/lib/python3.7/ssl.pyâ, line 767, in unwrap return self._sslobj.shutdown() ssl.SSLError: [SSL: KRB5_S_INIT] application data after close notify (_ssl.c:2605)
Okay, so I got it working with NodeRed, but I still have no idea why the yaml method isnt working.
On an unrelated note, I am having difficulties enabling my packages and other !include objects in my config yaml. When I uncomment packages I get this error:
Configuration invalid
Component not found: packages
And when I uncomment my zigbee2mqtt.yaml file I get this error
Configuration invalid
Error loading /config/configuration.yaml: Config file not found: /config/zigbee2mqtt.yaml!
First, a silly question: in the link you shared above your automations for the chromecast are commented out. (with a #) Is this because you gave up on it? Or, did you accidentally comment them out? They will of course not run if commented out.
Otherwise, my suggestion would be to remove the âfromâ check on the state. This isnât necessary for what youâre doing. I have an almost identical automation and only use âtoâ conditions for my state.
Also, check the formatting on your action. Note that mine is 3 lines (data, entity_id, service) but yours is only 2 (service, entity_id). Besides having the right items in the right order, also pay close attention to the indents when you adjust it.
id: '1536397612175'
alias: netflix
trigger:
- entity_id: media_player.domescast
platform: state
to: playing
action:
- data:
entity_id: media_player.marantzamp
service: media_player.turn_on
- data:
entity_id: media_player.sharp_aquos_tv
service: media_player.turn_on
Thanks for your help! I did comment the code about the chromecast out because I couldnât get it to work, and thought maybe it was the chromecast that was the problem. So I commented it out, and tried to use the led controller to trigger it instead.