Total newbie to HA, adding broadlink RM Pro+ help

hi all

this is possibly a very silly question but I’ve been trying to sort this out myself for about a week now and i’m about to throw this thing in the bin…

i’m trying to control two rf plugs (connected to two lamps) via a Broadlink RM Pro+.

this is my aim…

1 hour before the sun sets the lamps will switch on, unless its after 9.30pm, in another instance… the lamps will turn off (if they are on) at 9.30pm

these are to run no matter if I am home or not.

my problem… I have no Idea what I am doing… but here is what I have tried.

in my configuration.yaml i have the following (mac and IP addresses have been removed)

# Broadlink RM pro
switch:
  - platform: broadlink
    host: IP
    mac: ''
    Switches:
      Tall_lamp:
        friendly_name: "Tall Lamp"
        command_on: 'sgCSAQtMJA4LJgwmJA4LJyMODCYkDiQOJA0lDSQOCyckDQwmCyYMJiUNDCYLJwsnIw4MJgsnC0wkDQwmDCYkDgsmJQ0MJiQNJQ0lDSUNJA0MJiUNCycLJwsmJQ0MJgsnCyYkDgwmCycLSyUNDCYMJiQNDCYkDgsnJA4kDSUNJA4kDQwmJQ0MJgsnCyYlDQsnCyYMJiQODCYMJgtMJA4LJgsnJA4LJiUNDCYkDiMOJA4kDiQOCyYlDQsnCyYMJiQODCYLJwsmJA4MJQwnYusgERAiECIhERAiIBIQIiASIBIgEiASIBEQIiASECIQIhAiIBIPIw8jDyIhERAiECJj6iASECIQIiASDyMgEg8iIBIgEiASIREhERAiIBIPIw8jDyMgERAiECIQIiASECIQImPqIBIPIw8jIBEQIiERECIgEiASIBIgEiASDyMgERAiECIQIiASECIPIxAiIBIPIw8jYusgEg8iECIgEhAiIBIQIiASIBIgEiASIBEQIiERECIPIxAiIBIPIhAiECMgERAiEAAF3AAAAAAAAA=='
        command_off: 'sgCSAQxMIw4MJgsnJA0lDSQOJA4kDQwmDCYLJyQNDCYlDQsmJQ0MJgwmCyckDQwmJA4LJgwmDEwjDgsnCyYlDSUNJA4kDiQOCyYMJgsnJA0MJiQOCyYlDQwmDCYLJyQNDCYkDgsmDCcLSyUNCycLJyQNJQ0kDiQOJA0MJgwmCyckDQwmJA4LJyQNDCYMJgwmJA0MJiQOCycLJwtLJQ0LJwsmJQ0lDSUNJA4kDQwmDCYLJyQNDCYlDQsnJA4LJgwmCyYlDQwmJA4LJwsnYusgERAiECIgEiASIBIgEiASDyIQIw8iIBIQIiASECIgEg8jDyIQIyARECMgERAiECJj6iASECIPIyASIBEhEiARIRIPIhAiECIgEhAiIBIPIyARECMPIhAiIREQIiASDyMQImPqIBIPIw8jIBIgEiARIREgEhAiDyMQIiASDyMgERAiIBIQIhAiDyMgEhAiIBIPIw8jYusgEg8iECMgESASIBIgEiASDyMPIw8jIBEQIiASECIgEhAiDyMPIyASDyIhERAiEAAF3AAAAAAAAA=='
      corner_lamp:
        friendly_name: "Corner Lamp"
        command_on: 'sgCTAQtMJA0MJgwmJA4kDiQNJQ0LJyQNJQ0MJiUNCyckDSUNDCYkDgsmJQ0kDgwlDCYMJgsnDEskDgsmDCYkDiQOJA0lDQwmJA4kDQwmJQ0LJyQOIw4MJiQNDCYlDSUNCyYMJgwmCycLTCQOCyYMJiQOJA0lDSQOCyckDSUNCyckDgsnJA0kDgsnJA0MJiQOJA4LJwsmCycLJwtMJA4LJgsnJA4kDSUNJA4LJyQOIw4MJiQOCyYlDSQOCyckDQwmJA4kDQwmDCYMJgsnYusgEg8jDyMgESASIBIgEhAiIBIgEg8jIBIPIyARIBIQIiASECIgESESDyIQIw8iECNi6iASECIPIyASIBIgESERECIgEiASECIgEg8jIBIgEg8jIBIPIiERIREQIg8jDyMPI2LrIBIPIhAjIBEhESERIBIQIiASIBIPIyASDyMgEiARECMgERAiIBIgEhAiDyMPIw8jYusgERAiECIhESERIBIgEg8jIBIWChIPIiERECIgEiASECIgEhAiIBIgEg8jDyIQIw8ABdwAAAAAAA=='
        command_off: 'sgCSAQxLJA0MJgwmJA4kDiQOIw4kDgwmCyYMJiUNCyckDQwmJA4LJgwmDCYkDgsnCyYMJgwmDEskDQwmDCYkDiQNJQ0lDSQOCycLJwsmJA4LJiUNDCYkDgsnCyYMJiQODCYLJgwmDCYLTCQNDCYMJiQOJA0lDSUNJA4LJwsmDCYkDgsmJQ0MJiQOCycLJgsnJA4LJgwmDCYLJwtMJA0MJgwmJA4kDiMOJA4kDgsmDCYMJiQOCyYlDQwmJA4LJgwmCyckDQwmDCYMJgsnYuohERAjDyIgEiASIBIgEiASECIPIhAjIBEQIiERECIgEg8jECIPIiASECIQIhAiECJj6iASDyMQIiASIBEhEiARIREQIhAiECIgEhAhIRIPIiERECIQIg8jIBIPIw8iECMPImPqIBIQIhAiIBIgEiASIBIgERAiECIQIiASECIgEg8jIBEQIhAjDyMgERAiECIQIhAiY+ogEg8jECIgESERIREgEiASECIPIw8jIBEQIyARECIgEhAiDyMPIyARECIQIhAjDwAF3AAAAAAAAA=='

