nicoduj / homebridge-harmony

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

Second TV Accessory not responding and cannot be added after upgrading to homebridge 1.0 #254

Closed mwkchan closed 4 years ago

mwkchan commented 4 years ago

Describe the bug Second Hub was not published after upgrading to homebridge 1.0

To Reproduce After upgraded to homebridge 1.0, the 2nd Hub was not responding. Tried deleting the 2nd TV accessory, clearcache, still fail to add back the 2nd Hub TV accessory.

Expected behavior No changes after upgrade, can add back 2nd TV accessory by code.

Logs [4/27/2020, 7:10:30 PM] Master Room Hub-TV is running on port 51725. [4/27/2020, 7:10:30 PM] Please add [Master Room Hub-TV] manually in Home app. Setup Code: 199-70-701 [4/27/2020, 7:10:30 PM] [Master Room Hub] (Living Room Hub)INFO - Adding Accessory : Living Room Hub-TV [4/27/2020, 7:10:30 PM] [Master Room Hub] (Living Room Hub)INFO - configuring Main TV Service [4/27/2020, 7:10:30 PM] [Master Room Hub] (Living Room Hub)INFO - Creating TV Service [4/27/2020, 7:10:30 PM] [Master Room Hub] (Living Room Hub)INFO - Creating Input Service - AppleTV [4/27/2020, 7:10:30 PM] [Master Room Hub] (Living Room Hub)INFO - Configuring Main Activity Live TV [4/27/2020, 7:10:30 PM] [Master Room Hub] (Living Room Hub)INFO - Creating TV Speaker Service [4/27/2020, 7:10:30 PM] [Master Room Hub] (Living Room Hub)INFO - Creating Input Service - Live TV [4/27/2020, 7:10:30 PM] [Master Room Hub] (Living Room Hub)INFO - Creating Input Service - Bluetooth Music [4/27/2020, 7:10:30 PM] [Master Room Hub] (Living Room Hub)INFO - Creating Input Service - Home Cinema [4/27/2020, 7:10:30 PM] [Master Room Hub] (Living Room Hub)INFO - setupFoundAccessories - TV accessory added as external accessory [4/27/2020, 7:10:30 PM] Living Room Hub-TV is running on port 51727. [4/27/2020, 7:10:30 PM] Please add [Living Room Hub-TV] manually in Home app. Setup Code: 199-70-701 Config { "name": "Master Room Hub", "hubIP": "192.168.1.245", "cleanCache": false, "publishAllTVAsExternalAccessory": true, "TVAccessory": true, "mainActivity": "Live TV", "playPauseBehavior": true, "remoteOverrideCommandsList": [ { "ActivityName": "Live TV", "CommandsList": [ { "CommandName": "ARROW_UP", "NewCommand": "LG 55UF8500;ChannelUp" }, { "CommandName": "ARROW_DOWN", "NewCommand": "LG 55UF8500;ChannelDown" }, { "CommandName": "PLAY", "NewCommand": "LG 55UF8500;3D" }, { "CommandName": "PAUSE", "NewCommand": "LG 55UF8500;3D" } ] }, { "ActivityName": "my TV Super", "CommandsList": [ { "CommandName": "INFORMATION", "NewCommand": "TVB STB;TV/VOD" }, { "CommandName": "ARROW_UP", "NewCommand": "TVB STB;DirectionUp" }, { "CommandName": "ARROW_DOWN", "NewCommand": "TVB STB;DirectionDown" }, { "CommandName": "ARROW_LEFT", "NewCommand": "TVB STB;DirectionLeft" }, { "CommandName": "ARROW_RIGHT", "NewCommand": "TVB STB;DirectionRight" }, { "CommandName": "SELECT", "NewCommand": "TVB STB;Select" }, { "CommandName": "PLAY", "NewCommand": "TVB STB;Red" }, { "CommandName": "PAUSE", "NewCommand": "TVB STB;Red" }, { "CommandName": "FAST_FORWARD", "NewCommand": "TVB STB;Blue" }, { "CommandName": "REWIND", "NewCommand": "TVB STB;Yellow" }, { "CommandName": "BACK", "NewCommand": "TVB STB;Back" } ] } ], "switchAccessories": true, "showTurnOffActivity": "inverted", "publishGeneralMuteSwitch": true, "devicesToPublishAsAccessoriesSwitch": [ "Vizio SB4051-D5|VolumeUp;VolumeUp", "Vizio SB4051-D5|VolumeDown;VolumeDown", "Climate Control|Cool;Cool|1500;Cool Swing", "Climate Control|Cool Plus;Cool+|750;Cool|750;Cool+|750;Cool Swing", "Climate Control|Cool Off;PowerOff|750;Cool-|750;PowerOff|750;Cool-", "Climate Control|Warm;Warm|1750;Warm Swing" ], "showCommandsAtStartup": false, "otherPlatforms": [ { "name": "Living Room Hub", "hubIP": "192.168.1.225", "TVAccessory": true, "mainActivity": "Live TV", "playPauseBehavior": true, "switchAccessories": false, "showTurnOffActivity": "false", "publishGeneralMuteSwitch": false, "showCommandsAtStartup": false } ], "platform": "HarmonyHubWebSocket" }, Additional context Add any other context about the problem here.

