If you successfully installed the X2 integration, and configured your hub in it, the remote entity should already be there. Looking at the docs for the integration, the entity is called something like remote.sofabaton_hub_aabbccddeeff. You should also see it on the integration’s device page.
If you click that entity to get to the more-info panel, you’ll notice that it has an on/off switch, but also a select/dropdown with your activities in it. What you can do is create an automation that triggers whenever there is an activity change in that remote.
This is a typical way we work this:
We go to Developer tools -> States, and then find the remote entity we need.
You’ll then see the “state” and “attributes” of the entity. Typically your attributes are something like this:
activity_list:
- Watch a movie
- Play Steamdeck
- Play Switch 2
- Play Xbox
- Play Playstation 5
current_activity: null
proxy_client_connected: false
friendly_name: Souterrain hub Remote
supported_features: 4
It also has a state, which is on, off or unavailable. So with that we now have some perspective on the information contained within the remote entity. With that knowledge we now make an automation.
So something like this:
description: "Turn on Office Lights when I start the Play Xbox activity"
mode: single
triggers:
- trigger: state
entity_id:
- remote.sofabaton_hub_aabbccddeeff
attribute: current_activity
to:
- Play Xbox
conditions: []
actions:
- action: light.turn_on
metadata: {}
data: {}
target:
entity_id: light.office
So this is an Automation that “triggers” when the “current_activity” attribute on the “sofabaton_hub_aabbccddeeff” entity changes to “Play Xbox”. When the Automation triggers, i can have it run arbitrary HA things. In the example above i’m turning on my office lights. You would do your Lutron thing here.
In my trigger, if I just remove the “to” property (Play Xbox) from the script, the Automation will now trigger on all activity changes, not just the Play Xbox one. But then I would probably need something like this:
description: "Turn on Office Lights whenever I start an Activity"
mode: single
triggers:
- trigger: state
entity_id:
- remote.sofabaton_hub_aabbccddeeff
attribute: current_activity
from:
- null
conditions: []
actions:
- action: light.turn_on
metadata: {}
data: {}
target:
entity_id: light.office
It will now trigger only if the previous state was off, not when we switch between activities. I’m using from: null here, because when I looked at Developer tools -> States to inspect the remote entity, I saw that this was the value given to current_activity while I had nothing running. So i’m telling my Automation to trigger if the current_activity attribute of my sofabaton_hub_aabbccddeeff remote entity changes from null to something else.