Create a Script for pausing and re-enabling a thing which is offline


I use OH 3.4 and have a philips hue living color lamp which shows status offline sometimes. (I use a lot of philips hue products via a philips hue bridge, but this is the only thing which shows offline quite often.)

When I pause the thing and enable it again the status shows online for a couple of hours until it shows offline again.

Is it possible to write a script which checks the status and if it goes offline, just pause the device for 5 seconds and enable it again? If yes, how does such a script looks like?

Many thanks for your help.

Meanwhile I could solve the problem, by just deleting the item and install it again.