Configuring channels from OH2bindings

Tags: #<Tag:0x00007fe746e38b88> #<Tag:0x00007fe746e38890> #<Tag:0x00007fe746e38638>

I’m using a OH2 v2 binding

I like to configure my OH2 via textfiles and so I did configure the SML Meter Binding as follows:

Thing:

smlreader:meter:BinderPower		[port="/dev/ttyUSB0", refresh=20]

Items

Number 		Sensoren_Status_Strom		"Stromzählerstand [%.1f kwh]"	(gEnergie)		{ channel="smlreader:meter:BinderPower:1-0#1-8-0",conversionRatio="1000" }

Everything works fine - except the value of channel="smlreader:meter:BinderPower:1-0#1-8-0", is 1000times higher than the exact value. For this @msteigenberger added an attribute “conversionRatio” to the channel, which can be set via PaperUI:

how is the correct Syntax in a .items file to configure the channel for it? { channel="smlreader:meter:BinderPower:1-0#1-8-0",conversionRatio="1000" } doesn’t work, { channel="smlreader:meter:BinderPower:1-0#1-8-0,conversionRatio=1000" } either…

I’m pretty sure this parameter belongs to the channel, and thus is configured in .things, not in .items. Try to find out the correct spelling:

  1. auto discover thing (maybe this is not needed…)
  2. set up channel through Paper UI
  3. lookup configuration through REST API documentation
  4. delete channel configuration (and thing)
  5. set up thing and channel through things.

I guess, it’s something like

smlreader:meter:BinderPower		[port="/dev/ttyUSB0", refresh=20] {
    Channels:
        Type number : 1-0#1.8.0 [
            conversionratio=1000
        ]
    }

The Type is given through the channelTypeUID and the correct spelling should be given under “configuration”

Take a look at astro binding, which is well documented in question of manual thing definition, including configuration of channels)

Thanks Udo,

Looks like this is the right direction… But unfortunately it breaks at the Input for the right channel:

This is the channel with PaperUI configuration:
image

Thing is, if I try to us something as channel selector as you provided, I get ERRORs:

2017-09-26 16:44:41.316 [WARN ] [el.core.internal.ModelRepositoryImpl] - Configuration model 'powermeter.things' has errors, therefore ignoring it: [5,14]: mismatched input 'Number' expecting RULE_ID
[5,28]: mismatched input '.' expecting '}'
[5,29]: no viable alternative at input '8'
[5,31]: no viable alternative at input '0'
[6,13]: no viable alternative at input 'conversionRatio'
[6,29]: no viable alternative at input '1000'

This error is always the same, regardless, what I type in after “Type”, e.g.

smlreader:meter:BinderPower		[port="/dev/ttyUSB0", refresh=20] {
    Channels:
        Type Id : 1-0#1.8.0 [
            conversionRatio=1000
        ]
    }

It also throws ERRORs, if I try one of These:

  • Type id : “1.0#1.8.0” [
  • Type id : ‘1.0#1.8.0’ [
  • Type id : 1.0\1.8.0 [

Some other things, I could try?

i I try

smlreader:meter:BinderPower		[port="/dev/ttyUSB0", refresh=20] {
    Channels:
        Type uid : "smlreader:meter:BinderPower:1-0#1-8-0" [
            conversionRatio=1000
        ]
    }

I get

2017-09-26 16:50:25.809 [WARN ] [el.core.internal.ModelRepositoryImpl] - Configuration model 'powermeter.things' has errors, therefore ignoring it: [5,20]: missing RULE_ID at '"smlreader:meter:BinderPower:1-0#1-8-0"'

Type should be NumberChannel, so please try

smlreader:meter:BinderPower		[port="/dev/ttyUSB0", refresh=20] {
    Channels:
        Type NumberChannel : 1-0#1.8.0 [
            conversionRatio=1000
        ]
    }

Thanks for your help, Udo,

Where do you get that “NumberChannel” from? I didn’t see something like that…?

but unfortunately:

2017-09-26 17:57:31.977 [WARN ] [el.core.internal.ModelRepositoryImpl] - Configuration model 'powermeter.things' has errors, therefore ignoring it: [5,35]: mismatched input '.' expecting '}'
[5,36]: no viable alternative at input '8'
[5,38]: no viable alternative at input '0'
[6,13]: no viable alternative at input 'conversionRatio'
[6,29]: no viable alternative at input '1000'

I’m not sure, if the “#” in the value is the cause of this? but escaping it like # didn’t help either:

2017-09-26 17:58:29.508 [WARN ] [el.core.internal.ModelRepositoryImpl] - Configuration model 'powermeter.things' has errors, therefore ignoring it: [5,33]: mismatched input '\' expecting '}'
[5,35]: no viable alternative at input '1'
[5,37]: no viable alternative at input '8'
[5,39]: no viable alternative at input '0'
[6,13]: no viable alternative at input 'conversionRatio'
[6,29]: no viable alternative at input '1000'

ops, my mistake, (copy-paste…)

smlreader:meter:BinderPower		[port="/dev/ttyUSB0", refresh=20] {
    Channels:
        Type NumberChannel : 1-0#1-8-0 [
            conversionRatio=1000
        ]
    }

Take a look at your picture, Line 7 is

"channelTypeUID": "smlreader:NumberChannel",

The first part of that is to be omitted, so the Type should be NumberChannel
Of course I should have written the correct id (with - instead of .) :wink: at first place…

1 Like

Thanks Udo! You’re my hero of the day! :wink:

Now it worked! Thanks!

Hi @Udo_Hartmann, also many thanks from my side. Do you know whether there is some documentation regarding channel configuration in things File?

BR,
Matthias

Not yet… the only binding that I’m aware of any documentation in question of channels, is the astro binding. all other stuff is investigation :wink:

It’s a shame, my english is not really good enough to write documentations, the only thing I can do is to add some pennies.