I want to include a sequence of IR packets (even better with customized interval) in one single command.
For example, I am trying to assign a switch to change the input source from TV to HDMI-2 on my TV, which need to press four-button sequence in the original IR remote say 'Input Source"+"“Down”+“Down”+“OK”.
I’ve obtained the codes for all these buttons already. May I have your help and advice if this can be done and how is the format on the configuration.yaml file?
I doubt this is the best way but this is how I did it. I have a dumb TV. So to make sure my tv turn off is working every time I have it turn the tv off then wait 20 seconds and then press my sleep button twice just in case the tv was already off. This makes my tv turn off in 5 minutes with a sleep timer. A little crude but it works. This probably isnt that best way just the way I currently have it.
It’s good to know that we can define delays within the sequence which means sending multiple IR packet in one single command is achievable.
But I found that I don’t quite understand the system after reading your code. Previously I assumed the system will keep the last switch state (On or Off) after executing the command_on or command_off, but it looks like it is not the case.
Probably I used a wrong example in my original question. In fact, I hope that the system would still keep the switch state, after executing a sequence of IR command. That means I need the switch will change from OFF to ON state by sending 3 to 4 numbers of IR codes to an appliance under the command_on.
Unfortunately the ir blasts won’t track last state, which is why on a lot of commands like like Power or Mute I just created a scene button instead of having a switch that may be on the wrong state. How benjimatt did it is your best option, although I’d test the script with or without the delay between switches, as some TV’s don’t need that pause between and on longer scripts multiple second delays can feel like forever.
One other thought is that if you have multiple states on a device and don’t want to take up too much space on your page, an input select to launch different scripts also works pretty well and would to some degree keep your state (HDMI-2)
I understand that the IR Blaster won’t keep or feedback any state. I just thought Home Assistant will keep it as it is an emulation of a switch, even thought we have to accept that the state can be wrong once the user use the original IR remote or physical button on the appliance.
That assumption is because I have experience on setting up homebridge for Homekit, which can keep the state and have the option to have the system to set the state back to off every time the command is executed (which is useful when simulate the volume and channel button, while keeping the on/off state for the power key
Now I just changed the platform to home assistant + google home to replace the homekit, so facing the problem. If this is what HA is doing, that means there seems no solution…
I’m very sorry that I didn’t realize that the original question has been discussed in another post on the topic of change channels on TV. So I modified the subject a little bit by adding the second part of my question which is about keeping the on/off state for a power switch.
I honestly think there is a solution for you. I havent done it just yet but solely because I literally just purchased a new TV. You need a smart switch possibly zwave that shows energy usage. Then you can set some of your scripts based on the state of how much energy is being used.
This way you can turn a dumb tv to a smart one. So In theory you could keep the state by saying something like "if energy used is greater than X amount of watts to assume the state of the tv is on. If it is less than Y amount of watts assume the TV is off.
There are a few of these smart switches out there with various price ranges
In fact, I have another use case for a fan which needs multiple codes to turn it off. I just completed the HA setup and found that it does keep the on/off status for a switch platform. So the only problem is how to send multiple code for a command_off under a switch.
However, I’m encountering another big problem now which makes my whole idea not doable. I plan to use the Emulated Hue module to work with Google home, but there is problem recently in Google Home app that it cannot add the hue Hub in a local network anymore (need to go to the Philip Hue website now). So even I can solve the multiple code issue now I can’t use Google Home to perform the control…
you just need to search, i just added a google home again a few days ago any havent had any issues. i think you ned to make emulated hue point to port 80.
Yes, I did spend some efforts to use port 80 and finally I completed the configuration and it should be OK as I have verified it with the http://:80/description.xml & http://:80/api/pi/lights.
Did you add the hue in your system before? People are saying that it is just changed in May and we can’t add new hue with the latest Home app anymore. Or you added it by the Google Home Speaker directly? I just wanted to try it on the Android Phone Home app before I go to buy the Google Home speaker.
This is the post I found with other people having the same problem.
I had google home at the very beginning but have completely redone my VM more than once after I got rid of it. A few new features came out such as shortcuts and it made me go back. This is why I buy from walmart 90 day no BS return policy lol.
Dont worry I have the latest home app and have removed and re-added hue multiple times.
It sounds great. Then I need to check again what’s wrong in my settings…
Regarding Emulated Hue I don’t see any error or warning message in the HA log, and as I said I got both description.xml and api/pi/lights working. So I can’t figure out how to find out the root cause.
I tried Google Assistant on my Android phone to add the Philps Hue device manually through the Home Control tab, but it directed me to the account.meethue.com website asking for sign-in. That’s why I thought the problem those people mentioned is valid…
Wait do you already have the Google Home?? Or are you trying to use google assistant? If you are trying to use google assistant to add emulated hue that isnt going to happen. You pretty much have to have the actual google home device to pick up the emulated hue. I tried lots of times before I got the home because I am cheap so thats the only reason I know lol.
Yeah if I didnt need the google home for google assistant to work I probably would have a good home lol. Id say I use my google assistant on my phone much more. I hold the home button and tell it what to do. I think I just hate say “ok google” or “hey google”
Easiest way to use Assistant on your phone is to use IFTTT, easy peasy to set up and costs nothing. If you want to shout at your lounge to make things happen, get an Alexa instead as emulated_hue and the like just works without issue, lot cheaper too