NorthernMan54 / homebridge-alexa

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

Alexa can't find new accessories #447

Closed Silas888 closed 2 years ago

Silas888 commented 3 years ago

I'm having an issue where Alexa won't discover any new devices. I can add them to the config file with no issues. I currently have 128 devices. From what I recall the total number of devices that Alexa will see is 500, far below what I have. All of the existing devices work, I just cannot add any new ones. My backend automation system is HomeSeer. The only thing I did in recent memory is spun up and additional homebridge for HomeKit requests. I also instituted an instance filter to lock down homebridge-alexa to a single homebridge instance. I don't know if that could have been the turning point or not. Might you have any suggestions as to what I can do to troubleshoot this?

NorthernMan54 commented 3 years ago

The plugin is coded with a limit of 300

https://github.com/NorthernMan54/homebridge-alexa/blob/37eceb09a5b037234259b48174eb02e0f4fe7969/lib/alexaActions.js#L129

Which aligns to the Alexa maximum per skill

https://developer.amazon.com/en-US/docs/alexa/device-apis/alexa-discovery.html

And homebridge has a limit per instance of 150 - This is in the HAP Spec under 2.5.3.2 bridges

If your using filters am thinking to start there

Silas888 commented 3 years ago

Thank you for your reply. I'm not sure however where to place this line of code. Would it be in the the same config file in the Homebridge instance that contains homebridge-alexa? I'm not a developer unfortunately. Just an end-user.

NorthernMan54 commented 3 years ago

I’m not recommending you make any code changes, just pointing out the coded limit in the plugin and the message that appears

am thinking your filters may be the cause

Silas888 commented 3 years ago

OK so I disabled my second instance of Homebridge. Then I removed the filter from my first instance of home bridge and restarted the homerbridge instance. Still no dice. Any other suggestions?

NorthernMan54 commented 3 years ago

If you run in debug mode it will log a lot more detail on the debug process. Does it show that it is discovering all your devices?

Silas888 commented 3 years ago

Yes. All devices are found in the HB log.

The one thing I am seeing is the Alexa.ContactSensor is showing as NOT DETECTED.  if I remember wasn't that sensor an indicator as to whether or not Alexa can see Homebridge? 

NorthernMan54 commented 3 years ago

Can you share, want to see the total number of devices passed.

Silas888 commented 3 years ago

Am I able to PM you with the log? I'm not comfortable putting log files on open forums.

NorthernMan54 commented 3 years ago

Yes you can PM thru the Homebridge discord server

Silas888 commented 3 years ago

I'm sorry I don't know if I can. I see your username in Discord but I cannot PM you

Silas888 commented 3 years ago

i was able to PM you on discord. thank you for looking into this.

NorthernMan54 commented 3 years ago

Looking at the log file you only have a single homebridge instance being found and it has 124 accessories.

2021-05-07T17:01:12.877Z hapNodeJSClient HAP Device discovered Thermostat
2021-05-07T17:01:12.877Z hapNodeJSClient Filtered HAP instance address: ecobee4 -> 
[5/7/2021, 1:01:12 PM] [HomeSeer] Successfully connected to ASCII Control Interface of HomeSeer.
[5/7/2021, 1:01:12 PM] [HomeSeer] Sent Authorization Data
[5/7/2021, 1:01:12 PM] [HomeSeer] Successfully authorized Telnet port
2021-05-07T17:01:13.796Z hapNodeJSClient HAP Device discovered Homebridge XXXX
2021-05-07T17:01:13.939Z hapNodeJSClient Homebridge instance discovered homebridge with 124 accessories
2021-05-07T17:01:32.375Z hapNodeJSClient Ready
Silas888 commented 3 years ago

That sounds right. I technically have two home bridge instances however Homebridge Alexa only runs on one of them and is disabled on the other.

So if it's looking OK in the logs why can't Alexa find any new devices?

NorthernMan54 commented 3 years ago

I'm missing something here, are you saying that you have alot more than 124 devices ? And discovery isn't finding them.

Silas888 commented 3 years ago

No. I'm saying discovery is finding them in Homebridge however when I try to discover them with Alexa, no new devices are found.

Case in point. I added one new item called "Neato Reset 1". It's been added as a switch. Discovery will find it. Alexa will not. 

NorthernMan54 commented 3 years ago

Okay I think I miss understood, if the devices aren't being passed to Alexa please DM me a homebridge accessory dump and I will run it thru the device parser to see why they aren't being passed to Alexa. Details on collecting a homebridge accessory dump are in the read me.

Silas888 commented 3 years ago

Ok. I'll work on that now and let you know when I've sent it. Thank you

NorthernMan54 commented 3 years ago

Do you have blinds: true ?

I was running your config in my test setup, and with blinds true discovery was not working, but with blinds: false it worked. I need to look further into blinds to see why discovery does not work with blinds true.

image

Silas888 commented 3 years ago

I changed it to false as well, restarted homebridge and asked Alexa to discover. It found the missing device along with everything else. It duplicated the 124 devices that were already in Alexa. I'm curious Why would it do this?

NorthernMan54 commented 3 years ago

Am thinking discovery has not been working for you for a while now, as the switch to homebridge 1.3.x triggered the creation of duplicates for everyone due to internal changes within homebridge. The only fix is to remove the duplicate devices and recreate any routines or room placements etc.

Silas888 commented 3 years ago

OK so here's the thing. This will mark the third time I've had device duplications in Alexa because of changes within HomeBridge. I have over 123 devices, 50 groups and 75 routines. I would have to modify everything from start to finish and it takes weeks for me to complete it. I have a very complex set up.

Since everything works fine with what I have right now except that I can't add new devices, is there a way to have this discovery future disabled (perhaps some sort of a switch the config file like discovery=false) and where I can manually specify the items that I would like to cross over to Alexa. This would give the flexibility for both Homebridge Alexa to work as designed (discovery=true as New installation default) and the flexibility for people like me to just add what I need manually (Discovery=false)

Otherwise this is just a ticking time-bomb solution until HomeBridge decides to do another update and I have to go through this all over again.

NorthernMan54 commented 3 years ago

I feel for you, I have several hundred devices spread across a couple locations as well and went thru the same pain earlier this year several times. If I could have blocked or prevented it I would have. You would have seen this a lot sooner in the Homebridge upgrade cycle if blinds support hadn't broken discovery for you ( I still need to look into why blinds are failing, as I have yet to add blinds to my setup so I wasn't aware that it wasn't working ).

Why do you have so many groups and routines ? In my setup I try and limit the customization on the Alexa side, and keep the advanced automations and configurations on the Homebridge side.

Silas888 commented 3 years ago

Because as far as I know Alexa has never allowed a user to a to assign aliases to any of the devices. Because of that one cannot speak naturally. "Vacuum master bedroom" and "vacuum THE master bedroom" are NOT seen by Alexa as the same action. The only way around it is to define routines with the exact variance of wording. Now if there's a way to do this within Homebridge please let me know!

I guess I dodged a bullet that Blinds:TRUE prevented Alexa from duplicating devices. At this point I don't really add much to the network so maybe I'll just cut my losses and not update Homebridge anymore. That way I can keep things as they are.