NorthernMan54 / node-red-contrib-homebridge-automation

Homebridge and Node-RED Integration
Apache License 2.0
107 stars 18 forks source link

Handling "homebridge not initialized" during reboot #106

Closed hepcat72 closed 1 year ago

hepcat72 commented 1 year ago

I have a few polling flows to catch status change events for some homebridge devices (because for certain types of status changes, there's no event emitted from the event node [took me awhile to figure that out - but my issue isn't about this]).

Whenever I reboot my pi. I always get a few "homebridge not initialized" messages from those polling flows. That's not a big deal, but I just tried creating a new flow. Whenever I reboot, my HMDI switch auto-switches to the pi, and there's no way to turn off that auto-switch, so I had the idea to have an inject node run on startup that restores the HDMI switch to the channel it was on before the reboot. The problem is that, that command doesn't work unless I set a really long delay in that inject node because homebridge takes longer to start up than node-red.

I could create a catch node to try and handle this, but it would be easier (to capture the exact error I want) if the hb nodes had an optional output for outputting the success status (i.e. so I know if it failed and can loop and retry until it succeeds).

NorthernMan54 commented 1 year ago

I spent some time this am taking a look at this, and found that the catch node doesn't work for some reason, but the status node does. If the catch node did work, you could assign it to a particular node and create the behaviour your looking for.

hepcat72 commented 1 year ago

Oh cool. Well obviously, I haven't used the catch node enough to know you could do that, thanks.

NorthernMan54 commented 1 year ago

If you update to the latest version I fixed the catch node so it captures the 'homebridge not initialized' message.

hepcat72 commented 1 year ago

Excellent! I will give it a shot over the weekend. That's when I fool around with my flows (at least until my wife complains that I'm not doing chores and spending too long on the computer).