Totally new here, absolutely love Home Assistant after having only played around with it for a few hours.
I have successfully setup Home Assistant along with google assistant and have added the Broadlink RM Switch to my config.yaml file and am able to get this to turn on and off a projector (IR) and screen (RF) which is awesome.
My question is, is it possible to setup a switch/ command to send both commands at the same time, so that I can say to google assistant ‘bedroom projector on’ / ‘bedroom projector off’ and it would fire both commands, rather than having to say ‘projector on’… ‘screen on’, etc.
My projector doesn’t have a seperate on/off button and requires the power button to be pressed twice to turn it off, is there a way in the off command I can get it to send this command twice?
I have a script that operates several button pushes on my remote. You might need to put some delays in between the send commands or the device might see it as a single button push (single code)
I’ve setup the following code in scripts.yaml
equipment_on:
alias: Equipment On
sequence:
- service: switch.broadlink_send_packet_192_168_1_205
data:
packet:
- “sgAMAQ8tLw8QLQ8tLw8vEC8PEC0PLi4QDy4PLQ8AAc4uEA8tLw8vDzAPEC0vEA8uLw8QLi8QLxAPLi8QDy4PLi8QMBAvEBAtEC4vEBAtEC0QAAHPLw8QLS8QLxAwEA8uMA8QLi8QEC4vEDAQEC4wEA8uEC4vEDEPMRAPLw8uMBAQLg8uEAAB0S8QDy4vEDAQMBAPLy8RDy4wEBAuMBAwEQ8vMBAQLg8vMBAwETAQEC8PLjEQEC4QLg8AAdMwDxAuLxAwEDEQEC4wEBAuMRAPLzAQMRAQLzARDy8PLzAQMRAyEBAuEC8wEBAvDy8QAAHULxAQLjAQMBEwEBAvMBAQLjEQEC8wETEQEC8xEAYABdwAAAAAAAAAAAAAAAA=”
- “JgBoAQABJZQSOBI4EhMSExITEhMSExI4EjgSExI4EhMSOBITEjgSExITEhMSExITEjgSExITEjgSOBI4EjgSOBITEjgSOBITEgAFPQABJpQSOBE4EhQRFBEUERQRFBE4EjgSExI4EhMSOBITEjgSExITEhMSExITEjgSExITEjgSOBI4EjgSOBITEjgSOBEUEQAFPQABJpQSOBI4EhMSExITEhMSExI4EjgSExI4EhMSOBITEjgSExITEhMSExITEjgSExIUETgSOBI4ETgSOBITEjgSOBITEgAFPQABJpQSOBI4EhMSExITEhMSExI4EjgSExI4EhMSOBITEjgRFRETEhMSExITEjgSExITEjgROBI4EjgSOBITEjgSOBITEgAFPQABJpQSNxI4EhMSExIUERQRFBE4EjgSExI4EhMSOBITEjgSExITEhMSExITEjgSExITEjgSOBI4EjgSOBEUEjcSOBITEgANBQ==”
equipment_off:
alias: Equipment Off
sequence:
- service: switch.broadlink_send_packet_192_168_1_205
data:
packet:
- “sgDuAA4uLhAPLS8PLxAPLi4QDy4PLS8QLhAvEBAtEC0PLi8PEC4OAAHPLhAPLi4QLxAvEA8uLxAPLy4QEC4vEC8QEC4vEA8vDy4vEDAQMBAPLw8uDy4vEBAuDwAB0S8QDy4uEDAQMBAPLjAQDy8vEBAuMBAwEA8vMBAQLg8uMBAxEDARDy8PLhAuMBAPLw8AAdMvEA8uMBAwEDAQDy8wEA8vMBAQLy8RMBEPLzAQEC4QLjARMBEwEQ8vEC4QLjARDy8QAAHTMBAPLjAQMBEwEBAvMBAQLjEQEC8wEDERDy8wERAvDy8wEDERMREPMAQABdwAAAAAAAAAAAAA”
- “JgBoAQABJZQSOBI4EhMSExITEhMSExI4EjgSExI4EhMSOBITEjgSExITEhMSExITEjgSExITEjgSOBI4EjgSOBITEjgSOBITEgAFPQABJpQSOBE4EhQRFBEUERQRFBE4EjgSExI4EhMSOBITEjgSExITEhMSExITEjgSExITEjgSOBI4EjgSOBITEjgSOBEUEQAFPQABJpQSOBI4EhMSExITEhMSExI4EjgSExI4EhMSOBITEjgSExITEhMSExITEjgSExIUETgSOBI4ETgSOBITEjgSOBITEgAFPQABJpQSOBI4EhMSExITEhMSExI4EjgSExI4EhMSOBITEjgRFRETEhMSExITEjgSExITEjgROBI4EjgSOBITEjgSOBITEgAFPQABJpQSNxI4EhMSExIUERQRFBE4EjgSExI4EhMSOBITEjgSExITEhMSExITEjgSExITEjgSOBI4EjgSOBEUEjcSOBITEgANBQ==”
- “JgBoAQABJZQSOBI4EhMSExITEhMSExI4EjgSExI4EhMSOBITEjgSExITEhMSExITEjgSExITEjgSOBI4EjgSOBITEjgSOBITEgAFPQABJpQSOBE4EhQRFBEUERQRFBE4EjgSExI4EhMSOBITEjgSExITEhMSExITEjgSExITEjgSOBI4EjgSOBITEjgSOBEUEQAFPQABJpQSOBI4EhMSExITEhMSExI4EjgSExI4EhMSOBITEjgSExITEhMSExITEjgSExIUETgSOBI4ETgSOBITEjgSOBITEgAFPQABJpQSOBI4EhMSExITEhMSExI4EjgSExI4EhMSOBITEjgRFRETEhMSExITEjgSExITEjgROBI4EjgSOBITEjgSOBITEgAFPQABJpQSNxI4EhMSExIUERQRFBE4EjgSExI4EhMSOBITEjgSExITEhMSExITEjgSExITEjgSOBI4EjgSOBEUEjcSOBITEgANBQ==”
I can run the scripts from the frontend of HASS and they work - how can I get these to work with google assistant/ Alexa? It sees the scripts, but fails to execute them.
I am not sure about google but Alexa see’s the scripts as scenes. This means you have to say Alexa turn on equipment on (based on your example). Which isn’t very intuitive.
In alexa I can get around this with routines but a better way is to create a template switch then use the filter to block the scripts coming through (if you need to) . Alexa see’s the template as the actual switch
Heres my example for the stereo under switches in config.yaml:
For Google, you’ll need to add hassio as skill in the google home app and log into the Home assistant cloud within the Home assistant configuration settings within the front end.
Once you do this, it will expose all of your home Assistant devices and entities to google. You can call scripts by saying “ok google, activate YOUR_SCRIPT_NAME”
I have google assistant setup and working. It was able to turn on and off all switches (individually). However, when i unlink my account and drink it to Google home, it’s not pulling through the latest script names. All config is fine and I can call the scripts from the front end, when i ask google, it can’t find the scripts.
Other than unblinking and relinking the hassle account I’m not sure what else I can do
Ok, so I have managed to get the projector and screen to turn on, using google assistant. But I can’t get them to turn off. If I execute the scripts from the hassio portal, they work, so I think it is a misconfiguration with my switch template?
I think some of you’re spacing is off and the platform is missing. I’m surprised this hasn’t given you some errors in the config checker or on restart??
Hi, I can get google assistant to turn on and off “Projector” and “Projector Screen”. I’ve gone through my config again, I can get google assistant to turn on “Screen” but not turn it off - it doesn’t even attempt to fire the commends to the Broadlink RM Pro. I think it’s a problem with the value_template still, it’s referencing a switch in my config.yaml (below) - is this correct? Here is a full dump of the config.yaml and scripts.yaml:
spacing is all fine and passes config checks, I just can’t get it to paste into the browser as code when when I press the preformatted text button - so spacing will look off.
I used to use a script but that never worked well.
What finally worked was using https://dimagoltsman.github.io/Random-Broadlink-RM-Code-Generator/ to generate a twice repeated power toggle code from my existing single press code. Go to the “Change Repeats” tab and enter your existing code and 1 in the repeat box.
Works 100% of the time now.
Oh and for the screen, I use an automation that lowers the screen along with the projector turning on.
It’s very hard to tell without the spacing. The only way I can think to test is to add the template switch to the front end and manually turn it on and off that will test if the problem is in the template. Also check all scripts and entities work individually too
Ok, so I still have the same problem - I can turn the “screen” on but not turn it off using google assistant. Calling the scripts (on/off) in Hassio work.
Can someone advise if value_template: “{{ is_state( ‘switch.projector_screen’, ‘on’) }}” is correct, as Hassio never changes the state, so I am guessing when I am calling the template switch “Screen” it’s not seeing the projector_screen actually being on, so it doesn’t run the turn off command?
Here is all of my config, hopefully this posts ok.
Would you be able to share your automation for the lowering of the screen and projector turning on? I will see if I can get this working with my codes.
I don’t think so. It needs to be an entity that when the template is switched on, will also be switched on, so the template can evaluate its state against it. Because in your script you have the send packet command it doesn’t turn the switch.projector_screen on in home assistant. (Hope that makes sense)
I think you could change the scripts so that the sequence is:
- service: switch.turn_on:
entity_id: switch.projector_screen (or however the entity of the switch appears in your HA instance)
- service: switch.turn_on
entity_id: switch.projector (or however the entity of the switch appears in your HA instance)
This should have the same affect as sending the command twice but the first will tell home assistant and the template that the switch is on.
You will need to do the same for the off script but with switch_turn off of course .
Check the revised scripts work as you might need to put a delay in there. I find my broadlink works better if I put a very small delay of either 0.25 to 0.5 seconds
Thanks for posting in correct format it is much easier to see the problem