bassrock / homebridge-flair

Homebridge Plugin for Flair Smart Vents
18 stars 6 forks source link

UnhandledPromiseRejection: This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason "The structure is not available, this should not happen.". #393

Open nightlust opened 11 months ago

nightlust commented 11 months ago

UnhandledPromiseRejection: This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason "The structure is not available, this should not happen.".

randymassey commented 11 months ago

Having this same issue, was just about to start a new ticket & saw this open ticket 3 days ago.

I can add logs if needed.

keithah commented 11 months ago

This causes my homebridge to crash. Once I disabled this plugin, it was fine.

randymassey commented 11 months ago

So the same was originally happening to me upwards of several months back. At the time I did run all of my plug-ins under the single homebridge instance… I do run about six or so different plug-ins, so I was not sure initially which the culprit was, until I basically rebuilt Homebridge from scratch, then started running almost all of the plug-ins as child bridges.

Very quickly, only the flare child bridge would go down and the items in the Apple home app would show no response, but yet there were no errors in the logs, etc..

If I removed the plugin & its child bridge and re-added it, they would come back and function for a while and then stop working again, with the bridge running but now the vents associated with this plug-in showing as no response in the Apple app.

Then at a later point in time I've begun to have the problem that's also being reported in here with the bridge not being able to start correctly, and then it begins looping with the Primary structure error, saying that this should not be happening in the log, as part of the log entry… It will sit & loop like that anywhere from several minutes up to several hours, then it does make some type of a connection. Finally… also, at that juncture, if you look in the single cash accessory, clean out area of the admin, you will see multiple instances of each device.

Now, since then, I have not been able to then pair the bridge back, even with resetting it, and removing the cached accessories.

Once it does come up if I try to add it, the Apple home app will tell me it's out of compliance, and the device needs to be reset. If I go to the Homebridge full admin for accessories, once the looping stops and it does show the vents & puck, etc. in that Homebridge accessories page (as well as the duplicated even triplicate cached entries).

But as it stands now, I can no longer even add the bridge back in. That also includes fully uninstalling it, and its configurations, reinstalling from scratch only to run into the same issues. I even checked in with Flair, and obtained new credentials from them under The just in case scenario.

I've noticed the plug-in author hasn't responded to any messages here in quite a while, and the last update was two years ago. My guess is he might not be seeing these messages or possibly not engaged with the plug-in any longer, of that I'm not sure?

But I can say that running things as their own child bridges does really end up, helping in an unexpected way, when one plug-in is taking all of Homebridge down like this one did.

Once it's isolated to a child bridge, it's basically only taking itself down vs the rest of Homebridge, and your subsequent other child bridges continue to function unimpeded. I wanted to give you that as a suggestion in case you end up having to rebuild Homebridge as a result of the problem you ran into. Eventually, I did, & for a long time initially, I wasn't sure which plug-in was the culprit of the device non-response issues, it seems like the issues with this plug-in have been progressing over time, so my suspicion is potentially updated Dependencies like node, etc. and possibly that since the plug-in itself has not been updated in two years, that with each interval of time that passes with more dependency related updates, that the plug-in morphs and continues to exhibit ever stranger problems… That's purely supposition mind you, but it's my best guess, based on observation so far, and the fact that I've actually been struggling with this plug-in for about 6 months now in different permutations.

Hopefully the plug-in author can step in and give us some insight?!?!?

Randy

jmichas commented 9 months ago

Ugh. I just started using this plugin, well, trying to anyway. I already took over the Zway plugin because it was abandoned, I don't really have time for that let alone take on a new broken/abandoned project. Sad, this would have been cool. I will leave it installed with child bridge disabled on the off chance an update comes out.

DanielSchaffer commented 8 months ago

It looks like there's an issue in node-flair-api-ts where it's not correctly identifying the primary structure. I've created a fork of it as well as the plugin to fix it so that if there's only one structure (which I imagine is the case for most of us), it just uses that.

Here's the fork: https://github.com/DanielSchaffer/homebridge-flair

The package name is @ds-flair/homebridge-flair. When I installed it, it somehow copied the config from the existing plugin, so that was nice. When I removed the old plugin using the homebridge UI, I unchecked the "remove config file". I did have to remove and re-add the bridge from Homekit before things started working again.

