[SOLVED] After update openhab from 2.3 to 2.5 - Migration to MQTT 2.5

Hello community

I have updated to the version 2.5, and I do not know how to migrate the MQTT. I would like to have a short “howto”, do I have to change the setup?

Currently I have this items which worked fine, but now I do not know how to migrate them. I have seen several POST where no, with MQTT 2.5 I have to edit things and item files, am I right?

Switch sff_d1_puerta_timbre_1 "Puerta [MAP(puerta.map):%s]" { mqtt=">[mosquitto:cmnd/sff_d1_puerta_timbre/POWER1:comman$
Switch sff_d1_puerta_timbre_2 "B" { mqtt=">[mosquitto:cmnd/sff_d1_puerta_timbre/POWER2:command:ON:1],>[mosquitto:cmnd/s$
Switch sff_d3_estudio_1 "O" { mqtt=">[mosquitto:cmnd/sff_d3_estudio/POWER1:command:ON:1],>[mosquitto:cmnd/sff_d3_estudi$
Switch sff_d3_estudio_2 "F" { mqtt=">[mosquitto:cmnd/sff_d3_estudio/POWER2:command:ON:1],>[mosquitto:cmnd/sff_d3_estudi$

There’s a good post that explains it:

Migrating MQTT1 items to MQTT2.4 items

Thank you I will have a look. But there is not a way to do it from the files ITEMS and THINGS?

Regards.

No, this way is quite straightforward and you can keep your existing items but you will need to replace the MQTT information in the item definition.

Install the MQTT binding.
For each of your existing items using MQTT, in turn (do them one at a time):
Create a Generic MQTT thing and fill in the fields.
Create a channel for the item and fill in the fields (switch, string or whatever).
Cut and paste the channel information into the Item in your item file:

Your item file will look something like this:

old

Switch sff_d1_puerta_timbre_1 "Puerta [MAP(puerta.map):%s]" { mqtt=">[mosquitto:cmnd/sff_d1_puerta_timbre/POWER1:......

New:

Switch sff_d1_puerta_timbre_1 "Puerta [MAP(puerta.map):%s]" { channel="mqtt:topic:91837c76:sff_d1_puerta_timbre_1" } 

Don’t try and create the item file first. Create the Thing, then the Channel(s) and then edit the item file.

1 Like