I’m using ESPEasy on some Ecoplugs and controlling them via MQTT. I have some rules set up to get the state of the plugs when OH starts. I have an extra item for each plug that holds the returned status, as well as several lines of rules. I could eliminate all but a simple publish command to each plug at startup, except for the way that ESPEasy returns the status.
The status is returned as a 1 or 0 in a JSON array.
/ol4/status {
"log": "GPIO 15 Set to 0",
"plugin": 1,
"pin": 15,
"mode": "output",
"state": 0
Obviously I can extract the 1 or 0. And I can map them to the expected ON or OFF. But is it possible to use both transforms?
I realize the simple answer would be to use persistence, but I try to make sure my devices still function whether or not OH is available so I would like any changes that may have happened to be reflected.