What is a Stategroup?

A Stategroup is a collection of buttons in which there is always one button that remains in the depressed or "on" state. The "on" button represents the current state of the Stategroup and is typically the last button clicked in the group. A Stategroup is useful for tracking the current state of a device, such as whether it's powered on or the last input it had selected.

Tracking capability is important mainly if you're creating macros to perform complex tasks. For example, you might want a button to make your Home Theater system ready to play a movie. In doing this it would be nice to power on any devices (the A/V receiver, DVD, and the TV) that may be off at the time. With a simple power toggle button it's not possible for the macro to reliably turn on the devices since it doesn't know their current state. If power is tracked for each device with a 2-button Stategroup then the macro simply clicks the "ON" button of the Stategroup. If the device is already on then nothing happens, otherwise the Stategroup shifts to the "ON" state and sends the command to turn on the device.

How do I add a Stategroup to my setup?

Just drag a Stategroup from the Button Kit to add it to your device. The Button Kit includes a choice of a vertically and horizontally oriented Stategroups that appear as follows:

        

The default configurations are 2-button Stategroup that could be used to track the power state of a device. To track more states just add more buttons. Right-click on the Stategroup border (not in a button) and select "Increase State Buttons" to add a button. As with other button groups you can modify the labels and other properties of the Stategroup and its buttons.

   You can add up to 8 buttons to a Stategroup.

How do I set up a Stategroup to control my device?

Stategroups have the most properties of any other object in IRCommand2, but only one of its unique properties is needed to make it work in most cases. If you have only a toggle or "next" command for the device on your remote, which is typical, then that command should be trained into the "Command - Shift to Next State" property of the Stategroup. For each single step shift in state the Stategroup will then send the command you have trained. For example, to track the power state of a device using a 2-button Stategroup, just train the power toggle command into the "Command - Shift to Next State" property of the Stategroup.

 

If the Stategroup has more than two buttons and you click a button that causes a jump in state then the Stategroup will send the "Shift to Next State" command as many times as needed to reach the new state. For example, in the Stategroup below, which is in the "0" state, you click "2" then the "Shift to Next State" command will be sent twice -- once for the shift to "1" and then again for the shift to "2". If you then click "0" again one more "Shift to Next State" command is sent out -- the state of a Stategroup always wraps around from the last state to the first state. If there are a large number of states, such as for an input selector, it's desirable to also train the "Command - Shift to Previous State" property of the Stategroup, though this is not required. Doing so simply helps to reduce the number of commands that may have to be sent to reach the newly selected state.

How do I keep a Stategroup in sync with my device?

The best way to ensure that a Stategroup reliably tracks the device state is to always command the device via the Stategroup. As long as the dongle is positioned to reliably deliver IR signals to the devices then the Stategroup should remain in sync.

If must also use a remote control to operate the device then you might be able to use the Tracker properties to help keep the Stategroup in sync. Using Tracker properties requires a dongle that supports Listen Mode and that is configured so that IRCommand2 can hear all commands that are issued by external remote controls. If your hardware can support those requirements then simply program the "Tracker - Shift to Next State" property with the same signal used in the "Command - Shift to Next State" property (and likewise for Previous if you use it). Whenever IRCommand2 hears the shift command issued by an external remote it will then shift the state of the Stategroup to keep it in sync WITHOUT issuing any commands. If the remote also has discrete buttons for setting on/off or input selection then train those signals into the "Tracker - Shift To This Button" property of the corresponding buttons in the Stategroup (see button properties, below).

Caveat: tracking cannot be 100% reliable due to noise and other factors. Even though IRCommand2 hears the signal it has no way of knowing whether the device also heard it. And it's also possible the device will hear the command but IRCommand2 will miss it. One way to improve tracking reliability is to use an infrared distribution system that feeds a roughly equivalent strength signal to all devices as well as to the IRCommand2 dongle.

Tip: if your Stategroup is out of sync with the device you can manually "track" it to the correct state. Just hold the Ctrl-Shift keys and click on the correct state button. The state will shift without sending out any commands. This manual tracking can be done without entering Learn Mode.

What else can I do with Stategroups?

Stategroups enable more sophisticated control through the use of "Activators", which basically allow the equivalent of conditional programming statements in macros. All devices, groups, and buttons in IRCommand2 support the definition of Activators (as of v3.91). The Activators property is simply a list state buttons (i.e., buttons in Stategroups). If. for example, Activators are defined for a button then all of the specified state buttons in the Activators list must be in the ON state for the button to be active. An inactive button will ignore all button clicks regardless of whether the request comes from the user, a macro, or the COM interface. An inactive device or group disables all of the buttons and groups that it contains.

Device activators (new in v3.91) enable the creation of device "overlays" that can significantly alter the response of IRCommand2 depending upon the state of your system. For example, it would be possible to create an intelligent remote that maps buttons to the correct device "overlay" for controlling the DVD player when your Home Theater system is set to show a movie, but the same buttons control the DVR instead when the system is set to watch TV. There are many other possibilities depending on what states are tracked.