nicoduj commented 4 years ago

will check, some are reporting it working and beta test was ok .

donavanbecker commented 4 years ago

@mwkchan can you show the logs that show the plugin discovering the hubs?

mwkchan commented 4 years ago

@donavanbecker

Here you are:

[4/27/2020, 7:54:41 PM] [Master Room Hub] DidFinishLaunching [4/27/2020, 7:54:41 PM] [Master Room Hub] (Master Room Hub)INFO - Loading activities... [4/27/2020, 7:54:41 PM] [Master Room Hub] (Living Room Hub)INFO - Loading activities... [4/27/2020, 7:54:41 PM] Initializing platform accessory 'Study IR Learn'... [4/27/2020, 7:54:41 PM] Initializing platform accessory 'Study Room AC'... [4/27/2020, 7:54:41 PM] Initializing platform accessory 'EV Charger'... [4/27/2020, 7:54:41 PM] Initializing platform accessory 'Kitchen Cam'... [4/27/2020, 7:54:41 PM] Initializing platform accessory 'Garage Cam'... [4/27/2020, 7:54:41 PM] Initializing platform accessory 'Screen'... [4/27/2020, 7:54:41 PM] Initializing platform accessory 'Awning'... [4/27/2020, 7:54:41 PM] Initializing platform accessory 'Caravan AC'... [4/27/2020, 7:54:41 PM] Initializing platform accessory 'Car AC Off'... [4/27/2020, 7:54:41 PM] Initializing platform accessory 'Car AC Low'... [4/27/2020, 7:54:41 PM] Initializing platform accessory 'Car AC High'... [4/27/2020, 7:54:41 PM] Initializing platform accessory 'GAR Learn'... [4/27/2020, 7:54:41 PM] Initializing platform accessory 'Study Scan Frequency'... [4/27/2020, 7:54:43 PM] [Master Room Hub] (Living Room Hub)INFO - Adding Accessory : Living Room Hub-TV [4/27/2020, 7:54:43 PM] [Master Room Hub] (Living Room Hub)INFO - configuring Main TV Service [4/27/2020, 7:54:43 PM] [Master Room Hub] (Living Room Hub)INFO - Creating TV Service [4/27/2020, 7:54:43 PM] [Master Room Hub] (Living Room Hub)INFO - Creating Input Service - AppleTV [4/27/2020, 7:54:43 PM] [Master Room Hub] (Living Room Hub)INFO - Configuring Main Activity Live TV [4/27/2020, 7:54:43 PM] [Master Room Hub] (Living Room Hub)INFO - Creating TV Speaker Service [4/27/2020, 7:54:43 PM] [Master Room Hub] (Living Room Hub)INFO - Creating Input Service - Live TV [4/27/2020, 7:54:43 PM] [Master Room Hub] (Living Room Hub)INFO - Creating Input Service - Bluetooth Music [4/27/2020, 7:54:43 PM] [Master Room Hub] (Living Room Hub)INFO - Creating Input Service - Home Cinema [4/27/2020, 7:54:43 PM] [Master Room Hub] (Living Room Hub)INFO - setupFoundAccessories - TV accessory added as external accessory [4/27/2020, 7:54:43 PM] Living Room Hub-TV is running on port 61844. [4/27/2020, 7:54:43 PM] Please add [Living Room Hub-TV] manually in Home app. Setup Code: 199-70-701 [4/27/2020, 7:54:43 PM] [Master Room Hub] (Master Room Hub)INFO - Adding Accessory : Master Room Hub-TV [4/27/2020, 7:54:43 PM] [Master Room Hub] (Master Room Hub)INFO - configuring Main TV Service [4/27/2020, 7:54:43 PM] [Master Room Hub] (Master Room Hub)INFO - Creating TV Service [4/27/2020, 7:54:43 PM] [Master Room Hub] (Master Room Hub)INFO - Creating Input Service - my TV Super [4/27/2020, 7:54:43 PM] [Master Room Hub] (Master Room Hub)INFO - Creating Input Service - BBC [4/27/2020, 7:54:43 PM] [Master Room Hub] (Master Room Hub)INFO - Creating Input Service - Bluetooth Music [4/27/2020, 7:54:43 PM] [Master Room Hub] (Master Room Hub)INFO - Creating Input Service - Netflix [4/27/2020, 7:54:43 PM] [Master Room Hub] (Master Room Hub)INFO - Creating Input Service - Apple TV [4/27/2020, 7:54:43 PM] [Master Room Hub] (Master Room Hub)INFO - Configuring Main Activity Live TV [4/27/2020, 7:54:43 PM] [Master Room Hub] (Master Room Hub)INFO - Creating TV Speaker Service [4/27/2020, 7:54:43 PM] [Master Room Hub] (Master Room Hub)INFO - Creating Input Service - Live TV [4/27/2020, 7:54:43 PM] [Master Room Hub] (Master Room Hub)INFO - Discovered Activity : my TV Super [4/27/2020, 7:54:43 PM] [Master Room Hub] (Master Room Hub)INFO - Discovered Activity : PowerOff [4/27/2020, 7:54:43 PM] [Master Room Hub] (Master Room Hub)INFO - Discovered Activity : BBC [4/27/2020, 7:54:43 PM] [Master Room Hub] (Master Room Hub)INFO - Discovered Activity : Bluetooth Music [4/27/2020, 7:54:43 PM] [Master Room Hub] (Master Room Hub)INFO - Discovered Activity : Netflix [4/27/2020, 7:54:43 PM] [Master Room Hub] (Master Room Hub)INFO - Discovered Activity : Apple TV [4/27/2020, 7:54:43 PM] [Master Room Hub] (Master Room Hub)INFO - Discovered Activity : Live TV [4/27/2020, 7:54:43 PM] [Master Room Hub] (Master Room Hub)INFO - setupFoundAccessories - TV accessory added as external accessory [4/27/2020, 7:54:43 PM] [Master Room Hub] (Master Room Hub)INFO - Loading general mute Switch... [4/27/2020, 7:54:43 PM] [Master Room Hub] (Master Room Hub)INFO - Loading devices... [4/27/2020, 7:54:43 PM] [Master Room Hub] (Master Room Hub)INFO - Discovered Device : Vizio SB4051-D5 [4/27/2020, 7:54:43 PM] [Master Room Hub] (Master Room Hub)INFO - Discovered Device : Vizio SB4051-D5 [4/27/2020, 7:54:43 PM] [Master Room Hub] (Master Room Hub)INFO - Discovered Device : Climate Control [4/27/2020, 7:54:43 PM] [Master Room Hub] (Master Room Hub)INFO - Discovered Device : Climate Control [4/27/2020, 7:54:43 PM] [Master Room Hub] (Master Room Hub)INFO - Discovered Device : Climate Control [4/27/2020, 7:54:43 PM] [Master Room Hub] (Master Room Hub)INFO - Discovered Device : Climate Control [4/27/2020, 7:54:43 PM] Master Room Hub-TV is running on port 61845. [4/27/2020, 7:54:43 PM] Please add [Master Room Hub-TV] manually in Home app. Setup Code: 199-70-701

