LCN2: Adding Things without discovery?

Hi @fwolter,
hello community

@fwolter: Thank you so much for re-implementing the LCN binding! This is really awesome…

In preperation to be ready for OH3, I start to migrate my LCN1 configuration to LCN2. I prefer to keep everything in config-files without using PaperUI/HabAdmin… Now, I stuck in the process.

This is my setup:
Raspi 4, Jessy, with Openhab 2.5.9

I was able to connect to my LCN-Interface (lcnpchk 2.8) within my lcn2.thing file:

Bridge lcn:pckGateway:HomeBusName "MyLCNSystem"  [ hostname = "XXX.XXX.XXX.XXX", port = 4114, username = "USER", password = "PWD", mode = "native200", timeoutMs = 3500 ] { }

This works, but I’m not sure, if syntax is right/appropiate.

Now, I start to define Items as described in the LCN-binding documentation:

Dimmer lcnLightKitchen  {channel="lcn:module:HomeBusName:S000M123:output#1"[profile="lcn:output", controlOutputs12=true]} 

But this does not work. The only way to make it work is to use the discovery function, add the Thing (module) via PaperUI and then use the definition for lcnLightKitchen.

Is this intended, to add LCN-Things via any UI? Or is it possible to define those things only in config-files.

Once, again. Thanks for that upgrade :slight_smile:

Best wishes

Did you add an LCN module Thing with the Thing ID HomeBusName:S000M123 via a .things file?

Indeed, no. I used a .items file to define the item + channel, as described in your documentation. So, I assume I missed the thing file?
Can you give me an example, how to define the lcn-thing?

My understanding is that you need to discover everything then use that channel from the thing in the items file

As @denominator mentioned, the easiest way is to add Bridges (PCK Gateway) and Things (LCN Module) via discovery and do the Item configuration via the .items files.

If you want to configure Things via .things files, for whatever reason, you could do something like this:

Bridge lcn:pckGateway:HomeBusName "MyLCNSystem"  [ hostname = "XXX.XXX.XXX.XXX", port = 4114, username = "USER", password = "PWD", mode = "native200", timeoutMs = 3500 ] {
	Thing module S000M123 "Module 123" @ "My Location" [ moduleId=123, segmentId=0 ]
}

thanks for answers.

@fwolter. Great. This works flawless. :-). Imho, this would make sense to put this into your documentation as well…

Now I can start to re-configure my LCN-Openhab config.

1 Like

@fwolter, I tried your approach but this gave me tons of these errors in the OH log:

> Provide a thing type ID and a thing ID in this format:
>  <thingTypeId> <thingId>

I think you are not required to reference the bridge if a thing is defined within the curly braces of the bridge definition. I could get rid of the error messages by using the following schema to define my modules as things:

Bridge lcn:pckGateway:HomeBusName "MyLCNSystem"  [ hostname = "XXX.XXX.XXX.XXX", port = 4114, username = "USER", password = "PWD", mode = "native200", timeoutMs = 3500 ] {
	Thing module S000M123 "Module 123" @ "My Location" [ moduleId=123, segmentId=0 ]
}

I have changed Thing module S000M123 to Thing lcn:module:HomeBusName:S000M123. With that, the log messages are gone.

Just to be sure, you meant, you have changed Thing lcn:module:HomeBusName:S000M123 to Thing module S000M123 not vice versa, as you wrote. If you confirm, I will edit my post.

Sorry for the confusion. Indeed, I have changed the definition like you wrote in your last post.

Wrong: Thing lcn:module:HomeBusName:S000M123
Correct: Thing module S000M123