that is a direct copy and paste.

when i try to find this in hassio to create the automation i find nothing… checked the logs… nothing… history… nothing… the only place I can find it is in the configuration.yaml file…

PLease… HELP

thank you in advance

1 Like

First off, all of your code (aside from the code for the actual RF devices and the friendly_name) should all be lower case.

Fix that and see if your switches show up in your states page. I’m pretty sure that will do it.

Finity my friend you are a true gent! thank you!!

something as simple as a couple of capital letters auto inserted by android had me totally at a loss.

thank you again!!

now to attempt the automation…

1 Like

I personally use scripts that are fired by automations, so I don’t have a whole bunch of ugly IR codes messing up my automations.yaml

1 Like

You don’t need to use the codes directly in your automations if you define the switches in the broadlink config itself. Then you simply operate the switches just like any other switch.

1 Like

This sounds like it would be alot neater, if I’m going to learn I guess it makes sense to learn the neatest, most efficient method.

Where can I see some examples of this and descriptions of what’s being done?

Sorry but like I said… Total newbie so effectively a blank slate…

If you’re just toggling individual devices it’s better to do what @finity said and use the following in your automations:

- service: switch.turn_on
  entity_id: switch.tv_power

Where tv_power is whatever you’ve defined in your Broadlink configuration. switch.turn_on will send the ‘On’ command and switch.turn_off will send the ‘Off’ command.

1 Like

thanks…

i think i follow this, i’ll give it a try tomorrow afternoon and let you know how i get on

Doing it the way you do it by putting everything directly into your scripts you have to remember what every packet does all the time.

or have a list somewhere…:thinking:

Kind of like creating switches in the broadlink platform.

Then you don’t have to remember which packet turns on your TV or turns off the stereo, you just say to turn on switch.tv or turn off switch.stereo.

Your way seems WAY TOO complicated to remember which does what.

Yeah, like I said I advise just using switch.turn_on and off.

But the way you are telling them to do it you still need to put your rf codes into the script. So you still need to remember which code does what every time you want to perform an action.

If you put your rf codes into the switches: section of the broadlink platform configuration then in your script all you need to do is call switch.turn_off or switch.turn_on.

It doesn’t make anything more clean. It just makes remembering all the different rf codes a lot harder than trying to remember switch.tv for turning on the tv.

You must have missed the part where I wrote:

EDIT: Actually what I’ve written below is mostly unnecessary. I use scripts for more complicated sequences of IR inputs (again, pretty unnecessary but just my personal taste), but if you’re just toggling individual devices it’s better to do what @finity said and use the following in your automations:

- service: switch.turn_on
  entity_id: switch.tv_power

Where tv_power is whatever you’ve defined in your Broadlink configuration. switch.turn_on will send the ‘On’ command and switch.turn_off will send the ‘Off’ command.

Look, since you’re getting hung up on it I’ll delete what I wrote above.

The only reason I’m “getting hung up on it” is that you’re giving bad advice to a total newb who is obviously struggling. And if you give that bad advice then you will just confuse them even more. Obviously there are different ways to accomplish the same thing but at times you just need to keep it as simple as possible.

I think I made it very clear that your method was preferred and that mine is just what I do though it’s unnecessary. I put that edit at the top of the post with a line underneath indicating 'everything below this line is just what I do, you should do what’s above. I even @ tagged your username in case it wasn’t clear enough.

Anyway let’s not clutter this thread anymore when the case is closed. Feel free to get in the last word if you’d like.

please people no need to argue… i understand that everyone has a different way to do things… and what is easy for one is hard for another… and vice versa… i like having different options and methods that do the same thing… it helps me to understand what things are doing rather than just remembering what someone has typed up for me…

so please leave the formatting as you did, i’m the op so surely it is polite to check if i am confused by something rather than assuming…

this being said, thank you to you both for your answers and your methods both have helped me.

remember learning without failure is just remembering, not understanding. i strive to understand.

Edit:
for some reason, i left this and came back to it 30 mins later… done nothing to it, and there on the front page is my new switch, with all of this in mind and the help of all of you i have also managed to get my frist 4 automations working… now to learn how to include conditions… thank you all


ok i thought i had this part understood… so before splitting things up further i thought i’d add another switch “main_light” but it wont show up…

i’ve refreshed the files, reloaded the files, restarted the system… pulled the power cord out and put it back in… (just to be sure)

my two original switches show up, but not my new one…

