0

Boolean parser settings

Gabor Stepper 1 year ago in Devices / Other updated 1 year ago 2

Hi,

I get the state of a device via MQTT, the values under the respective topic can be either 0 or 1. I would like to convert that to False/True with a Boolean parser.

I can't find in the documentation or figure out how to do it correctly.


I thought that the below True Text and False Text could be used for that.

Image 4562

Or maybe the Regex should be constructed differently?

Image 4563

Thank you for the help in advance!


Gabor

+2

Hello,

I've used a demo MQTT device, where I can send 1 or 0 to the bOS.

I've used the same settings as you, except probably for the Parser type that you need to check:

On the Subscription, I've chosen "Parser Type" as Text;

On the Boolean, I've opened the Regex field, added %0 and below I've chosen the Subscription.LastMessage

On the True text I've placed 1

On the False text I've placed 0

And in my case it's working...

The Boolean changes between True and False everytime I change the MQTT value from the remote device.

You need to check if your parser is correct. In my case, I've used Text and not JSON.

Best regards

Hello,

Thank you very much! It is working as expected based on your description.

Best regards