For those that have been following this thread: forum.wiimhome.com/threads/universal-remote-support.2315/
...I have something fairly simple that is working, but I could use a little help polishing it off...
As we are all aware, the WiiM has an HTTP API. Docs can be found here: https://www.wiimhome.com/pdf/HTTP API for WiiM Products.pdf
The SofaBaton X1S (this model only) has an undocumented feature that allows you to setup devices that have HTTP APIs as type "Wi-Fi". Instead of selecting one of the natively supported IP devices that are auto detected by the app on your network, choose the "Create a virtual device for IP control" option at the bottom. This YouTube video explains how to do this: youtube.com/watch?v=Ro4-mtaauQ8
The issue, however, is that the SofaBaton will only issue http requests. The WiiM only supports https requests on Port 443 (or at least my WiiM Amp Pro does). So what is needed is an http-to-https reverse proxy. This was a challenge as it's not a normal scenario. Almost everything documented on the Internet is for an https-to-http reverse proxy. I am not a developer or a network engineer. I'm just a techie, so I struggled with this step, trying all sorts of options -- nginx and node.js on a Raspberry Pi being where I spent the most time. However, none of these options seemed to even receive the command from SofaBaton. If I entered the exact same URL in Edge, the proxy worked and the WiiM responded "OK'. However, after hitting the WiiM a number of times testing through the browser, it just stopped behaving. It would still respond 'OK', but it wouldn't actually make the setting change. More on that later...
After pulling my hair out for days trying to get node.js working right on the RPi, I stumbled upon the reverse proxy service built-in to my Asustor NAS. It's a little GUI based service that seems to be based on nginx. Got that setup, and voila, the WiiM is now responding 'OK' from SofaBaton. And after a hard reset, the WiiM is also changing the settings properly...for now...
This is what the device and its corresponding commands look like in the SofaBaton app:
The red portion of the command is the IP and Port # that my Asustor NAS reverse proxy is listening on. The blue underlined portion is the WiiM API command. The green underlined portion is the WiiM setting (value).
These three commands are working. They allow me to switch between two inputs: 1) TV (value = HDMI); and 2) Roon (value = wifi). Please note that the API URLs are case sensitive, including the value. What I'm tackling right now are commands that allow me to switch outputs. The Speaker Output command does change the setting to Speakers. However, I can't figure out the command to change to Bluetooth. The API documentation is either wrong or incomplete:
The example only reveals the command for using the "hardware" values and not the "source" values. Anyone know how this one works?
This is the reverse proxy running on my NAS:
It's listening for http calls on Port 8080 on all of its network interfaces (incl. 192.168.1.53) and is forwarding these as https requests to Port 443 on 192.168.1.161, which is my WiiM Amp Pro. I've created a DHCP reservation for the WiiM so its IP address will never change. This is why my SofaBaton command above include ":8080" -- the http calls to the NAS happen over Port 8080 instead of the default Port 80. My NAS won't let me use Port 80 as it's reserved.
The other issue is that I am having is the one mentioned earlier. After a bit, WiiM seems to stop reacting to the API calls. It does respond 'OK', but stops changing the settings. A reboot from the app doesn't help. Only a hard reset does. Perhaps this is instability in the API?
I will likely tackle volume up/down and mute next, although they're not that important to me as the WiiM is connected to my TV via HDMI/ARC, so the TV commands on my SofaBaton also control the WiiM.
I hope others out there benefit from this and maybe someone is able to help with my two remaining issues.
Cheers
...I have something fairly simple that is working, but I could use a little help polishing it off...
As we are all aware, the WiiM has an HTTP API. Docs can be found here: https://www.wiimhome.com/pdf/HTTP API for WiiM Products.pdf
The SofaBaton X1S (this model only) has an undocumented feature that allows you to setup devices that have HTTP APIs as type "Wi-Fi". Instead of selecting one of the natively supported IP devices that are auto detected by the app on your network, choose the "Create a virtual device for IP control" option at the bottom. This YouTube video explains how to do this: youtube.com/watch?v=Ro4-mtaauQ8
The issue, however, is that the SofaBaton will only issue http requests. The WiiM only supports https requests on Port 443 (or at least my WiiM Amp Pro does). So what is needed is an http-to-https reverse proxy. This was a challenge as it's not a normal scenario. Almost everything documented on the Internet is for an https-to-http reverse proxy. I am not a developer or a network engineer. I'm just a techie, so I struggled with this step, trying all sorts of options -- nginx and node.js on a Raspberry Pi being where I spent the most time. However, none of these options seemed to even receive the command from SofaBaton. If I entered the exact same URL in Edge, the proxy worked and the WiiM responded "OK'. However, after hitting the WiiM a number of times testing through the browser, it just stopped behaving. It would still respond 'OK', but it wouldn't actually make the setting change. More on that later...
After pulling my hair out for days trying to get node.js working right on the RPi, I stumbled upon the reverse proxy service built-in to my Asustor NAS. It's a little GUI based service that seems to be based on nginx. Got that setup, and voila, the WiiM is now responding 'OK' from SofaBaton. And after a hard reset, the WiiM is also changing the settings properly...for now...
This is what the device and its corresponding commands look like in the SofaBaton app:
The red portion of the command is the IP and Port # that my Asustor NAS reverse proxy is listening on. The blue underlined portion is the WiiM API command. The green underlined portion is the WiiM setting (value).
These three commands are working. They allow me to switch between two inputs: 1) TV (value = HDMI); and 2) Roon (value = wifi). Please note that the API URLs are case sensitive, including the value. What I'm tackling right now are commands that allow me to switch outputs. The Speaker Output command does change the setting to Speakers. However, I can't figure out the command to change to Bluetooth. The API documentation is either wrong or incomplete:
The example only reveals the command for using the "hardware" values and not the "source" values. Anyone know how this one works?
This is the reverse proxy running on my NAS:
It's listening for http calls on Port 8080 on all of its network interfaces (incl. 192.168.1.53) and is forwarding these as https requests to Port 443 on 192.168.1.161, which is my WiiM Amp Pro. I've created a DHCP reservation for the WiiM so its IP address will never change. This is why my SofaBaton command above include ":8080" -- the http calls to the NAS happen over Port 8080 instead of the default Port 80. My NAS won't let me use Port 80 as it's reserved.
The other issue is that I am having is the one mentioned earlier. After a bit, WiiM seems to stop reacting to the API calls. It does respond 'OK', but stops changing the settings. A reboot from the app doesn't help. Only a hard reset does. Perhaps this is instability in the API?
I will likely tackle volume up/down and mute next, although they're not that important to me as the WiiM is connected to my TV via HDMI/ARC, so the TV commands on my SofaBaton also control the WiiM.
I hope others out there benefit from this and maybe someone is able to help with my two remaining issues.
Cheers
Last edited: