NorthernMan54 / homebridge-alexa

Expose your homebridge controlled devices to Amazon Alexa.

Home Page:https://www.homebridge.ca

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Accessories Duplicated in Alexa

dustindclark opened this issue · comments

Hello,

It seems that some of my devices that are "allow-listed" are being duplicated in Alexa. The Homebridge logs show the same:

[11/29/2021, 12:28:55 AM] [Alexa] INFO: DeviceList - The following devices are allow => [
  "Kids' Windows",
  'Front/Back Door',
  'Attic',
  'Front Windows',
  'Laundry Room Door',
  'Master Door/Windows',
  'Storage',
  'Pool Light',
  'Spa Light',
  'Scuppers',
  'Scuppers low',
  'Air Blower',
  'Cleaner',
  'Pool low speed'
]
[11/29/2021, 12:28:55 AM] [Alexa] INFO: DeviceList - allow => Attic
[11/29/2021, 12:28:55 AM] [Alexa] INFO: DeviceList - allow => Front Windows
[11/29/2021, 12:28:55 AM] [Alexa] INFO: DeviceList - allow => Front/Back Door
[11/29/2021, 12:28:55 AM] [Alexa] INFO: DeviceList - allow => Kids' Windows
[11/29/2021, 12:28:55 AM] [Alexa] INFO: DeviceList - allow => Laundry Room Door/Dining Windows
[11/29/2021, 12:28:55 AM] [Alexa] INFO: DeviceList - allow => Master Door/Windows
[11/29/2021, 12:28:55 AM] [Alexa] INFO: DeviceList - allow => Storage
[11/29/2021, 12:28:55 AM] [Alexa] INFO: DeviceList - allow => Attic LeakDetector
[11/29/2021, 12:28:55 AM] [Alexa] INFO: DeviceList - allow => Attic Temperature Sensor
[11/29/2021, 12:28:55 AM] [Alexa] INFO: DeviceList - allow => Air Blower
[11/29/2021, 12:28:55 AM] [Alexa] INFO: DeviceList - allow => Cleaner
[11/29/2021, 12:28:55 AM] [Alexa] INFO: DeviceList - allow => Pool Light
[11/29/2021, 12:28:55 AM] [Alexa] INFO: DeviceList - allow => Pool low speed
[11/29/2021, 12:28:55 AM] [Alexa] INFO: DeviceList - allow => Scuppers low
[11/29/2021, 12:28:55 AM] [Alexa] INFO: DeviceList - allow => Scuppers
[11/29/2021, 12:28:55 AM] [Alexa] INFO: DeviceList - allow => Spa Light
[11/29/2021, 12:28:55 AM] [Alexa] INFO: DeviceList - allow => Air Blower
[11/29/2021, 12:28:55 AM] [Alexa] INFO: DeviceList - allow => Cleaner
[11/29/2021, 12:28:55 AM] [Alexa] INFO: DeviceList - allow => Pool Light
[11/29/2021, 12:28:55 AM] [Alexa] INFO: DeviceList - allow => Pool low speed
[11/29/2021, 12:28:55 AM] [Alexa] INFO: DeviceList - allow => Scuppers low
[11/29/2021, 12:28:55 AM] [Alexa] INFO: DeviceList - allow => Scuppers
[11/29/2021, 12:28:55 AM] [Alexa] INFO: DeviceList - allow => Spa Light
[11/29/2021, 12:28:55 AM] [Alexa] WARNING: Duplicate device name Air Blower
[11/29/2021, 12:28:55 AM] [Alexa] WARNING: Duplicate device name Cleaner
[11/29/2021, 12:28:55 AM] [Alexa] WARNING: Duplicate device name Pool Light
[11/29/2021, 12:28:55 AM] [Alexa] WARNING: Duplicate device name Pool low speed
[11/29/2021, 12:28:55 AM] [Alexa] WARNING: Duplicate device name Scuppers low
[11/29/2021, 12:28:55 AM] [Alexa] WARNING: Duplicate device name Scuppers
[11/29/2021, 12:28:55 AM] [Alexa] WARNING: Duplicate device name Spa Light

These accessories are on a plugin that I've written (homebridge-pentair-intellicenter), but these accessories do not show up as dupes in HomeKit. Any thoughts on why this would happen?

When I pass the homebridge accessory information over to the Amazon Alexa backend I need to provide a unique identifier ( endpointid ) per accessory so that amazon can keep track of them. And if for some reason the endpointid changes for an accessory it will duplicate on the Amazon side.

This is where I create the endpointid,

this.endpointID = Buffer.from(this.id + "-" + context.homebridge + "-" + context.info.Manufacturer + "-" + context.info.Name + "-" + this.serviceType).toString('base64').replace(endpointReg, '#');

If you had changed any of those within your plugin it will duplicate.

Name in itself was unique, but ID (assuming this is UUID?) didn't change either. I can see from my attached logs that the code found them twice, but I don't understand why that's possible.

Alexa found all of the devices (including dupes) all at once. One was controllable, and the other was unresponsive. I've since deleted the unresponsive devices. They did not return, even after restarting Homebridge and re-running Alexa discovery.

Anyways, I'm certain that they were unique, but I also can't recreate anymore. Feel free to close if you think this isn't an issue.

I expect that during you work on the plugin one of the values I use to create the endpointid was duplicated. With the UUID field, that is not visible to the HomeKit HAP interface. And the id is the HAP iid field.

All of the plugin work that I did was on a local Homebridge instance. I generally only install published plugin versions on my Pi, which is where I have your Alexa plugin installed. If any of the fields above changed between 1.0.0 and 1.0.2 of my plugin, I'd really like to understand why. The difference in 1.0.0 and 1.0.2 of my plugin is really just linter fixes and readme updates.

Do you run your development homebridge in insecure mode ? That would trigger it

No...only the Pi runs in insecure mode.

I’m stumped then

No worries. I'll close this out and re-open if I see it again. Thanks for the quick responses.

Actually, I was wrong about running insecure mode locally. Looks like nom run watch runs homebride in insecure mode:

[nodemon] starting `tsc && homebridge -I -D`

How/why does this interfere with my real Homebridge if I don't pair the local bridge on my device?

The plugin searches for all insecure homebridge instances, and shares their connected devices. It is a feature when you have multiple instances.

and as homebridge is running in insecure pairing is not needed or required.

looks like we have definitively determined why you had duplicates, and can close this.

Roger that. Closed already. Thank you.