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="<[http://192.168.100.10/report:1000:JSONPATH($.relay)]" }
Switch MyStrom1 “MyStrom Steckdose #1” (gmystrom) { http=">[ON:GET:http://192.168.100.106/relay?state=1] >[OFF:GET:http://192.168.60.60/relay?state=0]" }
Number MyStromNo1_Power “MyStrom Steckdose #1 Verbrauch [%.1f Wh]” (gmystrom) {http="<[http://192.168.100.10/report:5000:JSONPATH($.power)]"}
Number MyStromNo1_Temp “MyStrom Steckdose #1 Temperatur [%.1f °C]” (gmystrom) {http="<[http://192.168.100.10/report:5000:JSONPATH($.temperature)]"}

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

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

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?