I’ve openHab 2.4 , with embedded mqtt broker, I’ve a basic sonoff with tasmota firmware .
the sonoff mqtt topic is “sonoff1”
I’ve created the channel via paper ui with :
MQTT state topic: tele/sonoff1/STATE
MQTT command topic: cmnd/sonoff1/POWER
everything works fine till now, the sonoff1 item is working fine
but when I tried to add the item via ssh to the my.items , I could not struct the syntax !
I just want to add the mqtt item in the my.items file.
this where I stopped in my.items file
Switch Sonoff1 “Sonoff 1” [ “Switchable” ]
No, I told you earlier. I will not work.
You asked if you could use that syntax and I said no and you used it anyway.
If you don’t follow my advice, it will not work.
You need to use the channel syntax
sorry I did not mean to upset you.
thanks your advice is great.
is there anyway to create the channel via coding not paper ui ?
I just need to keep my setup in code, that is easier for me to make duplicates openhab setups
And Vincent provided an example in his first reply for how to link a Channel to an Item.
There are tons of examples on the forum. The original developer (and others including myself) recommend against manually defining Things in .things files. People who do so, especially those who don’t yet have a lot of experience with OH, end up having a ton of problems getting the syntax right.
When you do stuff in PaperUI it gets saved to a JSON formatted text file that you can copy to other OH setups just as easily as you can with .items and .things files.