Restful http-Binding in OH3

Hi all,
I’ve just realized that a transformation in OH2.5 does not work anymore as http-binding was a 1.x thing. Now i’ve seen a post that the developer works on an OH3 binding and its possible to install an v3.2 version of it.

Once i used this approach:
Number PufferState "Puffer Status [%.1f %%]" <sewerage> (MyHeating) { http="<[http://192.168.1.10:8080/user/var/120/10601/0/0/12528:600000:XSLT(eta_numeric.xsl)]",expire="1h" }

eta_numeric.xsl looks like this

<?xml version="1.0"?>
<xsl:stylesheet
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
        xmlns:eta="http://www.eta.co.at/rest/v1"
        version="1.0">
        <xsl:output indent="yes" method="xml" encoding="UTF-8" omit-xml-declaration="yes" />
        <xsl:template match="/">
                <xsl:value-of select="//eta:value div //eta:value/@scaleFactor" />
        </xsl:template>
</xsl:stylesheet>

Is there still a way to use it like this, or anyhow in OH3 another approach makes this happen way more easy? The endresult is that my heating (Linux machine) would provide the %-state of the buffer for warm water.

Thanks a lot
Norbert

I suppose you could try the (new) HTTP binding docs for guidance on Thing and channels

and see if XSLT transformation is still available

Thanks - i’ve seen these docs already but to me its like the needle in a haystack. In OH2 i found an existing solution that i could change so that my parameter works as it should. but i’m honestly totally lost how to bring what i have into whats required for OH3. I understand that now i need to have a “Thing” instead of simply adding the transformation into the item itself.

Looking at this example:

Thing http:url:foo "Foo" [
	baseURL="https://example.com/api/v1/metadata-api/web/metadata",
	headers="key1=value1", "key2=value2", "key3=value3",
	refresh=15] {
		Channels:
			Type string : text "Text" [ stateTransformation="JSONPATH:$.metadata.data" ]
}

i would believe that htto:url:NAME “NAME” + baseURL is clear…but how about headers, what to put there.Type string i guess…but what does text “Text” mean.

Thanks Norbert

You weren’t using headers before, why do you want them now?

Have you configured any Things and channels at all in OH3?
If you prefer using the GUI to set them up, that’s fine, just get started.
If you prefer doing it from a xxx.things file, you’ll have done this before anyway

Type string : text "Text" [ your channel settings ]

Type is pretty self-evident, this is you choosing the type of the channel, rather like you choose the type of an Item. Except any given binding or Thing may only support some channel types. See the docs.

text here is a name that you choose for your channel. You will need that when you come to link it to an Item. You might think pufferstate is more sensible or something.

"Text" here is just some label that you choose to put on your channel. It doesn’t really get used for anything, apart from allowing you to make sense of what you’ve done. You might label it "Heating XML" or something.

1 Like

Thanks, took me a little to bring it all together but worked first place…

image

This link helped me a little, if someone else has a similar request: OH3 Http1 to http2

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.