NorthernMan54 / homebridge-alexa

Expose your homebridge controlled devices to Amazon Alexa.
https://www.homebridge.ca
458 stars 68 forks source link

Accessories Duplicated in Alexa #474

Closed dustindclark closed 3 years ago

dustindclark commented 3 years ago

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?

NorthernMan54 commented 3 years ago

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, https://github.com/NorthernMan54/homebridge-alexa/blob/12c3809dddf4a28f7fea1eb5d551c8836dbd4a0d/lib/parse/Service.js#L39

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

dustindclark commented 3 years ago

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.

NorthernMan54 commented 3 years ago

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.

dustindclark commented 3 years ago

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.

NorthernMan54 commented 3 years ago

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

dustindclark commented 3 years ago

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

NorthernMan54 commented 3 years ago

I’m stumped then

dustindclark commented 3 years ago

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

dustindclark commented 3 years ago

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?

NorthernMan54 commented 3 years ago

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.

dustindclark commented 3 years ago

Roger that. Closed already. Thank you.