nicoduj / homebridge-harmony

Harmony websocket plugin for homebridge
The Unlicense
214 stars 23 forks source link

[BUG] Cannot add TV accessory due to setup code already being used by another plugin #436

Closed DonutEspresso closed 8 months ago

DonutEspresso commented 9 months ago

Describe the bug I cannot add the Harmony TV accessory to Homekit, as the same setup code is being used by another TV service created by a different homebridge plugin - specifically, the homebridge-webos-tv plugin. These are both currently setup as child bridges:

[1/1/2024, 9:43:52 PM] Please add [harmony-hub-TV 0E00] manually in Home app. Setup Code: 031-45-154 [1/1/2024, 9:43:51 PM] Please add [LG CX 77 B71B] manually in Home app. Setup Code: 031-45-154

To Reproduce Setup a TV accessory with a different plugin with the same setup code.

Expected behavior A unique HK setup code, or a way to regenerate a different code.

Screenshots N/A

IOS (please complete the following information): N/A

Logs N/A

Config N/A

Additional context I'm not sure if there any rules around the setup codes being generated - are codes supposed to be UUIDs, or are they more deterministic in that the placement of numbers in the code indicate something to HomeKit?

nicoduj commented 9 months ago

Hi, did you try to use the pin option in your config on the child bridge ?

DonutEspresso commented 9 months ago

🤦‍♂️ TIL about the pin option - thanks for the tip. I gave this a whirl, and I do see the new pin reflected in the logs.

However, in the Home app UI, after entering the new code, it just goes back to the "Select An Accessory to Add" screen. This is the same screen that comes up after tapping + > Add Accessory > More options. Assuming something discovery related here, since the accessories show up in the Homebridge UI just fine. Took a brief look at startup logs and saw this:

[1/2/2024, 4:35:05 PM] Publishing external accessory (name: harmony-hub-TV, publishInfo: { username: '', pincode: '*-*-', category: 31, port: undefined, bind: undefined, mdns: undefined, addIdentifyingMaterial: true, advertiser: 'avahi' }).

Are the undefined values indicative of anything? Any ideas on where I can poke around next?

DonutEspresso commented 9 months ago

I removed the old bridge from Homekit, uninstalled the plugin in Homebridge, and started from scratch with a new PIN. But the TV Accessory is still MIA. Any ideas on where to go from here?

In the logs I see the activities discovered, and the corresponding switches are created in Homekit since I have the switchAccessories set to true:

[1/3/2024, 7:20:33 PM] [harmony-hub] (harmony-hub)WARNING - No main Activity that match config file found, default to first one [1/3/2024, 7:20:33 PM] [harmony-hub] (harmony-hub)INFO - Configuring Main Activity Watch Apple TV [1/3/2024, 7:20:33 PM] [harmony-hub] (harmony-hub)INFO - Creating TV Speaker Service [1/3/2024, 7:20:33 PM] [harmony-hub] (harmony-hub)INFO - Discovered Activity : Watch Apple TV [1/3/2024, 7:20:33 PM] [harmony-hub] (harmony-hub)INFO - Discovered Activity : Play PC [1/3/2024, 7:20:33 PM] [harmony-hub] (harmony-hub)INFO - Discovered Activity : Play Switch [1/3/2024, 7:20:33 PM] [harmony-hub] (harmony-hub)INFO - Discovered Activity : Play PS4 [1/3/2024, 7:20:33 PM] [harmony-hub] (harmony-hub)INFO - Discovered Activity : PowerOff [1/3/2024, 7:20:33 PM] [harmony-hub] (harmony-hub)INFO - setupFoundAccessories - TV accessory added as external accessory [1/3/2024, 7:20:37 PM] [harmony-hub] INFO - stopping hub discovery, hubs found : undefined

Configuration:

{
    "name": "harmony-hub",
    "hubIP": "192.168.20.16",
    "hubName": "harmony-hub",
    "DELAY_BEFORE_RETRY_AFTER_NETWORK_LOSS": 60000,
    "HUB_CONNECT_TIMEOUT": 10000,
    "HUB_SEND_TIMEOUT": 30000,
    "TVAccessory": true,
    "sortInput": 2,
    "switchAccessories": true,
    "showTurnOffActivity": "true",
    "otherPlatforms": [
        {
            "TVAccessory": false,
            "sortInput": 0
        }
    ],
    "_bridge": {
        "username": "0E:70:7A:E8:6D:9E",
        "pin": "427-66-694",
        "port": 59912
    },
    "platform": "HarmonyHubWebSocket"
}
nicoduj commented 8 months ago

Did you try to add it manually (it is not added with the bridge itself, since it is an external accessory)? You might have also to clear the homebridge cache / delete old accessory if it was previously added.

Please also remove "otherPlatforms": [ { "TVAccessory": false, "sortInput": 0 } ],

since your conf since you have only one hub.

DonutEspresso commented 8 months ago

PEBKAC. External accessories are cached under a different setting than the standard cached accessories list. Clearing an old version of it allowed it to come back. Appreciate your patience and guidance in the matter. 🙌