# Migrating MQTT1 items to MQTT2.4 items

**URL:** <https://community.openhab.org/t/migrating-mqtt1-items-to-mqtt2-4-items/60502>\
**Category:** Solutions\
**Tags:** mqtt-binding\
**Created:** [December 20, 2018, 8:53pm UTC](https://community.openhab.org/t/migrating-mqtt1-items-to-mqtt2-4-items/60502 "2018-12-20T20:53:16Z")\
**Posts on this page:** 20\
**Page:** 2

<div class="post-metadata">

**Author:** ![pacive](https://community.openhab.org/user_avatar/community.openhab.org/pacive/32/36234_2.png) [@pacive](https://community.openhab.org/u/pacive)\
**Post date:** [December 29, 2018, 12:37pm UTC](https://community.openhab.org/t/migrating-mqtt1-items-to-mqtt2-4-items/60502/21 "2018-12-29T12:37:58Z")

</div>

Autoupdate can still be used just as before, e.g:

```auto
Switch Item_Name "Label" { channel="mqtt:topic:topic_name:channel", autoupdate="false" }

```

---

<div class="post-metadata">

**Author:** ![ymaglaras](https://community.openhab.org/letter_avatar_proxy/v4/letter/y/e0b2c6/32.png) [@ymaglaras](https://community.openhab.org/u/ymaglaras)\
**Post date:** [December 29, 2018, 1:08pm UTC](https://community.openhab.org/t/migrating-mqtt1-items-to-mqtt2-4-items/60502/22 "2018-12-29T13:08:50Z")

</div>

Didn’t try that 😊  
Thanks a lot!

---

<div class="post-metadata">

**Author:** ![Noam\_Shaharabani](https://community.openhab.org/letter_avatar_proxy/v4/letter/n/e19adc/32.png) [@Noam\_Shaharabani](https://community.openhab.org/u/Noam_Shaharabani)\
**Post date:** [December 31, 2018, 12:08am UTC](https://community.openhab.org/t/migrating-mqtt1-items-to-mqtt2-4-items/60502/23 "2018-12-31T00:08:42Z")

</div>

hello

if i have this

```
{ autoupdate="false", mqtt="&gt; 
[mosquitto:broadlink/tv/room/lg/on:command:ON:play-0d43b4efb79f],&gt; 
[mosquitto:broadlink/tv/room/lg/off:command:OFF:play-0d43b4efb79f]"}

```

broadlink/tv/room/lg/on  
broadlink/tv/room/lg/off

2 diffrentt commands for on/off and also need to send this “play-0d43b4efb79f” how can i do this?

thanks

---

<div class="post-metadata">

**Author:** ![vzorglub](https://community.openhab.org/user_avatar/community.openhab.org/vzorglub/32/17166_2.png) [@vzorglub](https://community.openhab.org/u/vzorglub)\
**Post date:** [December 31, 2018, 12:25am UTC](https://community.openhab.org/t/migrating-mqtt1-items-to-mqtt2-4-items/60502/24 "2018-12-31T00:25:46Z")

</div>

You can’t, not yet. The commandTopic doesn’t accept transformations yet.  
You could use the action and a rule instead

---

<div class="post-metadata">

**Author:** ![Noam\_Shaharabani](https://community.openhab.org/letter_avatar_proxy/v4/letter/n/e19adc/32.png) [@Noam\_Shaharabani](https://community.openhab.org/u/Noam_Shaharabani)\
**Post date:** [December 31, 2018, 11:25am UTC](https://community.openhab.org/t/migrating-mqtt1-items-to-mqtt2-4-items/60502/25 "2018-12-31T11:25:12Z")

</div>

I dont understand why to releaseadd-on that is not yet can replace the old one. why not to wai t until it will have full support for all the option in the mqtt1

---

<div class="post-metadata">

**Author:** ![opus](https://community.openhab.org/user_avatar/community.openhab.org/opus/32/55801_2.png) [@opus](https://community.openhab.org/u/opus)\
**Post date:** [December 31, 2018, 1:06pm UTC](https://community.openhab.org/t/migrating-mqtt1-items-to-mqtt2-4-items/60502/26 "2018-12-31T13:06:42Z")

</div>

You can continue to use the (old) mqtt1 binding. Just select to show the legacy bindings in PaperUI and install the old one again!

---

<div class="post-metadata">

**Author:** ![David\_Graeff](https://community.openhab.org/user_avatar/community.openhab.org/david_graeff/32/61322_2.png) [@David\_Graeff](https://community.openhab.org/u/David_Graeff)\
**Post date:** [December 31, 2018, 1:24pm UTC](https://community.openhab.org/t/migrating-mqtt1-items-to-mqtt2-4-items/60502/27 "2018-12-31T13:24:09Z")

</div>

> [@Noam\_Shaharabani](#):
>
> why not to wai t until it will have full support for all the option in the mqtt1

Mqtt2 is feature complete, the author which is me, was implementing transformation as they are on purpose. Some people changed my mind and outgoing transformations will come. (With a big warning of their performance impact)

---

<div class="post-metadata">

**Author:** ![Constantinos\_Contis](https://community.openhab.org/letter_avatar_proxy/v4/letter/c/e19b73/32.png) [@Constantinos\_Contis](https://community.openhab.org/u/Constantinos_Contis)\
**Post date:** [December 31, 2018, 7:31pm UTC](https://community.openhab.org/t/migrating-mqtt1-items-to-mqtt2-4-items/60502/28 "2018-12-31T19:31:40Z")

</div>

i made it 🙂 ,i have succefully migrate all my sonoff devices to mqtt2.4.Now i need a litle help with some items that use json tranformation.The item type that is working with mqtt1 is

```csv
Number:Temperature OctoprintPrinterHotEndTemp "Nozzle temp [%.1f °C]" <temperature>	(gOctoprint)	{mqtt="<[broker:octoprint/temperature/tool0:state:JSONPATH($.actual)]"}

```

i create a new generic mqtt thing ,choose broker,create number channel and in state field i put

```csv
/octoprint/temperature/tool0

```

i am not sure what to put at the input tranformation field to make it work…  
edit:nevermind ,i got it right 🙂

---

<div class="post-metadata">

**Author:** ![Sascha\_Billian](https://community.openhab.org/user_avatar/community.openhab.org/sascha_billian/32/17056_2.png) [@Sascha\_Billian](https://community.openhab.org/u/Sascha_Billian)\
**Post date:** [December 31, 2018, 10:14pm UTC](https://community.openhab.org/t/migrating-mqtt1-items-to-mqtt2-4-items/60502/29 "2018-12-31T22:14:25Z")

</div>

> [@Constantinos\_Contis](#):
>
> JSONPATH($.actual)

I’ve had the WiFi quality of my sonoff device with:

```php
JSONPATH($.Wifi.RSSI)

```

and with the new binding it looks like:

 ![image](https://community-openhab-org.s3.dualstack.eu-central-1.amazonaws.com/original/3X/3/c/3cc5bed2921c63449aab37079386380778b82bce.png)

That means, your’s should be

```php
JSONPATH:$.actual

```

---

<div class="post-metadata">

**Author:** ![Kurniss19](https://community.openhab.org/letter_avatar_proxy/v4/letter/k/ecae2f/32.png) [@Kurniss19](https://community.openhab.org/u/Kurniss19)\
**Post date:** [January 4, 2019, 1:28am UTC](https://community.openhab.org/t/migrating-mqtt1-items-to-mqtt2-4-items/60502/30 "2019-01-04T01:28:27Z")

</div>

Hi Sascha\_Billian,

Can you please assist? I have followed your instructions, but I think I might be doing something wrong. I am trying to switch rfkey1 on my sonoff tasmota flashed rf bridge with a press of a button in basic UI.

Thanks.

Thing creation  
Name: GF\_Sonoff\_RF\_Button\_1  
Bridge Selection: Mosquitto=mqtt:systemBroker:embedded-mqtt-broker

Channel  
Sonoff  
mqtt:topic:9770d4aa:sonoff  
switch

mqtt state topic: /tele.sonoff-rf/RESULT  
mqtt command topic: /cmnd/sonoff-rf/RFKEY1

NOTE: GF\_Sonoff\_RF\_Button\_1 shows ONLINE in things.

sonoff.item

Switch GF\_Sonoff\_RF\_Button\_1 "Button 1" \<none\> (GF\_Sonoff\_RF) { channel="mqtt:topic:9770d4aa:sonoff:button1", autoupdate="false"}

default.sitemap

sitemap default label="Some Place" {

Frame label="Ground Floor" icon="groundfloor" {

Group item=GF\_Sonoff\_RF {

Switch item=GF\_Sonoff\_RF\_Button\_1 label="RfKey1" mappings=[ON="Key 1"]

}

}

}

Openhab log file

2019-01-03 13:37:52.066 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item for widget org.eclipse.smarthome.model.sitemap.Switch

2019-01-03 13:37:52.070 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item ‘GF\_Sonoff\_RF\_Button\_1’ for widget org.eclipse.smarthome.model.sitemap.Switch

2019-01-03 13:37:52.070 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item ‘GF\_Sonoff\_RF\_Button\_1’ for widget org.eclipse.smarthome.model.sitemap.Switch

2019-01-03 13:37:52.074 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item ‘GF\_Sonoff\_RF\_Button\_1’ for widget org.eclipse.smarthome.model.sitemap.Switch

2019-01-03 13:37:53.406 [INFO] [rest.core.internal.item.ItemResource] - Received HTTP POST request at ‘items/GF\_Sonoff\_RF\_Button\_1’ for the unknown item ‘GF\_Sonoff\_RF\_Button\_1’.

2019-01-03 13:38:48.588 [INFO] [rest.core.internal.item.ItemResource] - Received HTTP POST request at ‘items/GF\_Sonoff\_RF\_Button\_1’ for the unknown item ‘GF\_Sonoff\_RF\_Button\_1’.

2019-01-03 13:38:49.814 [INFO] [rest.core.internal.item.ItemResource] - Received HTTP POST request at ‘items/GF\_Sonoff\_RF\_Button\_1’ for the unknown item ‘GF\_Sonoff\_RF\_Button\_1’.

---

<div class="post-metadata">

**Author:** ![Sascha\_Billian](https://community.openhab.org/user_avatar/community.openhab.org/sascha_billian/32/17056_2.png) [@Sascha\_Billian](https://community.openhab.org/u/Sascha_Billian)\
**Post date:** [January 4, 2019, 6:40am UTC](https://community.openhab.org/t/migrating-mqtt1-items-to-mqtt2-4-items/60502/31 "2019-01-04T06:40:47Z")

</div>

Your file should be called sonoff.items and not sonoff.item.

---

<div class="post-metadata">

**Author:** ![vzorglub](https://community.openhab.org/user_avatar/community.openhab.org/vzorglub/32/17166_2.png) [@vzorglub](https://community.openhab.org/u/vzorglub)\
**Post date:** [January 4, 2019, 8:53am UTC](https://community.openhab.org/t/migrating-mqtt1-items-to-mqtt2-4-items/60502/32 "2019-01-04T08:53:40Z")

</div>

> [@Kurniss19](#):
>
> mqtt state topic: /tele.sonoff-rf/RESULT  
> mqtt command topic: /cmnd/sonoff-rf/RFKEY1

Remove the leading `/`  
It should be:  
mqtt state topic: `tele/sonoff-rf/RESULT`  
mqtt command topic: `cmnd/sonoff-rf/RFKEY1`

---

<div class="post-metadata">

**Author:** ![Kurniss19](https://community.openhab.org/letter_avatar_proxy/v4/letter/k/ecae2f/32.png) [@Kurniss19](https://community.openhab.org/u/Kurniss19)\
**Post date:** [January 4, 2019, 6:01pm UTC](https://community.openhab.org/t/migrating-mqtt1-items-to-mqtt2-4-items/60502/33 "2019-01-04T18:01:54Z")

</div>

Thanks I made the changes and getting this error:  
2019-01-04 11:57:06.073 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item for widget org.eclipse.smarthome.model.sitemap.Group

2019-01-04 11:57:06.074 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item ‘GF\_Sonoff\_RF’ for widget org.eclipse.smarthome.model.sitemap.Group

2019-01-04 11:57:06.075 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item ‘GF\_Sonoff\_RF’ for widget org.eclipse.smarthome.model.sitemap.Group

2019-01-04 11:57:06.075 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item ‘GF\_Sonoff\_RF’ for widget org.eclipse.smarthome.model.sitemap.Group

2019-01-04 11:57:07.841 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item for widget org.eclipse.smarthome.model.sitemap.Group

---

<div class="post-metadata">

**Author:** ![vzorglub](https://community.openhab.org/user_avatar/community.openhab.org/vzorglub/32/17166_2.png) [@vzorglub](https://community.openhab.org/u/vzorglub)\
**Post date:** [January 4, 2019, 6:03pm UTC](https://community.openhab.org/t/migrating-mqtt1-items-to-mqtt2-4-items/60502/34 "2019-01-04T18:03:12Z")

</div>

Does the item `GF_Sonoff_RF` exist?  
Post you items file

---

<div class="post-metadata">

**Author:** ![Kurniss19](https://community.openhab.org/letter_avatar_proxy/v4/letter/k/ecae2f/32.png) [@Kurniss19](https://community.openhab.org/u/Kurniss19)\
**Post date:** [January 4, 2019, 6:09pm UTC](https://community.openhab.org/t/migrating-mqtt1-items-to-mqtt2-4-items/60502/35 "2019-01-04T18:09:01Z")

</div>

> [@Kurniss19](#):
>
> Switch GF\_Sonoff\_RF\_Button\_1 “Button 1” \<none\> (GF\_Sonoff\_RF) { channel=“mqtt:topic:9770d4aa:sonoff:button1”, autoupdate=“false”}

it is:

Switch GF\_Sonoff\_RF\_Button\_1 “Button 1” \<none\> (GF\_Sonoff\_RF) { channel=“mqtt:topic:9770d4aa:sonoff:button1”, autoupdate=“false”}

---

<div class="post-metadata">

**Author:** ![vzorglub](https://community.openhab.org/user_avatar/community.openhab.org/vzorglub/32/17166_2.png) [@vzorglub](https://community.openhab.org/u/vzorglub)\
**Post date:** [January 4, 2019, 6:15pm UTC](https://community.openhab.org/t/migrating-mqtt1-items-to-mqtt2-4-items/60502/36 "2019-01-04T18:15:39Z")

</div>

The item belongs to a group  
Where is the group?

---

<div class="post-metadata">

**Author:** ![Kurniss19](https://community.openhab.org/letter_avatar_proxy/v4/letter/k/ecae2f/32.png) [@Kurniss19](https://community.openhab.org/u/Kurniss19)\
**Post date:** [January 4, 2019, 6:21pm UTC](https://community.openhab.org/t/migrating-mqtt1-items-to-mqtt2-4-items/60502/37 "2019-01-04T18:21:29Z")

</div>

I am lost. I copied a code online and modify it to try and do a simple switching for learning. There is no group to my knowledge. How would you do a simple switching?

---

<div class="post-metadata">

**Author:** ![opus](https://community.openhab.org/user_avatar/community.openhab.org/opus/32/55801_2.png) [@opus](https://community.openhab.org/u/opus)\
**Post date:** [January 4, 2019, 6:33pm UTC](https://community.openhab.org/t/migrating-mqtt1-items-to-mqtt2-4-items/60502/38 "2019-01-04T18:33:18Z")

</div>

How about reading the [docs](https://www.openhab.org/docs/configuration/items.html#groups) about groups?

---

<div class="post-metadata">

**Author:** ![vzorglub](https://community.openhab.org/user_avatar/community.openhab.org/vzorglub/32/17166_2.png) [@vzorglub](https://community.openhab.org/u/vzorglub)\
**Post date:** [January 4, 2019, 6:45pm UTC](https://community.openhab.org/t/migrating-mqtt1-items-to-mqtt2-4-items/60502/39 "2019-01-04T18:45:35Z")

</div>

> [@Kurniss19](#):
>
> I copied a code online and modify it to try and do a simple switching for learning.

ALARM!!!  
You copied and pasted something without understanding it.  
Always copy by hand making sure you understand every bit.

The bit between brackets in your item definition is a group  
Items can belong to groups  
You either need to create a group by that name or get rid of the group in the item.  
BUT because your sitemap is looking for that group, because you just copied and pasted code, youl will need to create the group.  
So your new items file should be:

```csv
Group GF_Sonoff_RF
Switch GF_Sonoff_RF_Button_1 “Button 1” <none> (GF_Sonoff_RF) { channel=“mqtt:topic:9770d4aa:sonoff:button1”, autoupdate=“false”}

```

And please use the [code fences](https://community.openhab.org/t/how-to-use-code-fences/38383) when posting code, thanks

---

<div class="post-metadata">

**Author:** ![Kurniss19](https://community.openhab.org/letter_avatar_proxy/v4/letter/k/ecae2f/32.png) [@Kurniss19](https://community.openhab.org/u/Kurniss19)\
**Post date:** [January 4, 2019, 7:02pm UTC](https://community.openhab.org/t/migrating-mqtt1-items-to-mqtt2-4-items/60502/40 "2019-01-04T19:02:09Z")

</div>

I created the group and I am getting the same error.

[Previous page](https://community.openhab.org/t/migrating-mqtt1-items-to-mqtt2-4-items/60502.md?page=1)

[Next page](https://community.openhab.org/t/migrating-mqtt1-items-to-mqtt2-4-items/60502.md?page=3)
