HTTP xml transformations


I made the switch to OH 3, I find it easier to work with but there is still some what of a learning curve.

Setting up the HTTP binding to get the state of my Ethernet Io-board was quite strait forward.
However the way the binding and its channels are setup, every channel does its own http call to refresh.
Now it is possible to simply setup 32 channels have them all receive the full state and then each get their single value out of it. But that would probably hammer the Ethernet IOboard and cause more of a load on my OH3 machine.

So what I would prefer to do is setup channels for all the commands but only have one channel for reading the state.
It is however unclear to me how I would take my one xml state item and transform / distribute its data to a set of objects in OH3.

for OH2 there are some examples of how to do this but the example does not translate well to OH3.

Do you know this for a fact? I was under the impression that the Thing itself makes the call, and all the Channels take data from the cached response, unless the Channels themselves modify the URL.

That is indeed how I expected it to work.
Though I don’t see that being an option in the configuration.
There is however a lot of implicit stuff going on which the documentation doesn’t elaborate on so I will go do some experimenting.

Implementations details are never covered in user documentation.

Well with wireshark I turns out it does contrary to what the configuration leads once to believe only gather the state once.

However now I think I know what the configuration fields do there is just no documentation as to how to make them do just that.
Where are the examples of how to configure these transformations?
It is now not actually putting the command value in because it needs a transformation.
Sure there is a certain cleverness to it but having things happen implicitly also means it’s hard to follow when you get it wrong.

What is the magic souse needed in order to get that state that the thing is retrieving into its channels?

Yes this is all very basic stuff indeed but it is not documented.

Ok so in the command url extension you need to use “%2$s” to reference the command value.
And that makes the command go out as expected.
The binding is smart enough to notice you used an ampersand so it wont add a slash. This is clever but also confusing.

Still have to figure out How the xml is supposed to be translated into the state of individual channels.

What else do you need? The documentation of the transformations itself can be consulted on how they need to be configured.

Well for starters there is an error in the documentation since there is tells you to use “%2$” (instead of “%2$s”) which result in a failed conversion and the message not going out.
It also does not mention what fields actually do just what they are.

Now admittedly working in software for over a decade thought me that documenting is no easy feat.
It is just that in most cases simply googling your problem is more useful than reading the official documentation. We all say RTFM assuming it is in there, because why would it not be.

These forums are more educational than the documentation.

No, documentation is correct, it‘s mentioned that you need to add the format after that.

After the parameter reference the format needs to be appended. See the link above for more information about the available format parameters (e.g. to use the string representation, you need to append s to the reference).

You are indeed correct it does mention it needs to be appended.

Of course my brain skipped over that part since “aha found it”, but not quite.
Yes it is all there and once you figured out how it works you understand what the documentation meant.
It assumes you are already knowledgeable of OpenHab. Though really I am just mucking about in my spare-time hoping it will turn out useful.
I guess what I was looking for is a tutorial.

I also forgot to install the xpath transformation. You kinda need that when talking xml.
Now nothing in the gui tells you something is wrong. And when looking at the logging you need to already know that when it says it cannot find the transformation path, what it means is “You forgot to install the transformation you want to use.”.