I don't plan on doing much with the plugin unless something else breaks, but feel free to send PRs if you like.

randymassey commented 8 months ago

Hi Daniel, I wanted to thank you directly for creating this fork. I can confirm it is working for me as well. I had left my configuration installed in my HB instance, but had removed the plug-in months ago. I did have to go in and remove the child bridge instance, as well as the cached vents, as on my first attempt HomeKit said it was "out of compliance".

But I knew where to look to resolve that, & as soon as I deleted the child bridge instance, as well as what were multiple iterations of the cached vent accessories, it added right away, & at least, in the 30 second version of testing, everything worked great.

As you articulated, it did carry across, my settings from the previous plug-in instance. I saw something similar when I switched to a different fork of the Tuya plug-in as well, where my settings were carried across.

I did a quick test using Siri on the HomePods, everything worked as before.

Thank you so much for your efforts & you are also correct that mine is a single structure scenario, so as a workaround, this was wonderful.

Kind regards

Randy Massey

DanielSchaffer commented 8 months ago

Thanks @randymassey, I'm glad it was able to help someone else too!

nightlust commented 8 months ago

I can confirm, this is now working for me as well. Thank you so much!

On Dec 11, 2023, at 11:28 AM, Daniel Schaffer @.***> wrote:

Thanks @randymassey https://github.com/randymassey, I'm glad it was able to help someone else too!

— Reply to this email directly, view it on GitHub https://github.com/bassrock/homebridge-flair/issues/393#issuecomment-1850643522, or unsubscribe https://github.com/notifications/unsubscribe-auth/AD4E7H7ZK7LBRLKM4OHKGE3YI5GEJAVCNFSM6AAAAAA4Q5M6YOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNJQGY2DGNJSGI. You are receiving this because you authored the thread.

dshanabrook commented 7 months ago

Would it be possible for you to apply this fix to the fork that allows control of the mini-splits? This is beyond my coding level! https://github.com/mikeknoop/homebridge-flair-minisplit.

randymassey commented 2 months ago

Hey @DanielSchaffer, if you're still tinkering with these Flair vents, and the Fork you made on this plug-in, I had a question I wanted to run by you.

I had observed this in the past under another issue report and I know another user had as well, since you got the plug-in back up and running, I've at least been able to isolate where I see this problem the other user and I have both been encountering, I wanted to run the scenario by you & see what your thoughts were, if you are still willing to take a peek at the plug-in and see what might be happening?

What will happen is if you run this plug-in alongside other plug-ins very quickly all of Homebridge will come down in the sense that in Apple home, your devices will be nonresponsive… Quite a while ago and before you did your fork, I discovered by running the individual plug-ins as child bridges, that the problem tracked to this particular plug-in…

So the rest of your devices through other plug-ins Running as child bridges (& there's a few I still have group together that I've always behaved well before I started doing child bridges)… So only the Flair plugin items would become nonresponsive…

There was really no relevant logging information I could find, but one of the administration tools I use to do quick updates in Homebridge without going into the full GUI, would show me that my number of devices would slowly increase, which was very odd, then I noticed that it was correlating to even the Flair devices became nonresponsive… So that got me, looking into the single cached, accessories, & I quickly found that duplicates & even multiples of the Flair cached items for this plug-in were being spawned, usually after doing some type of update, say to node or H/Bridge itself, and then rebooting… But even if you just reboot it a few times doing nothing but reboots…

That was not always consistent, I could for testing purposes arbitrarily reboot once or twice after removing the cache items &, they would work again for a while, but arbitrarily usually within about a week after a reboot or two or 4, same thing everything associated with this plug-in would show as nonresponsive in Apple home, but in the User interface, as soon as that happened, and you went to look at the single cached items you would see that you had these duplicates and multiples & only from this plugin's devices…

Are you still using this plug-in, do you have any thoughts about what might be happening here? It essentially looks like the cache gets out of sync, then it begins spawning replicants which now have no meaning in the Apple home app.

I guess ultimately as long as you do not reboot Homebridge it stays running for quite long time, but anytime you start doing updates and then reboots it's gonna happen usually within a few days.

LMK if you're still tinkering with it, &/or willing to pop the hood & peek!

I'd def like to still use it & have it be more reliable.

Regards & thanks in advance..

Randy