Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Duplicate Devices due to generic naming #551

Open
slandells opened this issue Oct 17, 2022 · 10 comments
Open

Duplicate Devices due to generic naming #551

slandells opened this issue Oct 17, 2022 · 10 comments

Comments

@slandells
Copy link

I'm having an issue with some Tuya/SmartLife devices with a generic name not being imported due to being duplicates
The devices are renamed in both the SmartLife App, and in Homebridge, but are still being seen as "switch_1" and so on (where I've renamed them 'Pool Pump', etc...). This means that only the first instance is imported into Alexa, and then all others are ignored.
I've tried to see if there's any way to rename them other than in the SmartLife App and Homebridge, but can't find anything else.
Is there something I'm missing? Is there a way to have HomeBridge and therefore homebridge-alexa identify them by the newly entered name?

@NorthernMan54
Copy link
Owner

Which plugin are you using for your tuya/smart life app ?

Also could you share an accessory dump, I want to see what names are being passed over. https://github.com/NorthernMan54/homebridge-alexa#homebridge-accessory-dump

@slandells
Copy link
Author

I'm using homebridge-tuya-platform and have specified the Paas Platform as SmartLife (i've also tried setting it as Tuya Smart and it's no better).
Most of the accessories pull through OK, but it appears to be the ones with a second layer. Like a GPO with 2 switches, or a powerboard with 4. It's that second layer that doesn't seem to recognize the renaming.
I'd say it's not your plugin that's the issue, but thought I'd start here...

Startup Log:
[10/18/2022, 8:30:57 AM] [Alexa] ERROR: Parsing failed, removing duplicate endpointID => switch_1
[10/18/2022, 8:30:57 AM] [Alexa] ERROR: Parsing failed, removing duplicate endpointID => switch_1
[10/18/2022, 8:30:57 AM] [Alexa] ERROR: Parsing failed, removing duplicate endpointID => switch_2
[10/18/2022, 8:30:57 AM] [Alexa] ERROR: Parsing failed, removing duplicate endpointID => switch_2

Accessory Dump:
https://pastebin.com/vhm9Fnbt

Thanks,
Stuart

@slandells
Copy link
Author

I've done some more digging around, and confirmed that the iot.tuya.com platform shows the devices in the same way the plugin is pulling them in to Homebridge, and therefore how they're being mapped to Alexa.
I've tried to edit the json config in the Tuya Dev platform, but it doesn't appear to stick.
Is there a way to have the Homebridge superficial name pulled through? Is there something I can do in the json config for homebridge to assign a name to a sub?

@NorthernMan54
Copy link
Owner

Looking at the accessory dump, and their are 3 devices with the name 'switch_1'

"Back Porch"
"Pool Equipment"
"Pool Lights"

Accessory Name - "Back Porch"
     Service - Switch - Name "switch_1"

And the Homebridge-alexa plugin uses the service name if supplied ( in case their are multiple services on a single accessory )

I looked at the homebridge-tuya-platform plugin and am thinking that this line is the potential issue.

"Back Porch"

@slandells
Copy link
Author

I think everything is doing exactly as it's designed to work.
The issue is just that the services are named that way on the Tuya Platform (iot.tuya.com) and there doesn't appear to be a way to rename them.
The App allows me to rename the device, and the sub device, but doesn't seem to push the renaming of the sub device back to the platform, which therefore doesn't pull through.
I'll raise a ticket on the homebridge-tuya github and see if anyone has any suggestions.
Even if I have to add lines to the json.config to force them to rename, I'm fine to, I just can't work out how...

Thanks for your help, am subscribed to the service anyway :)

@slandells
Copy link
Author

Ran into this issue with another product, Hunter Sprinklers...
They all come through as "Sprinkler", regardless of where things are renamed or not.
I understand the duplicate skipping was implemented to get around some other issues, but is it possible to have an option where we can skip this code and import duplicates at our own risk?
I'm only getting legit duplicates, never had an issue with it importing the same item twice...

@NorthernMan54
Copy link
Owner

Could you share an accessory dump of your Hunter Sprinklers..., want to see what is being discovered, and what the options are.

@slandells
Copy link
Author

Sorry I thought I did this the other day...

https://pastebin.com/qtmKCsm8

NorthernMan54 added a commit that referenced this issue Jan 27, 2023
@NorthernMan54
Copy link
Owner

Well I looked at a couple of different options to resolve this, but eventually came up with an approach that combines all the HomeKit service names for a device. After looking at your data this resolves your issue completely, but it has a side effect of breaking existing implementations. So I needed to make the new approach an Advanced Settings configuration option mergeServiceName, that you can try to resolve the issue. This will break any devices from homebridge-alexa in your setup and you will need to remove the existing non-functioning devices from the Alexa App and ask Alexa to discover devices again to resolve.

This feature is included in the latest version 0.6.5

The new names for your devices with mergeServiceName set

          "friendlyName": "Back Garden Sprinkler",
          "friendlyName": "Back Porch switch_1",
          "friendlyName": "Back Porch switch_2",
          "friendlyName": "Back Porch switch_3",
          "friendlyName": "Back Porch switch_4",
          "friendlyName": "Bathroom Skylight",
          "friendlyName": "Driveway Sprinkler",
          "friendlyName": "Front Garden Sprinkler",
          "friendlyName": "Lamp",
          "friendlyName": "Left Strip Lights",
          "friendlyName": "Pool Equipment switch_1",
          "friendlyName": "Pool Equipment switch_2",
          "friendlyName": "Pool Lights switch_1",
          "friendlyName": "Pool Lights switch_2",
          "friendlyName": "Pool Sprinkler",
          "friendlyName": "Pond Garden Sprinkler",
          "friendlyName": "Right Strip Lights",
          "friendlyName": "Sideway Sprinkler",
          "friendlyName": "Corner",
          "friendlyName": "Chaise",
          "friendlyName": "Bathroom",
          "friendlyName": "Back Door",
          "friendlyName": "Door",
          "friendlyName": "Owens Room",
          "friendlyName": "LIFX Pls BR30 298906 Master",
          "friendlyName": "LIFX Pls BR30 299B64 Retreat",
          "friendlyName": "Lounge",
          "friendlyName": "Laundry",
          "friendlyName": "Middle",
          "friendlyName": "Pantry",
          "friendlyName": "Window",
          "friendlyName": "Garage Door",
          "friendlyName": "Front Gate",

@slandells
Copy link
Author

Amazing! I'll give it a try now and see what happens :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants