Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » Eclipse SmartHome » Extra information in config XML files
Extra information in config XML files [message #1745276] Fri, 07 October 2016 08:20 Go to next message
Pascal Krahmer is currently offline Pascal KrahmerFriend
Messages: 3
Registered: October 2016
Junior Member
Good morning,

Note: I posted this on the OpenHab forum first but then noticed this would rather be a question ESH core functionality. Apologize for the double-posting.

I'm developing an OpenHAB 2 binding that enables us to use some specific advanced Modbus devices. In this scenario each Modbus device can provide any number of different things. Different devices have different capabilities and therefore provide a different set of things. Thus, the modbus node itself will be configured as a bridge that offers access a set of things.

As Modbus is a register based protocol, each thing has a set of modbus registers for configuration values, current status and to commit actions. What I want to do first is to create a configuration for each available thing that maps the configuration registers to OpenHab thing configuration.

For this I need to be able to specify some extra attributes to a parameter (e.g. modbus register). These attributes would be read by the Java implementation of the thing. From what I can find the configuration schemas do not support this. For example this could look like this:

    <parameter name="portNumber" type="integer" required="true">
        <label>Port Number</label>
        <description>Port on the device this thing is using.</description>
        <default>1</default>
        <advanced>true</advanced>

        <attribute name="modbusRegister">120</attribute>
        <attribute name="modbusRegisterMode">relative</attribute>

    </parameter>


Does anyone have an idea how to accomplish this using the currently available functionality? If not, what are your thoughts about extending the configuration schema to allow name-value attributes?

Thanks,

Pascal
Re: Extra information in config XML files [message #1745396 is a reply to message #1745276] Mon, 10 October 2016 10:01 Go to previous messageGo to next message
Kai Kreuzer is currently offline Kai KreuzerFriend
Messages: 673
Registered: December 2011
Senior Member
> Apologize for the double-posting.

You know have to live with answers on both threads Wink (You might have better directly closed the one on the openHAB forum to avoid this...).

I am not sure if I understand why modbusRegister and modbusRegisterMode cannot simply be additional parameters besides portNumber? How would you expect a Thing (in a *.things file) to be configured following your "attribute" suggestion?

Regards,
Kai
Re: Extra information in config XML files [message #1745441 is a reply to message #1745396] Mon, 10 October 2016 18:08 Go to previous messageGo to next message
Pascal Krahmer is currently offline Pascal KrahmerFriend
Messages: 3
Registered: October 2016
Junior Member
Kai Kreuzer wrote on Mon, 10 October 2016 10:01

You know have to live with answers on both threads Wink (You might have better directly closed the one on the openHAB forum to avoid this...).


You live and learn. Will know it better next time. Wink

Kai Kreuzer wrote on Mon, 10 October 2016 10:01

I am not sure if I understand why modbusRegister and modbusRegisterMode cannot simply be additional parameters besides portNumber? How would you expect a Thing (in a *.things file) to be configured following your "attribute" suggestion?


I've got a set of device types that are modbus enabled. Modbus is a register based protocol enabling you to read and write values from/to registers that are identified by a register address number. Each device type however has its own register set and function mapping. So I need some kind of meta data to map human readable configuration parameters to the registers.

What I'm trying to accomplish is to develop a (fairly abstract) modbus binding responsible for the protocol handling only. For each device type I will then just create a thing in a *.things. The device thing contains a config parameter or channel for each register I want to use.
You are right, it would work to add additional parameters to specify the register address for each configuration parameter. But: Register addresses are constant values. Including them as read-only parameter really blow up the configuration screen.

Anyway, since there is not much response I guess I've got a special scenario. So far I learnt only ZWave had such a requirement before. I understand that it does not make much sense to add complexity to the system just for exceptional use.

Edit: In my example "portNumber" is the human readable name of the value I want to write into the modbus register 120.

[Updated on: Mon, 10 October 2016 18:11]

Report message to a moderator

Re: Extra information in config XML files [message #1745469 is a reply to message #1745441] Tue, 11 October 2016 09:54 Go to previous messageGo to next message
Kai Kreuzer is currently offline Kai KreuzerFriend
Messages: 673
Registered: December 2011
Senior Member
> But: Register addresses are constant values. Including them as read-only parameter really blow up the configuration screen.

There was a very similar discussion at https://github.com/openhab/org.openhab.binding.zwave/issues/153#issuecomment-251914021.
Note that from a handler perspective, ALL configuration parameters are more or less static. The IP address of a device is a static information that the handler requires to access the right device. Similarly, the register id is a static information that the handler requires to access the right device. It is imho exactly the same case.

> Including them as read-only parameter really blow up the configuration screen.

If this is the REAL problem, we should look at this one. Did you e.g. know that you can flag config parameters as "advanced", which will make the UI hide them by default?
Re: Extra information in config XML files [message #1745474 is a reply to message #1745469] Tue, 11 October 2016 10:53 Go to previous message
Pascal Krahmer is currently offline Pascal KrahmerFriend
Messages: 3
Registered: October 2016
Junior Member
From the references thread:
Kai Kreuzer
> I can only repeat myself: configuration parameters are the configuration of the handler to work and not of the end device.


It realize I misunderstood how OpenHABs expects us to use of configuration parameters. I thought I could use the existing GUI functionality to configure the devices themselves. Instead I will do the configuration tasks out of openHab and just trigger/react on events within the OpenHAB handler.
Previous Topic:ThingImpl cannot be cast to org.eclipse.smarthome.core.thing.Bridge
Next Topic:Dynamic Creation and Disposal of Channels
Goto Forum:
  


Current Time: Tue Apr 23 06:15:00 GMT 2024

Powered by FUDForum. Page generated in 0.03397 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top