OH3 XPath

The contents of the file


I want to parse is

 <?xml version="1.0" encoding="UTF-8"?>
 <os version="1uild r11643" revision="11643" starttime="2021-01-12T09:25:12+0100" uptime="4570" readonly="0">
	<reader label="smr" status="CARDOK" cadid="123">

I want to check whether the status of reader is CARDOK.

According to OH3 XPath - #3 by garyfree
I created in Main a thing named URL1 with base url


with channel


and State transformation


as in my OH 2.5 case.

However, this generates an Error:

The transformation pattern must consist of the type and the pattern separated by a colon

This is where I am stuck.

The transformation field must include the name of the transformation you’re trying to use - openHAB doesn’t try to guess, because there’s too many!



though be warned that I don’t use this transform so don’t know the proper syntax.

Thank you. For clarity, I have described my problem in a more detailed manner.

I will check your proposal this eveneing. Thanks!

@hafniumzinc : Success. Thank you very much for your valuable hint!!!

  1. I had to delete user:pw from base url and transfer this information to the advanced options of the thing. I use basic authentication.
  2. In linked item, I used profile XPATH and Xpath expression //reader/@status. This seems to be equivalent to your proposal “XPATH://reader/@status”.

It is fine for me to achieve this by using the new main ui.
Can I achieve this as well using the textual way? Formerly, one line of code was sufficient like this
String MyStatus “Status [%s]” {http="<[http://user:pw@]"}

Yes. Show us the YAML for your Thing and we can help convert. But bear in mind that you will have to edit two files: an Items file and a Things file. It’s not all in a single Item line anymore!

This is thing’s code:
UID: http:url:011692df79
label: URL_Easy
thingTypeUID: http:url
authMode: BASIC
ignoreSSLErrors: false
password: client1
refresh: 30
commandMethod: GET
timeout: 3000
username: client1
bufferSize: 2048

  • id: URLEasy
    channelTypeUID: http:string
    label: URL Easy
    description: “”
    stateTransformation: XPATH://reader/@status

Something like the following might work:

Thing http:url:URL_Easy "URL_Easy" [
	baseURL = "",
	refresh = "30",
	ignoreSSLErrors = "false",
	username = "client1",
	password = "client1"
		Type string : URLEasy "URL Easy" [
			mode = "READONLY",
			stateTransformation = "XPATH://reader/@status"

Your Item then becomes:

String MyStatus "Status [%s]" { channel="http:url:URL_Easy:URLEasy" }


First, to double check did you install the Xpath Transformation Service?