[SOLVED] MQTT double item error

I have a question regarding MQTT. The MQTT1 manual says Every item is allowed to have multiple inbound (or outbound) configurations.
Is this also the case for non MQTT configs.
I have a switch that is configured via a different add-on and also want to send out an MQTT message when the state changes and have the switch switch when an MQTT command is received.

The configuration seems to work but I get an error in the log files. So I was wondering if the below configuration is allowed and if not how to link 1 switch to the MQTT binding as well as another binding.

My items file lines are these:

Switch NB_S1_O5_lichtbureauzij “Bureau zij” <light> (gLichtBeneden) [ “Lighting” ] {nikobus=“09B9:5”}
Switch NB_S1_O5_lichtbureauzij {mqtt=“>[synology:openhab/light/bureauzij:state:*:${state}],<[synology:openhab/light/bureauzij/switch:command:default”}

==> /logs/openhab.log <==

2019-01-15 07:15:43.612 [INFO ] [el.core.internal.ModelRepositoryImpl] - Validation issues found in configuration model ‘nikobus.items’, using it anyway:
Duplicate ModelItem ‘NB_S1_O5_lichtbureauzij’
Duplicate ModelItem ‘NB_S1_O5_lichtbureauzij’

You need to comma seperate this as you cannot have two items with the same name:

Switch NB_S1_O5_lichtbureauzij "Bureau zij" <light> (gLichtBeneden) [ "Lighting" ] {nikobus="09B9:5",mqtt=">[synology:openhab/light/bureauzij:state:*:${state}],<[synology:openhab/light/bureauzij/switch:command:default"}

Thanks, that makes a lot of sense (and I should have thought about that myself :disappointed:)

@sihui another question, how would that look in MQTT 2 format. Eventually I will have to migrate to MQTT2 format which looks something like this

Bridge mqtt:broker:myUnsecureBroker [ host="x.x.x.x", secure=false ]
{
    Thing mqtt:topic:mything {
    Channels:
        Type switch : NB_S1_O5_lichtbureauzij "Bureau zij" [ stateTopic="openhab/light/bureauzij", commandTopic="openhab/light/bureauzij/switch" ]        
    }
}

But how do I combine that with the Nikobus binding syntax? I can’t just merge them with a comma.

Switch NB_S1_O5_lichtbureauzij “Bureau zij” <light> (gLichtBeneden) [ “Lighting” ] {nikobus=“09B9:5”}

Can’t help with text files, I’m using PaperUI for the new MQTT2 binding :wink:

:slight_smile: yes I know I’m old fashioned

@David_Graeff you have any idea. I want to link the same switch to MQTT as well as the Nikobus binding. In the MQTT v1 it was just a matter of seperating them with a comma but how would such thing look in MQTT2?

So it would be replacing

Switch NB_S1_O5_lichtbureauzij "Bureau zij" &lt;light&gt; (gLichtBeneden) [ "Lighting" ] {nikobus="09B9:5",mqtt="&gt;[synology:openhab/light/bureauzij:state:*:${state}],&lt;[synology:openhab/light/bureauzij/switch:command:default"}

in a format like

Bridge mqtt:broker:myUnsecureBroker [ host="x.x.x.x", secure=false ]
{
    Thing mqtt:topic:mything {
    Channels:
        Type switch : NB_S1_O5_lichtbureauzij "Bureau zij" [ stateTopic="openhab/light/bureauzij", commandTopic="openhab/light/bureauzij/switch" ]        
    }
}

So how so I add the Nikobus bit

Switch NB_S1_O5_lichtbureauzij “Bureau zij” &lt;light&gt; (gLichtBeneden) [ “Lighting” ] {nikobus=“09B9:5”}

to the MQTT2 configuration

If you go to the paperUI you will see your text file created thing, select it and you should see the channel name copy that and do this:

Switch NB_S1_O5_lichtbureauzij "Bureau zij" <light> (gLichtBeneden) [ "Lighting" ] { nikobus="09B9:5", channel="mqttchannel" }

I will try tonight but I’m not sure there is something like things and channels for OH1 items.
The Nikobus binding is an OH1 binding, so items have to be created in config files.

There are no such things as OH1 items. There are OH1 bindings…
You can combine 2 or more bindings with one item.
You can add the channel="dsfsada" in an item file just as you used to do with the OH1 syntax.