nicoduj commented 4 years ago

Are you unsing an other plugin that exposes external accessories ? I see in your config that you are publishing All as external, did you try not to ?

mwkchan commented 4 years ago

I used to have another plugin for my LG TV, but have removed that now.

And I fixed it by changing the name of the Living Room Hub to LivingRoom Hub. Seems somehow leftover information stayed somewhere in Homekit preventing it to add the 2nd hub back once it was removed.

donavanbecker commented 4 years ago

@mwkchan so it is fixed?

mwkchan commented 4 years ago

Practically yes, but it is still an issue because normal users would not know they need to change the name of the hub after upgrading

donavanbecker commented 4 years ago

@mwkchan can you explain how it is an issue? what is the name of the hub in the harmony app? and what is the name of the hub in Homebridge? before and after?

mwkchan commented 4 years ago

@donavanbecker

Changing name was just a technique I tried to fix it.

Let me describe again what happened:

  1. I upgraded Homebridge to 1.0, everything were working except my 2nd TV accessory created for my 2nd hub, which was named "Living Room Hub" showing "not responding";
  2. I cleared the cache of the plugin and restarted Homebridge, the 2nd TV accessory still showing "not responding";
  3. I removed the 2nd TV accessory, cleared cache, restarted Homebridge and tried to add back the 2nd TV accessory, but failed. Home app cannot discover the TV accessory.
  4. I tried to change the name of my 2nd hub from "Living Room Hub" to "LivingRoom Hub" in hope that it will create a new 2nd TV accessory for me to add back to Home app and it worked.

