Integration: emulated_roku - Sofabaton compatibility

Looks good.
Do you have any router/firewall in-between wifi and your computer running the script?

P.s.: maybe your WiFi is blocking multicasts? (239.255.255.250) Which are needed.

I am having unified UAP-AC-LR and it worked with that.

I have udm se + unifi AP’s
where should I look for this?

Look for these options in the controller.

“Block LAN to WLAN Multicast and Broadcast Data” is disabled.
“Enable multicast enhancement (IGMPv3)” is enabled.

Which mobile phone do you using?
I am using an XIaomi 11T with HyperOS = Android 14.
Any VPN’s or similar tools disabled?

Ps.: you can also use wireshark to check if the sofabaton app/hub is sending the request on port udp 1900.

I think the “Enable multicast enhancement (IGMPv3)” did the trick I was able to add it and change the ip to Home Assistant.

I can confirm this works with app version 3.3.6 and with the SX1 hub (which is a different version of the X1 hub, why the old app trick don’t work anymore)

Thanks for your help

You’re welcome and nice that it finally worked for you.

P.s.: I also want to upgrade my living room from the X1 to the X1S (when it’s finally available on Amazon DE :sweat_smile: sadly currently it’s not).

P.s.P.s: change the apps in init.py to your needs (like scenes,…)

I had the new for free because of the issue with the wheel on the X1. The customer service is really good.
If you are happy with the X1, I don’t think you will win something, worth the money ,with the change.
Can you explain a bit more in detail the apps?
To understand better, if I need it :sweat_smile:

Yeah, want to use the X1 in the bed room and a new X1S in the living room :sweat_smile:

In the init.py there is an array named APPS_TEMPLATE.
When you edit that (in my case I have ~30 +) defined. Like “Scene Bright Living Room”, …
Every app/key you define there, will show up in the Sofabaton app as a key and can be assigned as usual.
In other words, you can define as much keys as you need. Only drawback is, that you have to re-add the device again, when you need more app/key entries and add it again to the activity’s.

Be sure to check the array syntax before running the emulator.

I can’t see a use case for this.
how you use this? maybe if I have some examples I can understand better :sweat_smile:

My use case of the whole sofabaton → HA remote is just this :slight_smile:
I am defining apps like:

  • Scene Bright Living Room
  • Scene Dim Living Room
  • …
  • Trigger Automation XY (ex.: blinds up/down)
  • …

Than on the remote keys page or activities i am adding these to quickly access these and controll the complete room :slight_smile:

What’s your use case for the sofabaton + emulated_roku?

I add one device Home Assistant (roku emulate)

Then in my activities I add long press keys to the emulated roku buttons (app1, app2, etc…)

In Node red I check the event of each button and create flows.

App1 is to close blinds near TV, app2 turn of lights, etc…

If I understand, adding different apps will add differents roku emulated devices?

Ok, that’s exactly what i am doing but…
You have not changed app1, app2, etc… in init.rb → hence in the sofabaton app the keys are named app1, app2, …

When you edit init.rb, you can name it like you would, and also (most important) add more than 10x “app” names :slight_smile:

Wow, that’s is really a good use case :sweat_smile:
Can I still change this?
Or should I delete the device and add a new one?
Thanks

Sadly, changing/adding apps after adding the device to the sofabaton hub is currently not possible.
You should take note of everything you want to archive, change it in init.rb, delete and re-add the device again.

Don’t forget to re-add the device/keys (Apps) to your activitys afterwards.

Thanks for your help.
I will try to do this :wink:

1 Like

Just got a new X1S as my harmony elite finally broke :frowning:

Setting up emulated Roku worked first time, and I can use the app_id’s to launch scenes and control covers. Pretty cool and much easier than I expected.

Where is this init.rb file you guys are talking about? It’s that accessible if using HA emulated Roku integration? Or do I need to use the python library?

Has anyone had a crack at using binary sensors to track the current state of the sofabaton activity? With the API turned on you could feed the activity starts and stops back to emulated Roku, and then use these to launch and stop activities so HA is always cognisant of the sofabaton state. Seems messy though

Edit: it’s actually much easier than that to track current state.

  1. Create toggle sensors for each activity
  2. Use event monitoring to listen to Roku remote commands (I am using last few apps)
  3. Add emulated Roku device to all activities, selecting no power or input changes
  4. Add each command to the start up and shut down sequences (it’s a toggle so only need one per activity).

There is always a chance it gets out of sync so potentially need to add macros etc to be able to fix this when broken.

I wanted state monitoring to replicate the way I used my harmony remote, but now I have it I am not sure I need it… Next I’ll try make a conditional card on living room dashboard to make us if it.

The init.py is in the emulated_roku folder from the github repo: GitHub - martonperei/emulated_roku

When you clone/download the project you can edit the file to add more than 10x “apps” keys and also give them names like “Scene bright living room”, …
See discussion from here on: Integration: emulated_roku - Sofabaton compatibility - #27 by pOpY

After that run “python3 example.py” and add the device to the sofabaton app.
When you done this, the app is reading the defined virtuall “app” keys and adding them to the roku device in the sofabaton app.
Then you have to change the IP address of the device in app to HA and add emulated roku device in HA.

Ps.: i also don’t need activity tracking for now. I am just using virtual “apps” for triggering scenes/automations. That’s enougth for me.

I understand some of that, but on HAOS I didn’t pull a repo. Emulated Roku is one of the built in integrations, and I can’t find anything anywhere on my filesystem relating to it using FileBrowser

Got you.
You have Todo this on another machine/PC.
Afterwards, change the IP in the Sofabaton app to the one from your HA installation.

Ok great I think I understand. Have just had a go and I can see the new emulated roku device on my sofabaton app after starting example.py, but after adding it the app shortcuts are not shown at all. Does this look correct?

APPS_TEMPLATE = """<apps>
    <app id="1" version="1.0.0">Vacuum Kitchen</app>
    <app id="2" version="1.0.0">Vacuum Living Room</app>
    <app id="3" version="1.0.0">Vacuum Living Areas</app>
    <app id="4" version="1.0.0">Vacuum Bin Area</app>
    <app id="5" version="1.0.0">Vacuum Bedrooms</app>
    <app id="6" version="1.0.0">Emulated App 6</app>
    <app id="7" version="1.0.0">Emulated App 7</app>
    <app id="8" version="1.0.0">Emulated App 8</app>
    <app id="9" version="1.0.0">Emulated App 9</app>
    <app id="10" version="1.0.0">Emulated App 10</app>
</apps>

This is what shows up after I have edited init.py, no Emulated app keys on the remote. Is that expected? Are they there, and will work as expected just are not visible?

Edit: Obviously this can’t be correct as if I can’t see those buttons on the sofabaton, then how can I use them to initiate scenes/commands…

Hey there :wave:
I’ve got trouble connecting to my emulated instance either on Windows or MacOS or HAss.
I’ve tried the advertise.py but mostly example.py
I used pfSense to capture packets and I can confirm the presence if multicast packets from the machine running the emulator:
15:22:34.048549 IP 192.168.100.29.1900 > 239.255.255.250.1900: UDP, length 186
Also the web server is responsive with a correct XML output.
I’m using the Sofabaton X1S app version 3.4.1 on iOS. I don’t have an android device.
Any help is appreciated!