Everything works beautifully. However, when I turn off the office_stuff switch, and input.boolean for tv_power_off is indicating off, it still fires that scene. My logic would say that if the template is turning off, but the subordinate switch is already off, it would skip over it?
Is there a reasonably easy fix in the above? I’d like to avoid doing an automation if possible.
Yep, I sure did, and it worked wonderfully. However, the IR blaster has since been repurposed to do bigger/better things (controlling a space heater–but follows the EXACT same logic as if were toggling a TV). Since I now have Google TV devices on my TV’s, their on/off is controlled by HDMI CEC, for which I have made template switches, too.
Just to save us both some extra work, which switch do you want me to show? Power as a function of the IR Blaster or as a function of GoogleTV (media_player.turn_on / media_player.turn_off)?
Basically I have a Broadlink IR Blaster. I created scripts which calls a service to turn a TV on and off. Scripts work but I have to tell Echo to “turn on TV_Off” - ugly. You used a scene - not sure how you did that! When I go to create a scene I can see devices (which include broadlink but that the extent of it) and entities which includes my scripts.
So, here’s my setup for the space heater (which is on/off with my Tuya IR Blaster). My scene is based on the Tuya App (and Tuya Cloud integration). In the app with my phone, I created a scene, and the Tuya HA integration saw it and automatically created a scene entity to launch it. Looks like this for some context. But, in your case, I don’t see any reason why you can’t replace scene.turn_on (and the subsequent scene entity) with script.turn_on and your script; should work the same.
I first built an input boolean helper. In my case: input_boolean.ir_heater_onoff.
Take note that it’s running the same scene to turn the switch on and off (since it’s just effectively pressing the power button the remote). You’ll do the same with your script.
ONE NOTE: It’s possible they can get out of sync (someone turns off the device manually, the IR is blocked, etc.), so HA could have the switch off, but the device on. Either go in and manually toggle the input boolean helper, or just turn off or on the device manually.