How can I show in a string and trigger a switch if no no response received from http?

I have a dozen MyStrom Switches in openhab and HomeKit and they can nicely be switched on / off, report consumption and temperature (via http). The MyStrom switch can only connect via wifi and not ethernet cable.

Now, As I switch off wifi in part of the building overnight, how could I report which Switches are offline?

I’d love to have an item for MyStrom connectivity status being ONLINE or OFFLINE status in openhab. Moreover, if the status is OFFLINE, the MyStrom Switch should go to OFF in openhab and HomeKit. Please advise how to best do this with a rule?

See below my current item for a wifi-only enabled MyStrom Switch:

String MyStrom1String { http="<[$.relay)]" }
Switch MyStrom1 “MyStrom Steckdose #1” (gmystrom) { http=">[ON:GET:] >[OFF:GET:]" }
Number MyStromNo1_Power “MyStrom Steckdose #1 Verbrauch [%.1f Wh]” (gmystrom) {http="<[$.power)]"}
Number MyStromNo1_Temp “MyStrom Steckdose #1 Temperatur [%.1f °C]” (gmystrom) {http="<[$.temperature)]"}

My simple rule so far to double check the on / off status so far:

rule “Convert String to Switch”
Item MyStrom1String changed
if (MyStrom1String.state.toString == “true”) {
MyStrom1.sendCommand(ON) }
else { // assuming that there are only two states true/false

What about using the network binding to check online/offline status?

then, use the network bound item state to check the if condition and to display it on a sitemap.

Ps: How to use code fences

Thanks, will give it a try!

Is there a simple rule command to change a string if a certain field (i.e. power or temp of the switch) has not gotten an update for let’s say 30 seconds?

Expire binding was made for this.

did you consider using the existing (old) systom binding?