Toggle button with IR controlled devices?

I’m new to HA and have managed to get most of my devices configured in the system and some basic cards functioning…Now, my goal with this post is to figure out how to build a button on a card that toggles between On and Off with a group of devices where I can’t track state.

There are 3 devices that I’d like to control as a group: TV, Xbox and Stereo.
I am controlling both my SamsungTV and Xbox through an iTach IR blaster, the stereo can be IP controlled directly. I can track state of the stereo but not TV or Xbox (that I’m aware of).

I’ve already created scripts for TV on/off and Xbox on/off using remote.send_command and they work fine. I’ve also created a script that turns on all three devices and another that turns them all off. So if I’m on the right path, from here I’d like to make a button that can toggle between all on and all off and that state is reflected in the button ui. (button changes color or words or image, whatever)

Seems to me I need to set the state of something for this group to ‘on’ for the button ui to key off of and vice versa for off.

I’ve researched a lot but can’t seem to pull all the pieces together cohesively. Thanks for your help!

I think what you’re looking for is an input boolean.

It shows up as a button in your interface and is grey when off and blue when on. You can then use the State of the boolean to trigger automations that perform all the actions you want.

An example of one I’m using is:

input_boolean:
  phone_charging:
    name: OnePlus 6T charging
    initial: off
    icon: mdi:cellphone

The automation trigger then looks for State of input_boolean.phone_charging to change from Off to On and then peforms all the required actions.
In your case you would need two automations; Off to On and On to Off.

Hope this helps.

You are absolutely correct, thank you! Input Booleans and Node-Red for the win!