Migrating MQTT1 items to MQTT2.4 items

mqtt-binding
Tags: #<Tag:0x00007fe06356a248>

(Vincent Regaud) #34

Does the item GF_Sonoff_RF exist?
Post you items file


(4KAUTO) #35

it is:

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


(Vincent Regaud) #36

The item belongs to a group
Where is the group?


(4KAUTO) #37

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?


(Jürgen Baginski) #38

How about reading the docs about groups?


(Vincent Regaud) #39

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


(4KAUTO) #40

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


(Sascha Billian) #41

Please post your complete item definition.


(4KAUTO) #42

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.


(Anders Alfredsson) #43

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.


(Kees Van Gelder) #44

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


(4KAUTO) #45

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?


(Sascha Billian) #46

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


(4KAUTO) #47

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

}

}

}

(Jürgen Baginski) #48

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


(4KAUTO) #49

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


(Sascha Billian) #50

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


(Martin Mailloux) #51

Thanks, great help!


(Joachim Boeddeker) #52

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


(Kaju666) #53

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?