Closed mitch7391 closed 3 months ago
Hi,
I believe you that it would work. According to https://github.com/homebridge/homebridge/wiki/Updating-To-Homebridge-v2.0 there is no requirement for plugins to do so. Therefore they need to fix something. If I can, I will use their template to prove it and submit a bug on their site. Until they acknowledge the issue, anything we do is temporary and everyone else's plugins will also suffer.
Ttyl, John
On Fri, Aug 16, 2024 at 2:06 AM Ung Sing Wong @.***> wrote:
...they did deprecate it but if their template does not handle accessories being restored properly, then all plugins will have this issue and they have a problem.
Hey John,
Their latest homebridge template does not include any logic for the removable of existing accessory from cache, it is up to the plugin developer to code the logic.
Your existing logic in Cmd4Platform.js is if ( ! accessory.reachable ) then remove the existing accessory from cache. By default reachable is false or undefined. As such, we have to define reachable and set it to true if that accessory is restored from cache and we do not want it to be removed.
My proposed fix is to add a line of code existingAccessory.reachable = true; after line 474 in Cmd4Platform.js.
It works beautifully. Please test it out for yourself.
You can find my modified version of Cmd4Platform.js here: https://github.com/uswong/homebridge-cmd4/blob/master/Cmd4Platform.js)
— Reply to this email directly, view it on GitHub https://github.com/ztalbot2000/homebridge-cmd4/issues/146#issuecomment-2292876668, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABSBCX3SSKCSQJ4UDPDFOXTZRWJFTAVCNFSM6AAAAABLN3PZCOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEOJSHA3TMNRWHA . You are receiving this because you modified the open/close state.Message ID: @.***>
Hi John,
Apparently, there is already an issue raised requesting a template on how to remove accessory from cache but homebridge hasn't replied for 2.5 months: https://github.com/homebridge/homebridge-plugin-template/issues/73
In any case, I think it is worthwhile to have a temporary solution for now for your many Cmd4 users.
Hi,
I used their template and ran it a number of times. It does not suffer from the problem. They do not use reachable. An accessory is found to be new or old or deleted based on its UUID. Somehow something is different and I need to check. Unfortunately I must go back to bed. I'll try later.
ttyl, John
On Fri, Aug 16, 2024 at 8:39 AM Ung Sing Wong @.***> wrote:
Hi John,
Apparently, there is already an issue raised requesting a template on how to remove accessory from cache but homebridge hasn't replied for 2.5 months: homebridge/homebridge-plugin-template#73 https://github.com/homebridge/homebridge-plugin-template/issues/73
In any case, I think it is worthwhile to have a temporary solution for now for your many Cmd4 users.
— Reply to this email directly, view it on GitHub https://github.com/ztalbot2000/homebridge-cmd4/issues/146#issuecomment-2293437047, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABSBCX3MY47JW7X3W2J4VKDZRXXILAVCNFSM6AAAAABLN3PZCOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEOJTGQZTOMBUG4 . You are receiving this because you modified the open/close state.Message ID: @.***>
Hi all,
So there is something funny. I put a Cmd4 switch as a platform with their template plugin (Which I called v2Bug). When I ran it against v1.8 and then v2.0 I got the funny behaviour. [2024-08-16, 11:31:37 a.m.] Loading 3 platforms... [2024-08-16, 11:31:37 a.m.] [Cmd4] Initializing Cmd4 platform... [2024-08-16, 11:31:37 a.m.] [v2bug] Initializing v2bug platform... [2024-08-16, 11:31:37 a.m.] [v2bug] Finished initializing platform: v2bug [2024-08-16, 11:31:37 a.m.] [Config] Initializing config platform... [2024-08-16, 11:31:37 a.m.] [Config] Spawning homebridge-config-ui-x with PID 6418 [2024-08-16, 11:31:37 a.m.] [v2bug] Loading accessory from cache: Bedroom [2024-08-16, 11:31:37 a.m.] [v2bug] Loading accessory from cache: Kitchen [2024-08-16, 11:31:37 a.m.] [Cmd4] Cmd4Platform didFinishLaunching [2024-08-16, 11:31:37 a.m.] [Cmd4] Restoring existing accessory from cache: PS4 [2024-08-16, 11:31:38 a.m.] [Cmd4] Accessory PS4 will be removed. [2024-08-16, 11:31:38 a.m.] [v2bug] Executed didFinishLaunching callback [2024-08-16, 11:31:38 a.m.] [v2bug] Restoring existing accessory from cache: Bedroom [2024-08-16, 11:31:38 a.m.] [v2bug] Restoring existing accessory from cache: Kitchen
Reachable is not the answer as they do not use this in their template. Something is clearly odd though. I can only look at this for a few minutes and then must go back to bed. ttyl, John
On Fri, Aug 16, 2024 at 8:56 AM John Talbot @.***> wrote:
Hi,
I used their template and ran it a number of times. It does not suffer from the problem. They do not use reachable. An accessory is found to be new or old or deleted based on its UUID. Somehow something is different and I need to check. Unfortunately I must go back to bed. I'll try later.
ttyl, John
On Fri, Aug 16, 2024 at 8:39 AM Ung Sing Wong @.***> wrote:
Hi John,
Apparently, there is already an issue raised requesting a template on how to remove accessory from cache but homebridge hasn't replied for 2.5 months: homebridge/homebridge-plugin-template#73 https://github.com/homebridge/homebridge-plugin-template/issues/73
In any case, I think it is worthwhile to have a temporary solution for now for your many Cmd4 users.
— Reply to this email directly, view it on GitHub https://github.com/ztalbot2000/homebridge-cmd4/issues/146#issuecomment-2293437047, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABSBCX3MY47JW7X3W2J4VKDZRXXILAVCNFSM6AAAAABLN3PZCOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEOJTGQZTOMBUG4 . You are receiving this because you modified the open/close state.Message ID: @.***>
Closed with homebridge-cmd4 v8.0.1 It was no longer necessary to remove old cached accessories that are not in your config.json as they never get re-allocated. Unfortunately this made it look like current accessories were added and removed.
ttyl, John Talbot
Hey John, been a hectic few days for us with the twins and family staying; just catching up now…
Their latest homebridge template does not include any logic for the removable of existing accessory from cache, it is up to the plugin developer to code the logic.
Ung Sing is completely right here, this is an area of your platform.ts
file (if you are using the Homebridge template) where the developer needs to handle the discovery, adding and removing of existing accessories; at the developer’s discretion they can choose to do absolutely nothing here but at the cost of the functionality.
In your latest version the platform does not remove accessories from the cache and therefore leaves them there as accessories in HomeKit showing ‘no response’, you are then placing it on the user to go to Homebridge settings and individually remove these no longer required accessories using the ‘remove single cached accessory’ option.
I do believe if you do not know of a better solution than what Ung Sing has presented, I do think we should go ahead with his proposed solution; as it does work as your plugin used to do before the Homebridge v2 change requirements.
@ztalbot2000 just checking in on you and to let you know this is still an issue...
Hey @ztalbot2000 just checking in again :)
Hi Mitch,
I'll have another look this weekend. I was hoping Homebridge would fix this issue as they broke it by removing the variable. It should not be the responsibility of every plugin to do this, but the platforms. Procrastinating I suppose.
ttyl, John
On Fri, Oct 18, 2024 at 5:48 AM Mitch Williams @.***> wrote:
Hey @ztalbot2000 https://github.com/ztalbot2000 just checking in again :)
— Reply to this email directly, view it on GitHub https://github.com/ztalbot2000/homebridge-cmd4/issues/146#issuecomment-2422006309, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABSBCX2G4WQLLHIKB2UHG23Z4DKPDAVCNFSM6AAAAABLN3PZCOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIMRSGAYDMMZQHE . You are receiving this because you were mentioned.Message ID: @.***>
Hey John, this is not an issue Homebridge are going to fix... Have a look here at the Homebridge Template Plugin platform.ts file Line 34 onward. It is on the plugin developer to create the accessory discovery, adding and removing of accessories; Homebridge itself is only going to handle the caching of these accessories after the fact.
All of my plugin users and all Cmd4 users will be experiencing the issue I described above if they are trialing the Homebridge v2 beta or once Homebridge release it properly:
In your latest version the platform does not remove accessories from the cache and therefore leaves them there as accessories in HomeKit showing ‘no response’, you are then placing it on the user to go to Homebridge settings and individually remove these no longer required accessories using the ‘remove single cached accessory’ option.
I have had to manually apply Ung Sing's fix way back when he suggested it and avoid updating any further so I do not blow it away. This will be a ticking time bomb for when Homebridge roll out the update and I can guarantee I will have users submit an issue for it.
Is your feature request related to a problem? Please describe: Hey @ztalbot2000 I am not sure if you are aware but the next version of Homebridge (v2.0) comes with breaking changes for a lot of Homebridge plug-ins and it has been put on the developers to get in line and update to match.
For Plug-In Developers
I have tested Cmd4 on the beta version and it will crash Homebridge.
Describe the solution you'd like: Please have a read of the link above and see what changes are required for Cmd4, this will ultimately affect my plug-in as well.
Describe alternatives you've considered: All users of Cmd4 will have to remain on Homebridge v1.8.4.
Additional context: