Automation when network interrupted

Good afternoon, all.

Running OpenHABian 2.5 (on a Pi 4) and one thing I’ve noticed that is quite annoying - hopefully there’s a work-around for it.

Occasionally my data switches firmware upgrade overnight. When they do, network traffic ceases on that switch for a short time. I don’t believe link go down (PoE definitely doesn’t bounce, since the system stays up). It’s just that traffic ceases for a short time.

Well, that’s enough for it to break the HomeKit plugin. I have to restart the OpenHAB service (or just reboot the thing).

Obviously the box knows something happened, in order to break it. Or, maybe it’s a matter of it not re-registering some multicast addresses.

My thought was to write a rule that after it goes down and comes back, to have it restart the service. It’s ultimately what I do the next morning when none of our morning automation events run.

Can anyone recommend a way to achieve this?

Use the network binding to create a switch channel if the router is online
Link the channel to an item
Use the item state to trigger a rule

1 Like

… and don’t restart all of OH but just the Homekit binding.
Then again, I can’t believe your switches update often. And for sure the right approach definitely is to disable that behavior on the switch and only ever manually update at (scheduled) maintenance times.
Thats a basic operations requirement. Any commercial service provider would enforce that, too.

I want my switches updating - my home is a testbed, where I test different aspects of the switches for our customers.

I noticed the new rule engine has the ability to detect if the link to the OmniPro2 is down, which I can probably use as a trigger instead. I’m thinking that may be the best way to go, but unsure on the syntax of the underlying command to do it.

And I could probably just restart those individual plugins, but I don’t know how to issue a command that just applies to those.

Duh. Just for a second switching brains to that of my professional life as a systems architect:
No you don’t want that.
Professional testing requires the environment you test systems in to be fixed.
You don’t want components to update/change behavior themselves unless you explicitly tell them to (manual upgrade that usually is).
And by no means it’s acceptable policy to rely on the same devices for production (which is what OH is in your home) that you are testing (which is your switches to update).

You can restart bundles from Karaf console using e.g. exec binding.

Then again, in general, OH has no problem with temporary connectivity issues. If Homekit devices or the plugin do, that’s where to start searching for a solution.

I think we’re slightly off-toping on my reasons for switch/AP upgrades. It’s a release we push into testing, which auto-updates overnight for me to test. So, in that sense, it is a manual upgrade, just off-hours for reduced impact. Everything else handles the drop in IP connectivity just fine - which suggests THIS is what needs to be fixed because the point is being missed - ANY interruption in IP connectivity is causing it.

We don’t just see it on the HomeKit element - the linking to the OmniPro also goes down and stays down until restarted. Yes, I can still access the web and SSH into the box, but two services take a connection hit. It’s possible the breakage really is on the OmniPro side - I’ll test that tonight out of curiosity.

Frankly, re-reading your OP, I don’t understand what your issue is after all.
What stops working ? What’s OH logging ? What is OmniPro and how does it relate to your problem?
Everyone’s OH install is unique, and Homekit is rather… well, rarely used.
Since we cannot know what you don’t tell us, better improve your problem description if you want someone to help. You’re taking the risk of falling victim to the XY problem.

Not sure why you’re being so nasty - and if you don’t realize it, well I’m just telling you your tone is quite snippy.

As I said, I’ll need to re-test something to determine which service is actually having the issue - as I was typing, I was thinking it might not actually be HomeKit, but the OP plugin. After the network connectivity bounces, everything in HomeKit shows “No Response”. I have 2 items in the config that are NOT part of the OP link, so I’ll need to test to see if they are still controllable or not - that will tell me whether or not its actually HomeKit or the OP link.

However, I guess ultimately the question was, how can I instruct the restarting of a given link based on that service’s status going to disconnected/uninitialized. That’s all I was looking for, instead of being attacked because of HOW I do things in my environment.

Just trying to help and I even gave you an answer. But if all you’re interested in is tone and you feel you need to call me nasty (tone is easily misread in written conversation btw), well good luck then finding someone else willing to help.