I use a virtual temperature sensor as a work around for (the lack of) a binary input from a ESP32 based IO module I created.
I poll the IO module using a temperature sensor IP device and then set up a pattern match to trap the response value. In my case the temperature response is only a 1 or a zero. I then have a virtual switch associated with a meshbot that changes the state of the virtual switch to match the last “temperature” reading. This way my digital input is now stored in a binary state via the virtual switch and I can use it in downstream meshbots.
So not a very normal case and definitely a work around because there was not way to filter a pattern to a binary variable. At least I wasn’t able to sort it out.
I also use a similar scheme to read an actual temperature probe on my IO module and there it can be any value fro -30 to 140 degrees. Here the IP Device template again polls the IO Module and then traps the temp reading from the return string using this pattern match:
Probe Number 2 in F is: (%s%g%d%d%d.%d%d)
I saw elsewhere folks were having trouble parsing HTML response strings and I had to sort all that out by trial an error. A little more on that here…