Fully local Sofabaton X1S Integration

Hello Sofabaton users!

I know it’s late to the party, but there is now a fully local X1S integration for Home Assistant.

No cloud dependencies whatsoever, automatic discovery of your hubs, support for multiple hubs, switch between activities, send any command to any device or activity. Honestly, it’s a pretty decent integration :slight_smile: I would appreciate you trying it out.

With HACS on board: Install X1S Integration

If you just want to look at the code and docs or install manually, go here.

Please feel free to reach out in case of any questions or comments.

Stay well.

10 Likes

Didn’t see a lot of people showing you love but I just installed this and had to tweak some network settings but I got this fully working with cross VLAN and mDNS.

Thank you so much for putting this together and am envious of your networking abilities to dissect the tcp traffic to get this fully functional. Huge props! Thank you for your work!

2 Likes

Was looking forward to get a x1s but there wasn’t a real integration in the past. So this project really got me interested in buying the remote again.
Keep up the great work!

The X2 has just been released so you might want to check that out.

Yeah, the X2 is on presale right now, but its pretty expensive. So the x1s seems like a great alternative for the X2 with this integration.

I also have two questions here.

  1. Can you actually start buttons or automations from the remote, that I have configured in home assistant? For example: I have made buttons on my dashboard that work like marcos: starting the tv then starting my hue sync box and finally starting the apple tv. Can you execute this with the remote?

  2. And the other way around. Is it possible to execute remote IR devices from home assistant? For Example: The remote and the hub is in my living room and I have a blu-ray player, that only can be started with the IR. Can I actually start this from the home assistant dashboard with the integration?

Hello respecreload,

1st question.
So if I understand your question correctly, you’re asking if you can trigger something in Home Assistant with the X1S.
The answer is that you can. This is not so much a feature of this Integration, but it’s a feature of the X1S.

In the Sofabaton app, when you add a device, and then select Wifi device, at the bottom of that screen is a link called Create a virtual device for IP control.
If you click that, the app will let you make a button that can call any URL using a variety of different methods.

So then all you need now is URLs to call in Home Assistant that do what you want them to do. Home Assistant has this built in. Using webhooks is the quickest way to get there: Automation Trigger - Home Assistant
There are good examples on this forum too.

Perhaps useful for you to know:

  • Many people have been using an integration for HA called Virtual Roku. The integration emulates a Roku device. Sofabaton X1S has built in support for the Roku, and will recognize the virtual Roku machine as the real thing. This is another way to get a physical button press to trigger something in HA.
  • In the X2 this is solved in a different way. The X2 hub lets you create virtual devices that bridge into Home Automation platforms using MQTT. Sofabaton themselves have a Home Assistant integration for the X2 in HACS right now.

2nd question.
YES! With this integration you can have the hub perform any command that the hub knows about, directly from Home Assistant. It provides 2 main ways of leveraging this capability. The integration creates an entity for each physical button your remote has. Those buttons then change state depending on the activity you have enabled, they function exactly like you would expect on the physical remote. So these are easy to add to your UI, or you can use them in automations with the button.press action.
There is also an entity that implements HA’s remote platform. With this you can send any command the hub knows about to any activity or device.

1 Like

Thanks for the detailed answers here!

So I just installed the integration via Option 1 for my X1S. My HA and hub are on the same network/VLAN. It adds the hub and entities, but all are unavailable. Why is this? Do I need to expose ports on edge firewall?

Hello @mclovinf50. There’s a sensor called sensor.<your_hubs_name>_hub_connected. What does that sensor say?
Most entities are unavailable if the hub is not connected to the integration.
Then when you are connected to the integration, button entities will remain unavailable until you have activated an Activity.

If the hub_connected sensor says “not connected”, then this is a networking issue, you can find detailed info on what the requirements are here.

For me to support you better please use the “Download diagnostics” support that the integration has. More info is here.

Finally, it’s easier for me to support you in github’s issue tracker, the link to which is available from the Integration’s page in Home Assistant.

But either way is fine, we’ll get it working.

Will the X2 work with your integration?

It doesn’t @def1149. But Sofabaton have their own integration for it here. It’s a very complete one at that.