So, what I guessed is somehow the 2nd TV accessory was not working after the upgrade, I removed it and cannot add it back because somehow the Home app "remembers"/"thinks" that particular TV accessory is already in the system. So by changing the name and creating a new TV accessory, Home app was able to discover the "new" accessory.

nicoduj commented 4 years ago

Thanks for the update. External accessories are not in cache as far as I know, so cleaning cahce will not help. Changing the name must have generate a new accessory. what I don't understand is that one would have been retrieved and not the other one after update (since they were both as external if you did not change your config).

1.0 introduce new way to handle that, will be doing the move (they won't be external accessories anymore), but I have to test and it will not be backward compatible so I was waiting a bit to do so).

mwkchan commented 4 years ago

I can confirmed that both are external accessories and I had that config for a few months. It did surprise me when I found only one was not working as I was expecting either both were working or neither.

mikesalz commented 4 years ago

I am experiencing the same or a similar issue. For me, Homebridge will not even start when I upgrade to Version 1.0.1.

        {
            "platform": "HarmonyHubWebSocket",
            "name": "FamilyRoomHarmonyHub",
            "hubIP": "xxx.xxx.x.xxx",
            "mainActivity": "Watch Apple TV",
            "otherPlatforms": [
                {
                    "name": "LoftHarmonyHub",
                    "hubIP": "xxx.xxx.x.xxx",
                    "mainActivity": "Watch Loft Apple TV"
                },
                {
                    "name": "MasterBedroomHarmonyHub",
                    "hubIP": "xxx.xxx.x.xxx",
                    "mainActivity": "Watch Master Bedroom Apple TV",
                    "homeControlsToPublishAsAccessoriesSwitch": [
                        "hue-switch.harmony_master_bedroom_fan_switch",
                        "hue-switch.harmony_master_bedroom_fan_light_switch"
                    ]
                }
            ]
        },

image

nicoduj commented 4 years ago

@mikesalz is it possible for you to try after cleaning cached accessories (and even uninstall / reinstall plugin) ? ensure to have removed external accessories from home app also .

You can also try changing names like @mwkchan did

I am looking into this, but since I don't have multiple hubs it is a bit difficult :)

mikesalz commented 4 years ago

@nicoduj I removed the plugin references from cachedAccessories. There were in fact two references, which is probably what caused the problem. After a restart, it does seem to be working. The biggest problem now is that I lost my room assignments and automations, but I can deal with that. Thanks for your help!

nicoduj commented 4 years ago

yeah, deleting cached accessories will do that :( thanks for reporting

nicoduj commented 4 years ago

For the moment, I don't see any other way to solve than to clear cache / persist and uninstall / reinstall plugin (breaking all automation and so). It seems for some reason that this change had no effect before 1.0.0 of homebridge (I made it on purpose seeing the logs reported in beta, like @donavanbecker pointed me, since I was registering before with a plugin name that was not correct), but with 1.0 it is a problem it seems both for cached accessories and external accessories retrieval (I think it now retrieves them from the plugin name, before it was more "tolerant" and retrived the way it was registered). Trying to find a better way with homebridge people but not really confident, sorry guys.

nicoduj commented 4 years ago

Could you try the following ? : https://github.com/nicoduj/homebridge-harmony/issues/257#issuecomment-620410122