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