Hello m3ta,
I just got the sofabaton x2 remote ( replaced Harmony) . I’m pretty fresh with home assistant and would really appreciate if you or someone here help me set up the remote in HA so I could run the activities (tv,dvd,avr ) and Lutron caseta lights with this remote. Thank you all a lot.

Have you read the step-by-step instructions on the Github page linked above? They would be a good starting point and then come back with questions if it doesn’t work.

I don’t have an X2 myself yet @johnny2, so I can’t help you get all the way there, i think. If you’re new to Home Assistant I definitely understand things looking a bit daunting. You’re probably not using MQTT yet in your setup either? How fresh is fresh, do you have HACS? How are you running Home Assistant, can you install addons (does Settings → Add-ons exist in your Home Assistant)?

Thank you all for your great input and willingness to help me with this.
So, fresh is two weeks,
I do have MQTT and HACS installed but still not understanding how to merry lutron activity and sofabaton x2 activities together. They both are set up in my HA but lutron was set up in HA and sofabaton in its own app. I know for most if not all this may be a simple task but for construction industry worker like myself its the very opposite lol. I thank you in advance for any tips and guidance.

Ok, so if i’m understanding you correctly, you have Lutron connected to HA and that is working. Now you need to connect the X2 hub to HA as well, and then you want to do a thing, with HA in the middle, where you press a button on the X2 remote and a Lutron thing happens, or are you looking for the other way around: you activate a Lutron scene and that then triggers something on the X2 hub.

If you want to trigger something on the X2 hub, you use the remote entity the X2 integration adds to HA. The remote platform is a way for Home Assistant to standardize on how users can control exactly these type of devices.
Typically you use the remote like this:

action: remote.send_command
target:
  entity_id: remote.<entity_id_of_the_integrations_remote>
data:
  command: 5  #<- This is the command you're triggering on the hub
  device: 3 #<- This is the device you're triggering the command for

In HA we can call Actions, the above is an example of that.
These Actions we can use in Automations, Scripts and many UI cards will also let you call them. If your intent is that on an Activity change on Lutron, you trigger a command on the X2 hub, you would do something like this:

You would create an Automation that Triggers on the change you’re looking for in Lutron. Then whenever that Automation runs, you perform the Action for the integration’s remote entity.

If you’re looking to do it the other way around; X2 triggers something in Lutron, then (and not having seen this myself yet) what I understand is that the app lets you make a virtual device, and this will update its keypresses over MQTT whenever a button is pressed for that virtual device. Looking at the code and docs of the X2 integration, it seems there is no implementation yet to easily let this trigger an automation.
What I would probably do, if the virtual device is actually a thing and it’s actually updating its keypresses over MQTT, is I would create one or more sensors that change state or maybe just attributes, based on what the X2 hub is communicating. These sensors, or their changing attributes, would then trigger automations.

Thank you m3ta for your reply.
So what I’m hoping to achieve here is being able to press activity ( watch a movie) button on my sofabaton remote and that would trigger lutron lights scene which I already created in HA.
If I understand correctly I need to create the remote entity first in HA in order to move forward correct?
I got to tell you I miss my Harmony remote already.
Anyway, let me work some more on this thing and if don’t succeed I’m will pay someone to do it for me, I spent already hrs on this thing with no luck, keep in mind I’m not an IT guy just a construction dude.

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.

Actually, if you want your Automation to trigger when you go from Off to On, you would probably not be looking at attributes at all, but just trigger on the state change of the remote entity itself.

description: Turn on Office Lights whenever I start an Activity
mode: single
triggers:
  - trigger: state
    entity_id:
      - remote.sofabaton_hub_aabbccddeeff
    from:
      - "off"
    to:
      - "on"
conditions: []
actions:
  - action: light.turn_on
    metadata: {}
    data: {}
    target:
      entity_id: light.office

Ok, it looks like you’re using YALM mode which is the next thing I need to understand just for this purpose.I think UI would be easer for me to understand. I found a you tube video how to add activities from HA to sofabaton but it’s not 100% what it should be. So far I got the activity going on the remote control the only thing is the activity works only in devices integration page on my remote, but when I tried to run it on remote’s activity page for some reason lights don’t work. I will try to follow your guidance the best I can. Thank you so much for your input and help.