self hosted.
I’ve e-mailed the developer of the app, but haven’t got a reply.
Update:
I’ve checked the code and I think I’ve found it.
Root cause:
In lib/helper/LocalIp.ts:11-14:
ip = await homey.cloud.getLocalAddress();
// Homey adds a port, so remove that
// Old implement was always removing the last three characters, so keep using that for now
ip = ip.slice(0, -3);
The code assumes getLocalAddress() returns an IP with a 2-digit port (like :80), so it removes the last 3 characters. However, Homey self-hosted uses port 4860 (and 4859), so getLocalAddress() returns 192.168.2.170:4860. Removing 3 characters leaves 192.168.2.170:4 instead of 192.168.2.170.
This corrupted IP is then used in:
- lib/util.js:4044 for Gen2+ websocket config: ws://${homey_ip}:6113/
- lib/util.js:4018 for Gen1 CoIoT config: coiot_peer=${homey_ip} (which should append :5683)
Additionally, the check in drivers/device.js:160 keeps re-corrupting manually fixed URLs. It checks if the current server URL contains homey_ip (the corrupted 192.168.2.170:4). Since a correct URL like ws://192.168.2.170:6113/ doesn’t contain :4, the code thinks the URL is wrong and “fixes” it back to the malformed version.
Suggested fix:
Replace the naive slice(0, -3) with proper port removal:
ip = await homey.cloud.getLocalAddress();
// Homey adds a port, so remove that
const lastColon = ip.lastIndexOf(‘:’);
if (lastColon !== -1) {
ip = ip.substring(0, lastColon);
}
This correctly handles any port length.
I will mail this info again to the developer, maybe he reads this forum.