# Broadlink RM pro
 - platform: broadlink
   host: IP
   mac: 'MAC Address'
   switches:
     tall_lamp:
       friendly_name: "Tall Lamp"
       command_on: 'sgCSAQtMJA4LJgwmJA4LJyMODCYkDiQOJA0lDSQOCyckDQwmCyYMJiUNDCYLJwsnIw4MJgsnC0wkDQwmDCYkDgsmJQ0MJiQNJQ0lDSUNJA0MJiUNCycLJwsmJQ0MJgsnCyYkDgwmCycLSyUNDCYMJiQNDCYkDgsnJA4kDSUNJA4kDQwmJQ0MJgsnCyYlDQsnCyYMJiQODCYMJgtMJA4LJgsnJA4LJiUNDCYkDiMOJA4kDiQOCyYlDQsnCyYMJiQODCYLJwsmJA4MJQwnYusgERAiECIhERAiIBIQIiASIBIgEiASIBEQIiASECIQIhAiIBIPIw8jDyIhERAiECJj6iASECIQIiASDyMgEg8iIBIgEiASIREhERAiIBIPIw8jDyMgERAiECIQIiASECIQImPqIBIPIw8jIBEQIiERECIgEiASIBIgEiASDyMgERAiECIQIiASECIPIxAiIBIPIw8jYusgEg8iECIgEhAiIBIQIiASIBIgEiASIBEQIiERECIPIxAiIBIPIhAiECMgERAiEAAF3AAAAAAAAA=='
       command_off: 'sgCSAQxMIw4MJgsnJA0lDSQOJA4kDQwmDCYLJyQNDCYlDQsmJQ0MJgwmCyckDQwmJA4LJgwmDEwjDgsnCyYlDSUNJA4kDiQOCyYMJgsnJA0MJiQOCyYlDQwmDCYLJyQNDCYkDgsmDCcLSyUNCycLJyQNJQ0kDiQOJA0MJgwmCyckDQwmJA4LJyQNDCYMJgwmJA0MJiQOCycLJwtLJQ0LJwsmJQ0lDSUNJA4kDQwmDCYLJyQNDCYlDQsnJA4LJgwmCyYlDQwmJA4LJwsnYusgERAiECIgEiASIBIgEiASDyIQIw8iIBIQIiASECIgEg8jDyIQIyARECMgERAiECJj6iASECIPIyASIBEhEiARIRIPIhAiECIgEhAiIBIPIyARECMPIhAiIREQIiASDyMQImPqIBIPIw8jIBIgEiARIREgEhAiDyMQIiASDyMgERAiIBIQIhAiDyMgEhAiIBIPIw8jYusgEg8iECMgESASIBIgEiASDyMPIw8jIBEQIiASECIgEhAiDyMPIyASDyIhERAiEAAF3AAAAAAAAA=='
     corner_lamp:
       friendly_name: "Corner Lamp"
       command_on: 'sgCTAQtMJA0MJgwmJA4kDiQNJQ0LJyQNJQ0MJiUNCyckDSUNDCYkDgsmJQ0kDgwlDCYMJgsnDEskDgsmDCYkDiQOJA0lDQwmJA4kDQwmJQ0LJyQOIw4MJiQNDCYlDSUNCyYMJgwmCycLTCQOCyYMJiQOJA0lDSQOCyckDSUNCyckDgsnJA0kDgsnJA0MJiQOJA4LJwsmCycLJwtMJA4LJgsnJA4kDSUNJA4LJyQOIw4MJiQOCyYlDSQOCyckDQwmJA4kDQwmDCYMJgsnYusgEg8jDyMgESASIBIgEhAiIBIgEg8jIBIPIyARIBIQIiASECIgESESDyIQIw8iECNi6iASECIPIyASIBIgESERECIgEiASECIgEg8jIBIgEg8jIBIPIiERIREQIg8jDyMPI2LrIBIPIhAjIBEhESERIBIQIiASIBIPIyASDyMgEiARECMgERAiIBIgEhAiDyMPIw8jYusgERAiECIhESERIBIgEg8jIBIWChIPIiERECIgEiASECIgEhAiIBIgEg8jDyIQIw8ABdwAAAAAAA=='
       command_off: 'sgCSAQxLJA0MJgwmJA4kDiQOIw4kDgwmCyYMJiUNCyckDQwmJA4LJgwmDCYkDgsnCyYMJgwmDEskDQwmDCYkDiQNJQ0lDSQOCycLJwsmJA4LJiUNDCYkDgsnCyYMJiQODCYLJgwmDCYLTCQNDCYMJiQOJA0lDSUNJA4LJwsmDCYkDgsmJQ0MJiQOCycLJgsnJA4LJgwmDCYLJwtMJA0MJgwmJA4kDiMOJA4kDgsmDCYMJiQOCyYlDQwmJA4LJgwmCyckDQwmDCYMJgsnYuohERAjDyIgEiASIBIgEiASECIPIhAjIBEQIiERECIgEg8jECIPIiASECIQIhAiECJj6iASDyMQIiASIBEhEiARIREQIhAiECIgEhAhIRIPIiERECIQIg8jIBIPIw8iECMPImPqIBIQIhAiIBIgEiASIBIgERAiECIQIiASECIgEg8jIBEQIhAjDyMgERAiECIQIhAiY+ogEg8jECIgESERIREgEiASECIPIw8jIBEQIyARECIgEhAiDyMPIyARECIQIhAjDwAF3AAAAAAAAA=='
     main_light:
       friendly_name: "Main Light"
       command_on: 'sgY0AA0jDSMkDAwjDCMkDCQMJAwNIw0jDSINAAFiDSINIyQMJAwkDA0jDSIkDCQMJAwkDA0jDSMAAAAA'
       command_off: 'sgY0AA0jDSMkDAwjDCMkDCQMJAwNIw0jDSINAAFiDSINIyQMJAwkDA0jDSIkDCQMJAwkDA0jDSMAAAAA'

i’m obviously missing something very simple… so simple that it’s totally escaping me.

help?

Your switch code has to be divisible by 16 (I think…). So sometimes you need to add some padding at the end. If you look at your other two switches they have == signs at the end to pad them properly.

I’m not saying that’s the issue but it might be.

Try checking the home-assistant.log file for any errors first.

If there is nothing there then try adding a = to the end of your switch code. You may have to add more than one but add one at a time to see if it starts working. But you shouldn’t have to add more than three if I remember correctly.

See if that works and let us know.