Migrating MQTT1 items to MQTT2.4 items

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

Switch Item_Name "Label" { channel="mqtt:topic:topic_name:channel", autoupdate="false" }
2 Likes

Didn’t try that :blush:
Thanks a lot!

hello

if i have this

{ autoupdate="false", mqtt="> 
[mosquitto:broadlink/tv/room/lg/on:command:ON:play-0d43b4efb79f],> 
[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

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

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

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

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)

i made it :slight_smile: ,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

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

/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 :slight_smile:

1 Like

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

JSONPATH($.Wifi.RSSI)

and with the new binding it looks like:

That means, your’s should be

JSONPATH:$.actual
2 Likes

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’.

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

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

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

Does the item GF_Sonoff_RF exist?
Post you items file

it is:

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

The item belongs to a group
Where is the group?

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?

How about reading the docs about groups?

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:

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 when posting code, thanks

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