Mqtt 2.5 updating items

Hi guys,

I have successfully updated my sonoff switches, temp sensors etc to the new mqtt 2.5 format. Now I would like to update my security system, PIR and contact switches (although there’s nothing wrong with my old mqtt items and config)

Here are my original cytech.items


Contact	Kitchen_PIR	      "Kitchen Motion    <motion>     (SecuritySystem         {mqtt="<[mosquitto:comfort2/input2:state:MAP(]"}

And this is what I’m trying to update to, but I’m getting a bit confused with the mappings part?

Contact	Kitchen_PIR	      "Kitchen Motion"     <motion>     (SecuritySystem)        {channel="mqtt:topic:comfort2:input2:motion"}

New things file

Bridge mqtt:broker:comfort2 "comfort2" @ "Security System" [ host="xxxxx", port=1883, secure=false, retain=false, username="xxxxx", password="xxxxx", qos=0, keep_alive_time=30000, reconnect_time=60000 ]
    // Kitchen PIR
    Thing topic input2 "Kitchen PIR" @ "Security System" {
        Type contact : Motion       "Motion"                [stateTopic="stat/input2/motion", transformationPattern = ""]


Any help will be much appreciated


I know I am not answering your question, but I notice this.

For your sonoff items do you have this line in their file also? Generally you only want one bridge assuming the broker is the same broker.

I put my bridge connection in one file then you can divide things into separate files.

On your mapping I believe the map goes in the things file as you have it. Is it not working properly?

Try removing the spaces for the transformation.


Thing topic input2 "Kitchen PIR" @ "Security System" {
        Type contact : Motion       "Motion"                [stateTopic="stat/input2/motion", transformationPattern=""]

I have similar devices that are working and the spaces are the only difference I’ve noticed.

1 Like

@matt_shepherd: Also it’s recommended to use PaperUI for Things to help with syntax errors but either way will work.

You can migrate your Things to PaperUI via REST API, here is an excellent post, with pictures, :+1: that will guide you. The first one took a few minutes but after that it’s a breeze.

1 Like

So am i correct in thinking that the rest api doc is a tool for helping you right items files? I was wanting to update my items and things so i can integrate it better with the Alexa skill.

The link was for migrating your Things file to PaperUI. It’s still recommended to use files for items but the correct syntax for the channel can be retrieved from PaperUI and no having to guess.

In the example item I posted above the channel info was copied straight from PaperUI. All the other info is left to you for however you like…except the item type e.g. Switch, Contact, Dimmer, etc…

I’m not the best at explanations in text so I made a bit of sense. If not let me know and I’ll try again. :grin:

EDIT: Forgot I didn’t post an item example.


Switch CouchLight "Couch Light" <light>  ["Lighting"]  { channel="mqtt:topic:pibroker:sonoff2:power" }

From PaperUI you can see the channel info that I copied.
Screenshot at 2020-04-13 11-05-59