grzegorz914 / homebridge-xbox-tv

Homebridge plugin for Microsoft Game Console, publish as independent external platform accessory.
MIT License
164 stars 15 forks source link

Sensors/Toggles aren't working, including Power State #180

Closed Makyfa closed 1 year ago

Makyfa commented 1 year ago

I've been trying to get this up and running all day today, and it's been driving me bonkers because it feels like I'm so close, but it just won't work completely.

After setting up the plugin in Homebridge, (and once I realized that I needed to add it individually as a device in HomeKit - that took me longer than I'd like to admit to realize), I've been able to get most of the functionality to work (auto populating lists of available Games/Apps, the ability to switch between them, and remote control in the Remotes app as well).

Unfortunately, I can't get any sensors or most toggles to work, chiefly Power states/commands. Strangely the "On" command -does- work, but the "Off" doesn't.

The issue persists on both wired and wireless connections.

Console has been set into the correct power mode, Remote Features has been enabled, as has Digital Assistants. The Authorization manager in Homebridge says "Console authorized and activated." when doing the check state.

From my Mac I'm able to ping the console (Xbox Series X), and that's listed below:

Mac Ping: 64 bytes from 192.168.0.34: icmp_seq=0 ttl=128 time=12.766 ms 64 bytes from 192.168.0.34: icmp_seq=1 ttl=128 time=8.890 ms 64 bytes from 192.168.0.34: icmp_seq=2 ttl=128 time=7.168 ms 64 bytes from 192.168.0.34: icmp_seq=3 ttl=128 time=7.987 ms 64 bytes from 192.168.0.34: icmp_seq=4 ttl=128 time=7.347 ms 64 bytes from 192.168.0.34: icmp_seq=5 ttl=128 time=5.575 ms 64 bytes from 192.168.0.34: icmp_seq=6 ttl=128 time=4.738 ms 64 bytes from 192.168.0.34: icmp_seq=7 ttl=128 time=11.817 ms

Synology Homebridge Report: [8/25/2023, 4:54:24 PM] [XboxTv] Device: 192.168.0.34 Living Room Xbox TV, debug: Ping console, state: Offline [8/25/2023, 4:54:31 PM] [XboxTv] Device: 192.168.0.34 Living Room Xbox TV, debug: send command, result: { "status": { "errorCode": "OK", "errorMessage": null }, "result": null, "uiText": null, "destination": { "id": "F4000CXXXXX", (ID masked) "name": "Living room Xbox", "locale": "en-US", "powerState": "On", "consoleType": "XboxSeriesX", "remoteManagementEnabled": "True", "consoleStreamingEnabled": "True", "wirelessWarning": "False", "outOfHomeWarning": "False", "osVersion": "10.0.25398.1755" }, "userInfo": null, "opId": "e096c9bc-0ae4-4227-9504-9972c5191de9" } [8/25/2023, 4:54:34 PM] [XboxTv] Device: 192.168.0.34 Living Room Xbox TV, debug: Ping console, state: Offline [8/25/2023, 4:54:44 PM] [XboxTv] Device: 192.168.0.34 Living Room Xbox TV, debug: Ping console, state: Offline

Any help or suggestions on what to try would be hugely helpful. I feel like I've tried everything today. Thanks!

grzegorz914 commented 1 year ago

Looks like the console is not available locally from your Synology Station, check network settings on the Synology Station, firewall, ports lock, etc Console need to be pingable from the station.

Makyfa commented 1 year ago

The more I'm looking into it, the more it seems like this may be a limitation of running Homebridge on Synology natively. I have all ports open, and no Firewall anywhere on my network, so theoretically nothing should be blocked. That's when I suspected that perhaps it was the Homebridge installation itself that was having issues.

I didn’t catch this earlier, due to the color coding in Terminal, but it’s the Homebridge "user" that can’t ping (meaning this plugin as well). I also don’t see how to change settings for that "user"/application (doesn’t show up in the user list, and it won’t let me make a user of that name either, due to a potential naming conflict).

homebridge@VanBentleyNAS:/volume1/homebridge $ ping 192.168.0.34 ping: socket: Operation not permitted

homebridge@VanBentleyNAS:/volume1/homebridge $ sudo ping 192.168.0.34 ERROR: sudo / root access is not allowed by the homebridge service account. See https://kb.synology.com/en-id/DSM/tutorial/How_to_login_to_DSM_with_root_permission_via_SSH_Telnet

homebridge@VanBentleyNAS:/volume1/homebridge $ ssh vanbentley@192.168.0.48 -p 5050 vanbentley@192.168.0.48's password:

Synology strongly advises you not to run commands as the root user, who has the highest privileges on the system. Doing so may cause major damages to the system. Please note that if you choose to proceed, all consequences are at your own risk.

vanbentley@VanBentleyNAS:~$ sudo ping 192.168.0.34 Password: PING 192.168.0.34 (192.168.0.34) 56(84) bytes of data.

I haven't had issues with any other Homebridge plugins reaching out to their respective devices, making this limitation unfortunately only affect the Xbox plugin.

Makyfa commented 1 year ago

Woohoo! I was finally able to solve this. If anybody else has any issues with pinging the console from a Synology setup, the solution was to log into the DiskStation via ssh and execute sudo setcap 'cap_net_raw+ep' "$(which ping)", and then restarting Homebridge.

Solution was discovered here: https://github.com/stfnhmplr/homebridge-synology/issues/86

grzegorz914 commented 1 year ago

Nice.