Migrating MQTT1 items to MQTT2.4 items

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.

Please post your complete item definition.

1 Like

rfgroup.items

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

sonoff.items

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

log

2019-01-04 22:28:33.904 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item for widget org.eclipse.smarthome.model.sitemap.Group
2019-01-04 22:28:33.904 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item 'GF_Sonoff_RF' for widget org.eclipse.smarthome.model.sitemap.Group
2019-01-04 22:28:33.912 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item 'GF_Sonoff_RF' for widget org.eclipse.smarthome.model.sitemap.Group
2019-01-04 22:28:33.912 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item 'GF_Sonoff_RF' for widget org.eclipse.smarthome.model.sitemap.Group
2019-01-04 22:28:36.301 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item for widget org.eclipse.smarthome.model.sitemap.Group

Thank you all for the inputs.

You should only define your item once, now you have the same item in two different files. Then, since you apparently copy pasted the item definition from the forum instead of typing it yourself, like @vzorglub said, the quotation-marks are wrong. If you look in your log at the time you saved your file it would have warned about validation issues. If something is wrong with the syntax in a file, none of the items in that file gets created.

How do you edit your files? I would recommend using VScode with the OpenHAB plugin, then these errors can be detected easily.

1 Like

Thanks for your quick ‘how too’ I decided to revert back to the ‘old’ binding. Seemed more straightforward and simpler

Thanks for the feedback. I was using notepad now I am using vscode. I correct the errors but now in the basic UI I am seeing KEY1 instead of a button. Any suggestions?

I’m totally unclear what that means.
Are you seing the text KEY1 instead of the text BUTTON 1?
Please post your sitemap. Since you can override labels in the sitemap it could be that the cause lies in here.
And also please post a screenshot of what you currently see in your sitemap

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"]

}

}

}

You mapped ON to show “Key 1”!, delete the mapping and it will show ON!

Thanks. I am seeing the buton now but unable to command rfkey1 to the sonoff. My mqtt command topic is cmnd/sonoff-rf/RFKEY1

Use mqtt.fx to check if the correct MQTT payload is sent to the broker. Do the logs show any error?

Thanks, great help!

Will this also include JavaScript transformations (incoming & outgoing)?

Thank you Sascha_Billian.
I’ve searched for a whole day to how te setup mqtt in openhab2 and everithing is to version 1.
Now i have working sonoff swith :slight_smile:

But can somebody help me what to add here or change to have my switch to know when it’s turned on by RF Pilot or the hardware button?