My guess is the first thing you are missing and not understand is the thing that represents the broker connection. It needs to be created as a bridge and all things representing the items should connect to it.
As you have already installed the embedded broker you should use it. I haven’t used it, so my example migth have a problem on that point. You need to set your correct IP for the host of this broker ( since it is the embedded one, the IP of the system your openhab instance is running on). The name “myUnsecureBroker” can be set differently!
The sonoff is represented by “mything” ( again you can set an own name). The device has two channels ( a switch called lamp and a string called Version).
Since you configured your sonoff non-standard, I am not sure on the state- and commandTopics, the “/Lights” might not be needed.
Save this in a .things file in the things directory, you need to restart openhab ( that is a known bug, already solved in the snapshot version).
Use PaperUI to see the correct channel definition which is needed in the items file ( within the { } after “channel=”. You can copy the syntax on PaperUI.
Let’s see how far you are getting with this.
??? I hope you did not miss understand me. Your question could be answered by anybody at any time, however I had to finish another task before writing back to you.
[Edit:] Missed the word “Bridge” in the .thing file example!!
i recommend Node-red , i am also a noob i was not able to understand MQTT till I have seen it work with Node red, also you will find tons of benefits, i still use OH as my Hub, but node-red give me a powerful rule engine, that can perform complex tasks on is own, for example, i use it to send my IOS notifications
i am a big fan of node red , i think its the best way for non-programmers to get some real work done
@opus I have the bridge up and running, at least that’s my understanding from the MQTTfx readouts when I toggle the switch, both manually and via the Sonoff WebUI - see screenshot below:
In order to get the version info you need to send the …Status2 and not …/Result!
Your syntax for the item is again like version1 and therefor false.
Go into PaperUI and expand the thing representing this sonoff switch, under the channel the correct and only syntax is shown which you need to paste in the curly brackets behind “channel=”.
You see the three channels ( 2 switches!), underneath the bold type the channel is printed which can easily copied by the symbol behind it.
Paste that into one of your items like .....{channel="mqtt:topic:opusMQTT:sonoff_Dual_Thing:Version"}
The error shown points to the sonoff.items file containing “mqtt<systembroker” , the “<” is in question.
Please post the contents of that file.
Additionally, you did have the embedded broker with your first post. Only if the broker thing (I named it “myUnsecureBroker”) is online we are one step further!
Looking good so far, PaperUI shows the Thing and shows that the channels are connnected to items (the dot is filled).
Is your broker Thing online as well?
Then there is something wrong in the .things file!
Please post what you actually have. Could you make&post screenshots of the MQTT messages sent by openhab when switching either switch?
Do you have the simple mode ON? That way each channel is linked with an automatically created item. That would explain the two switches!
I find this highly confusing. If everything is setup via textual files, simple mode should be off. Otherwise it will create invisible items for every Thing Channel you add in your text file. And I do not understand why text files and UI is mixed here.
You can perfectly setup everything in GUI first, test if it works and still convert it back to text files if you for whatever reason prefer those.
There’s so much information out there I have been trying to make sense of that I have ended up with a mix of text based and GUI-based set up/configuration. Clearly it has made things more complicated than anything else.
@David_Graeff:
I knew you would be picking on the textual file setup. My reasoning was: User seemed lost in between, so I let him decide which way!
concerning the “Simple Mode”, so far I’m guessing it is on, I would and will suggestion switching it OFF as well!
I am confused again. Shouldn’t the commandTopic point back to the topic of the Sonoff device? So the “Lights/TVLights1/POWER” vs “Lights/TVLight1/POWER”