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…
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.
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.
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.
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:
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…
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.