Well, for consumer_connected
, according to this:
{
“consumer_connected”: true,
“consumption”: 0.18,
“current”: 0,
“linkquality”: 68,
“power”: 0,
“state”: “OFF”,
“temperature”: 20,
“voltage”: 229
}
you get back true
or false
, so not 0 and 1. But otherwise, yes!
Type switch : consumer_connected "Connected" [ stateTopic="zigbee2mqtt/MobileSocketMi1", on="true", off="false", transformationPattern="JSONPATH:$.consumer_connected"]
Just beware of small edits to Things files not being loaded correctly by openHAB. You may need to restart openHAB, or do this.