Transformationpaddern mqtt

Hello,
i try to transform a contact sensor message to another value

Type contact : balkontuer "balkontuer" [ commandTopic="statusdisplay/status/door/balkontuer", 1="open", 0="close"]

But it’s not doing anything I still see 1 and 0 in the mqtt mesage whats wrong?

Shouldn’t a contact type only have a state topic?

1 Like

Correct!

You may want to try MAP transformation if you are wanting to see something other than a 1 or 0.

[ commandTopic=“statusdisplay/status/door/balkontuer”, transformationPattern=“MAP:ONOFF.map” ]

Like they say, there is no commandTopic for a Contact Item because there can be no command.

Meantime,

there are no 1= or 0= parameters for the MQTT binding. You cannot just make up syntax.

The docs tell you that on= off= are what you are looking for Contact type.

Hello I would like to send a mqtt message if the contact says “open” or “closed”.

How can I do this??

@rossko57 @H102 @Sascha_Billian

Why not change your openHAB Item type to a switch, so that you can send it commands from rule or UI?

Ok done a switch now working everything thanks