apexad / homebridge-mysmartblinds-bridge

Homebridge MySmartBlinds Bridge plugin
https://www.npmjs.com/package/homebridge-mysmartblinds-bridge
MIT License
13 stars 5 forks source link

Cannot add bridge accessory with the same UUID as another accessory #22

Closed nigetech closed 3 years ago

nigetech commented 3 years ago

I have upgraded to 2.0.1 and I am now getting the below issue I wasn't getting before: I have cleared the home bridge cache off all accessories but I have no idea where it is picking these up from as this is a clean install of homebridge since I had these previous Blind Names. Any thoughts?

Error: Cannot add a bridged Accessory with the same UUID as another bridged Accessory: 90456d13-4060-4f1e-bd4f-67c00690a95e
    at Bridge.Accessory._this.addBridgedAccessory (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Accessory.ts:419:15)
    at /usr/local/lib/node_modules/homebridge/src/server.ts:308:19
    at Array.filter (<anonymous>)
    at Server.restoreCachedPlatformAccessories (/usr/local/lib/node_modules/homebridge/src/server.ts:268:69)
    at Server.start (/usr/local/lib/node_modules/homebridge/src/server.ts:156:10)
    at cli (/usr/local/lib/node_modules/homebridge/src/cli.ts:80:10)
    at Object.<anonymous> (/usr/local/lib/node_modules/homebridge/bin/homebridge:17:22)
    at Module._compile (internal/modules/cjs/loader.js:1137:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
    at Module.load (internal/modules/cjs/loader.js:985:32)
    at Function.Module._load (internal/modules/cjs/loader.js:878:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
    at internal/main/run_main_module.js:17:47
nigetech commented 3 years ago

As an update I have tried removing and resetting the bridge, and the plugin, but still the issue remains - it is picking up three of my blinds twice (same UUID's but different names) - they were renamed at one point long before I had this instance of Homebridge. Aware this may be the cloud servers or possibly the bridge caching the blinds - any advice would be great if you have any suggestions. Thanks

nigetech commented 3 years ago

Apologies for the multiple messages - on debugging I can see the plugin returns status of the blinds as below:

name: 'Lounge (Hallside)',
      encodedMacAddress: 'p20LSSH1',
      encodedPasskey: '+JvQJZkQ',
      roomId: '68542056-9f49-487c-b6cc-f74b55f9535f',
      deleted: true
    },
    {
      name: 'Lounge (Hallside)',
      encodedMacAddress: 'p20LSSH1',
      encodedPasskey: '7EN5Zy0y',
      roomId: '3abfa712-5813-4194-8219-5677441e15a6',
      deleted: false

For each there is a deleted flag - (ignore the similar naming of them, I renamed the current blind back to the old name to see if this would fix the issue)

However it seems to be adding blinds with a deleted flag or true - is there anyway to turn this off or make it an option to turn off?

apexad commented 3 years ago

So I'm confused!? Is it correctly picking up all of your blinds or 2 of 3?

I'm already doing a deleted check, but it's fascinating that there can be a deleted: true and deleted: false entry for the same blind. That's what is probably causing this to happen.

apexad commented 3 years ago

I see the issue, working on it now.

nigetech commented 3 years ago

Yes picking up all of my blinds but duplicating three of them which have had name changes (and possibly removed and readded to the app in the past) Thanks for the quick response. It does seem a bit of an oddity but I had issues with these same blinds about a year ago which involved factory resetting and re-adding them so possibly still a 'ghost' blind there on the bridge which there wouldn't be normally.

apexad commented 3 years ago

So, previously as a static plugin this was not an issue since the blinds were not cached and generated on every restart of homebridge. This is the first dynamic platform and I only have 1 blind (that I've never changed room or anything) so hard to duplicate issues like this.

nigetech commented 3 years ago

No worries at all - I assumed it was due to the caching - seems more of an issue with the bridge or cloud 'holding on' to the blinds than an issue with the plugin as such, like you I wouldn't expect there to be a deleted and active version of the same blind.

randymassey commented 3 years ago

I can confirm I am having the same issue as above, I also did a full wipe & clean run of HOOBS with only this plugin. I will paste a log & of interest once installed I was also getting errors trying to "uninstall" the plugin.. I thought I had a screenshot of that, but forgot to capture that from the log in my varying troubleshooting steps.

Randy

Log paste with debug on:

11/5/2020, 3:27:34 PM HOOBS listening on port 80.
11/5/2020, 3:27:38 PM Loaded plugin 'homebridge-mysmartblinds-bridge'
11/5/2020, 3:27:38 PM [11/5/2020, 4:27:38 PM] Registering platform 'homebridge-mysmartblinds-bridge.MySmartBlindsBridge'
11/5/2020, 3:27:38 PM Loading 1 platforms...
11/5/2020, 3:27:38 PM [MySmartBlindsBridge] Initializing MySmartBlindsBridge platform...
11/5/2020, 3:27:38 PM [MySmartBlindsBridge] Loading accessory from cache: Stairwell Left Stairwell
11/5/2020, 3:27:38 PM [MySmartBlindsBridge] Loading accessory from cache: Office Right Office
11/5/2020, 3:27:38 PM [MySmartBlindsBridge] Loading accessory from cache: Living Room Front
11/5/2020, 3:27:38 PM [MySmartBlindsBridge] Loading accessory from cache: Dining Room Left Dining Room
11/5/2020, 3:27:38 PM [MySmartBlindsBridge] Loading accessory from cache: Kitchen Kitchen Sink
11/5/2020, 3:27:38 PM [MySmartBlindsBridge] Loading accessory from cache: Living Room Side Window
11/5/2020, 3:27:38 PM [MySmartBlindsBridge] Loading accessory from cache: Master Bedroom West Window
11/5/2020, 3:27:38 PM [MySmartBlindsBridge] Loading accessory from cache: Stairwell Right Stairwell
11/5/2020, 3:27:38 PM [MySmartBlindsBridge] Loading accessory from cache: Office Left
11/5/2020, 3:27:38 PM [MySmartBlindsBridge] Loading accessory from cache: Office Left Office
11/5/2020, 3:27:38 PM Error: Cannot add a bridged Accessory with the same UUID as another bridged Accessory: 7568af17-4b1e-43f1-a4e5-2d724660346b
    at Bridge.Accessory._this.addBridgedAccessory (/usr/local/lib/node_modules/@hoobs/hoobs/node_modules/hap-nodejs/dist/lib/Accessory.js:288:27)
    at /usr/local/lib/node_modules/@hoobs/hoobs/bridge/server.js:250:25
    at Array.filter (<anonymous>)
    at Server.restoreCachedPlatformAccessories (/usr/local/lib/node_modules/@hoobs/hoobs/bridge/server.js:211:81)
    at Server.start (/usr/local/lib/node_modules/@hoobs/hoobs/bridge/server.js:159:14)
    at /usr/local/lib/node_modules/@hoobs/hoobs/bridge/cli.js:94:16
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
11/5/2020, 3:28:17 PM Loaded plugin 'homebridge-mysmartblinds-bridge'
11/5/2020, 3:28:17 PM [11/5/2020, 4:28:17 PM] Registering platform 'homebridge-mysmartblinds-bridge.MySmartBlindsBridge'
11/5/2020, 3:28:17 PM Loading 1 platforms...
11/5/2020, 3:28:17 PM [MySmartBlindsBridge] Initializing MySmartBlindsBridge platform...
11/5/2020, 3:28:17 PM [MySmartBlindsBridge] Loading accessory from cache: Stairwell Left Stairwell
11/5/2020, 3:28:17 PM [MySmartBlindsBridge] Loading accessory from cache: Office Right Office
11/5/2020, 3:28:17 PM [MySmartBlindsBridge] Loading accessory from cache: Living Room Front
11/5/2020, 3:28:17 PM [MySmartBlindsBridge] Loading accessory from cache: Dining Room Left Dining Room
11/5/2020, 3:28:17 PM [MySmartBlindsBridge] Loading accessory from cache: Kitchen Kitchen Sink
11/5/2020, 3:28:17 PM [MySmartBlindsBridge] Loading accessory from cache: Living Room Side Window
11/5/2020, 3:28:17 PM [MySmartBlindsBridge] Loading accessory from cache: Master Bedroom West Window
11/5/2020, 3:28:17 PM [MySmartBlindsBridge] Loading accessory from cache: Stairwell Right Stairwell
11/5/2020, 3:28:17 PM [MySmartBlindsBridge] Loading accessory from cache: Office Left
11/5/2020, 3:28:17 PM [MySmartBlindsBridge] Loading accessory from cache: Office Left Office
11/5/2020, 3:28:17 PM Error: Cannot add a bridged Accessory with the same UUID as another bridged Accessory: 7568af17-4b1e-43f1-a4e5-2d724660346b
    at Bridge.Accessory._this.addBridgedAccessory (/usr/local/lib/node_modules/@hoobs/hoobs/node_modules/hap-nodejs/dist/lib/Accessory.js:288:27)
    at /usr/local/lib/node_modules/@hoobs/hoobs/bridge/server.js:250:25
    at Array.filter (<anonymous>)
    at Server.restoreCachedPlatformAccessories (/usr/local/lib/node_modules/@hoobs/hoobs/bridge/server.js:211:81)
    at Server.start (/usr/local/lib/node_modules/@hoobs/hoobs/bridge/server.js:159:14)
    at /usr/local/lib/node_modules/@hoobs/hoobs/bridge/cli.js:94:16
    at processTicksAndRejections (internal/process/task_queues.js:97:5)

[screenshot removed - not needed - thanks for confirming it was a fresh install]

apexad commented 3 years ago

As has been pointed out by @nigetech this is due to the way MySmartBlinds api holds onto so called 'deleted' blinds that have been re-added (by keeping them listed).

I'm still working on how this can be resolved.

apexad commented 3 years ago

homebridge-mysmartblinds-bridge@2.0.2-beta.0 Are any of you @nigetech or @randymassey @gregmichael able to try out this beta version?

For some context, what I have done is changed it so that it now works in 2 steps:

  1. Look at all non-deleted blinds and add/update
  2. Look at all deleted blinds and remove (unregister) if not re-added

Confirm if this resolve the duplicate uuid issue and if it does I can publish this version very soon.

itsethamphetamine commented 3 years ago

@apexad I just noticed the same issue, after a HomeBridge restart. I updated to beta, cleared my accessory cache and after restart its all working.

apexad commented 3 years ago

@apexad I just noticed the same issue, after a HomeBridge restart.

I updated to beta, cleared my accessory cache and after restart its all working.

Great! Thanks for jumping in and letting me know. I will probably merge this sometime now.

itsethamphetamine commented 3 years ago

Thanks for the awesome plugin! Glad I could help.

nigetech commented 3 years ago

Thanks @apexad for your work on this.

randymassey commented 3 years ago

Just working on this, this morning, as I had to ultimately (for a few reasons, rebuild HOOBS from scratch.

But I too wanted to say thank you for the wonderful work on this plugin.

I missed the beta post last night as I had already signed off, but I see it was published this morning, so I installed it into the fresh build of HOOBS, & so far everything seems to be working. Mind you, I have only just wrapped that up & added back into HomeKit the HOOBS server & I have almost 40 items in there from a total of 4 plugins, so I am still fine tuning Apple’s Home App, layout, naming etc, but the quick testing I did had everything working.

I will do more detailed testing throughout the day, & I see the case is closed, so I jsut wanted to add a confirmation from my testing as well..

Thank you for your wonderful efforts...

Regards.

Randy

Sent from my iPad

On Nov 5, 2020, at 8:19 PM, itsethamphetamine notifications@github.com wrote:

 Thanks for the awesome plugin! Glad I could help.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

apexad commented 3 years ago

Great to hear it's working now. Of course if anyone sees this issue or others come up, this issue can be re-opened or another one created.

apexad commented 3 years ago

FYI, I did some more cleanup for handling deleted blinds that may not actually be deleted but just duplicated 2.0.3 Please let me know if you see issues with this new release. I don't anticipate issues.