REGEX and MQTT Binding


I have a little problem with REGEX and the MQTT binding.

The MQTT binding and switch works great without regex.


I think the regex transformation also work fine … when i type a invalid regex i get an error.

But both i cant get to work :frowning:

My MQTT message: 20;2A;Chuango;ID=b1b978;SWITCH=02;CMD=ON;

I simple want to look after: Chuango;ID=b1b978

So if Chuango;ID=b1b978 is in the message turn the switch on.

My MQTT for the Item:

I have tried:

And much more valid regex strings but it dosent work.

I have also tried it with state and command.

I get no error and the switch wont switch …

Thanks and sorry for my bad english …

I figured out that the regex work to …

When i use the mqtt string without the ON i get the following warning:
given new state is NULL, couldn’t post update for ‘AL_WHGT’

So i used:



So i think the regex will work to but why i dosent work with the on state …


Ok now i found the solution thanks :slight_smile:

You cant use the REGEX to switch item states only for number or string items …

To switch item states you have to use regex_filter !

First i thougt it will be the same but it isnt and there is no example in the mqtt binding description …

The difference just simple write the regex without the REGEX in front.

So you have to use for switches or switchable items:


For Numbers, Strings etc. you have to use something like this to get a part of the message: