[Solved] State Transformations from messages containing BLANKS and COLONS

I do have a Z-Wave window sensor that delivers the following state messages:

AccessControl: Window/Door is open, arg 0000
AccessControl: Window/Door is closed, arg 0000

I would like to do a state transformation within an MQTT binding. However, I am struggling with the BLANKS and COLONS contained in the delivered states from the Z-Wave device. What is the correct syntax for the state transformation. I tried the following which is not working:

String og_bad_sensor_fenster “Bad [%s]” {mqtt="<[mosquitto:og/bad/sensor/fenster:state:closed:AccessControl: Window/Door is closed, arg 0000],<[mosquitto:og/bad/sensor/fenster:state:open:‘AccessControl: Window/Door is open, arg 0000’]"}

If it is zwave what does MQTT have to do with it?

The match is based on a regular expression so why not use it as such?

.*closed.*
.*open.*

Frankly, if these are the only two messages that get published to this topic you should just use a regular expression transform and skip the matching regular expression.

String og_bad_sensor_fenster "Bad [%s]" {mqtt="<[mosquitto:og/bad/sensor/fenster:state:REGEX(.*(closed|open).*)]"}

This will return closed for any message sent to this topic that contains the word “closed” and the same with “open”.

To directly answer your question, the problem is probably caused by the space after the : and before the Window/Door.

In a Regular Expression, you can represent a space using \s.

The Z-Wave stick is put on a different RPi. Right now, I am sending MQTT messages from FHEM to OH2. My FHEM installation is somewhat complex and before moving Z-Wave, Homematic, EnOcean an 433Mhz cul completely to OH2, I thought using MQTT in order to set up the items in the first place might be a good idea to get a first impression of OH2 items, sitemaps, and rules.[quote=“rlkoshak, post:2, topic:30603”]
Frankly, if these are the only two messages that get published to this topic you should just use a regular expression transform and skip the matching regular expression.

String og_bad_sensor_fenster “Bad [%s]” {mqtt="<[mosquitto:og/bad/sensor/fenster:state:REGEX(.(closed|open).)]"}
[/quote]

Will try. Thanks.

Given this is your setup I agree, MQTT is a great way to go.