question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support for multiple instances of same platform

See original GitHub issue

After troubleshooting for some time with the Fibaro-HC2 plugin it seems it’s an issue that has to be fixed in Homebridge proper, so posting here.

To get around the HomeKit 100-accessories-per-bridge limitation, I’ve partitioned up my Fibaro-HC2 installation into 3 subsets of accessories, each controlling less than 100 accessories. For an example setup see Fibaro-HC2 issue 81 and this config.json.

Homebridge runs successfully the first time, but the second time I run into Error: Cannot add a bridged Accessory with the same UUID as another bridged Accessory, as described in Fibaro-HC2 issue 80.

The conclusion is that it’s impossible to use multiple instances of the same platform with Homebridge as Homebridge doesn’t store the specific platform instance identifier with the accessory in the accessories folder. See example run with one accessory per platform instance (with some additional output to show the unique seed):

% homebridge
[2/7/2018, 2:34:31 PM] Loaded plugin: homebridge-fibaro-hc2
[2/7/2018, 2:34:31 PM] Registering platform 'homebridge-fibaro-hc2.FibaroHC2'
[2/7/2018, 2:34:31 PM] ---
[2/7/2018, 2:34:31 PM] Loaded config.json with 0 accessories and 3 platforms.
[2/7/2018, 2:34:31 PM] ---
[2/7/2018, 2:34:31 PM] Loading 3 platforms...
[2/7/2018, 2:34:31 PM] [Fibaro HC2 1] Initializing FibaroHC2 platform...
[2/7/2018, 2:34:31 PM] [Fibaro HC2 2] Initializing FibaroHC2 platform...
[2/7/2018, 2:34:31 PM] [Fibaro HC2 3] Initializing FibaroHC2 platform...
[2/7/2018, 2:34:31 PM] Loading 0 accessories...
[2/7/2018, 2:34:31 PM] [Fibaro HC2 3] Configured Accessory:  床灯 Ceiling TV
[2/7/2018, 2:34:31 PM] [Fibaro HC2 3] Configured Accessory:  插座1 Xmas Star
[2/7/2018, 2:34:31 PM] [Fibaro HC2 3] Configured Accessory:  Ceiling Strip 1 new
[...QR code...]
[2/7/2018, 2:34:31 PM] [Fibaro HC2 1] didFinishLaunching. 
[2/7/2018, 2:34:31 PM] [Fibaro HC2 2] didFinishLaunching. 
[2/7/2018, 2:34:31 PM] [Fibaro HC2 3] didFinishLaunching. 
[2/7/2018, 2:34:31 PM] Homebridge is running on port 6088.
[2/7/2018, 2:34:31 PM] [Fibaro HC2 1] Loading accessories 
[2/7/2018, 2:34:31 PM] [Fibaro HC2 1] Unique seed:  插座1 Xmas Star3Fibaro HC2 1
[2/7/2018, 2:34:31 PM] [Fibaro HC2 1] Error getting data from Home Center:  Error: Cannot add a bridged Accessory with the same UUID as another bridged Accessory: 9e46f7f7-e186-4aef-a296-0b7c939b1815
    at Bridge.Accessory.addBridgedAccessory (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/lib/Accessory.js:264:13)
    at Bridge.Accessory.addBridgedAccessories (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/lib/Accessory.js:290:10)
    at Server._handleRegisterPlatformAccessories (/usr/local/lib/node_modules/homebridge/lib/server.js:451:16)
    at Server.<anonymous> (/usr/local/lib/node_modules/homebridge/lib/server.js:41:10)
    at API.emit (events.js:160:13)
    at API.registerPlatformAccessories (/usr/local/lib/node_modules/homebridge/lib/api.js:159:8)
    at ShadowAccessory.resgisterUpdateAccessory (/usr/local/lib/node_modules/homebridge-fibaro-hc2/dist/shadows.js:87:17)
    at FibaroHC2.addAccessory (/usr/local/lib/node_modules/homebridge-fibaro-hc2/dist/index.js:172:25)
    at LoadAccessories.devices.map (/usr/local/lib/node_modules/homebridge-fibaro-hc2/dist/index.js:113:22)
    at Array.map (<anonymous>)
[2/7/2018, 2:34:31 PM] [Fibaro HC2 3] Loading accessories 
[2/7/2018, 2:34:31 PM] [Fibaro HC2 3] Unique seed:  床灯 Ceiling TV1952Fibaro HC2 3
[2/7/2018, 2:34:31 PM] [Fibaro HC2 3] Added/changed accessory:  床灯 Ceiling TV
[2/7/2018, 2:34:31 PM] [Fibaro HC2 3] Remove accessory 插座1 Xmas Star
[2/7/2018, 2:34:31 PM] [Fibaro HC2 3] Remove accessory Ceiling Strip 1 new
[2/7/2018, 2:34:31 PM] [Fibaro HC2 2] Loading accessories 
[2/7/2018, 2:34:31 PM] [Fibaro HC2 2] Unique seed:  Ceiling Strip 1 new58Fibaro HC2 2
[2/7/2018, 2:34:31 PM] [Fibaro HC2 2] Added/changed accessory:  Ceiling Strip 1 new
^C[2/7/2018, 2:34:35 PM] Got SIGINT, shutting down Homebridge...

Any thoughts on if this seems accurate, and if so how/where to fix this?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
jvmahoncommented, Feb 20, 2018

Beorn - Its actually pretty easy to work around this limitation. Simply divide your config.json file into two or more files each named config.json but which are then stored in different directories. As an example, create two directories /var/homebridge/instance1 and /var/homebridge/instance2 . Into each of these directories, place a config.json file with less than 100 accessories. Also, make sure that you change the bridge’s “username” and port number in the second config.json file so it does not match the first config.json. For example, use ports 51828 and 51829. Also, on Linux, make sure the two directories have full rwx permissions. Now just start two instances of homebridge using the -U option to specify the two different folders (instead of relying on the default). I.e., execute:

homebridge -U /var/homebridge/instance1

homebridge -U /var/homebridge/instance2

This will then create two bridges, each of which can have up to 100 accessories. You’ll have to add them as two separate pairings to the Home app, but once that’s done, you’re all set.

0reactions
stale[bot]commented, Aug 20, 2018

This issue has been automatically marked as stale because it has not had recent activity, and will be closed if no further activity occurs. If this issue was overlooked, forgotten, or should remain open for any other reason, please reply here to call attention to it and remove the stale status. Thank you for your contributions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Running multiple instances - Cloud.gov
Running multiple instances may sometimes cause scheduled tasks or data loads to run multiple times. This issue can be prevented by using the...
Read more >
How to Run Multiple Versions of the Same Program on Windows
You can observe this yourself by opening the Task Manager (Ctrl + Shift + Esc), clicking More details if needed, and viewing the...
Read more >
Saas Solutions - Multi-tenant vs multi-instance architectures
In a multi-instance architecture, several companies will run their own separate instance of the application, with their own database. Each ...
Read more >
Pattern: Multiple service instances per host
Run multiple instances of different services on a host (Physical or Virtual machine). There are various ways of deploying a service instance on...
Read more >
What are the benefits of multiple instances? - Atlassian Support
An instance is a self-contained copy of a specific product. If you have a single instance of a product, everyone works together in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found