i need a really small solution for my holiday house in greece.
The Internet Connection in Greece is not the best… and the router also… but every time when the connection get broken, a power restart helps it to reconnect.
Now is my plan, to restart the router with a Shelly Plug.
My problem is, that my experience in openhab is really small.
How can i now tell the shelly that he have to power off for example 30 seconds, when all 6 Ping (see attached Screenshot) are for 15 minutes offline?
Break it down.
- Detect all six ping devices are OFF
- Detect all six ping devices are off for 30 seconds (I’m assuming the ping polling period is 15 seconds on the Network binding Thing, it’s 60 seconds by default so you may want to double check that)
- Tell the shelly to power off
- Tell the shelly to power off, wait a few seconds and then power back on again
If you break it down like this with incremental steps it doesn’t sound so hard.
For 1, use a Group:Switch with an “all ON then ON else OFF” aggregation function. The state of the Group will only become off when all members are off.
For 2, consider using Debounce [3.2.0;3.4.9]. The Group created in 1 will become the “raw Item” and you will create a new proxy Item which will get commanded to OFF only when the Group remains OFF for 30 seconds.
For 3 I hope you already know how to do that.
Finally, for 4 you’ll create a rule that triggers when the Proxy Item from 2 is commanded to OFF. In that rule, command the shelly to OFF, set a timer for 30 seconds or so and then command the Item back to ON.
If you want to get fancy and have it try again, in addition to commanding the shelly to ON, command the Group created in 1 to ON which should update all the ping Items to ON too. Then if they go OFF again even after the restart the whole process will kick off again and a second reboot will occur and repeat until at least one of those ping devices come back ON.