This page last changed on May 16, 2015 by thwo.

i'm trying to have a custom state taking info from a xml file but it seems i have a syntax error.

my xml file loks like this :
<?xml version="1.0" encoding="UTF-8"?>

<relay id="10">

<relay id="11">


I've set the xpath expression to this : //relays/relay[@id='10']/@status
I've also set custom stae items to Name: On, Value: 1 and Name: Off, Value: 0.

Whatever i have in my relay status the button remains as "Off"...

Do i use the good syntax in the xpath expression?


xml.PNG (image/png)
Custom.PNG (image/png)
In the custom sensor you should map the values 0 and 1 to on off respectively, see help page for custom sensor

Posted by pz1 at May 17, 2015 08:14


if i understand what i've read
here :
here :
and here :

my xpath should be //relay[@id='10']/status or /relays/relay[@id='10']/status
Both should be working...

for the custom sensor, the custom state items should be name : off (and not "Off" ?), value : 0 - name: on (and not "On" ?), value: 1 like in this image :

But!... the swith still stays on "off" value...

Where am i wrong?

i used the command ./ run to see if i had error messages but the only ones where like this : /home/pi/Desktop/OpenRemote-Controller-2.0.0/logs/catalina.2015-05-17.log (Permission non accordée) /home/pi/Desktop/OpenRemote-Controller-2.0.0/logs/localhost.2015-05-17.log (Permission non accordée) ../logs/dev/dev.log (Permission non accordée)
log4j:ERROR setFile(null,true) call failed. ../logs/dev/dev.log (Permission non accordée)

and startup ended with this

INFO 2015-05-17 08:51:32,510 :




INFO 2015-05-17 08:51:33,504 : No rule definitions found in '/home/pi/Desktop/OpenRemote-Controller-2.0.0/webapps/controller/rules'.
INFO 2015-05-17 08:51:33,505 : Initialized event processor : Drools Rule Engine
INFO 2015-05-17 08:51:33,693 : Registered sensor : Sensor (Name = 'Sensor Lumière Buanderie', ID = '106975896', State Mappings:

Unknown macro: {1=on, 0=off}
INFO 2015-05-17 08:51:33,713 : Startup complete.
INFO 2015-05-17 08:51:33,722 : Controller Definition File Watcher for Default Deployer started.
mai 17, 2015 8:51:36 AM org.apache.coyote.http11.Http11Protocol start
INFOS: D�marrage de Coyote HTTP/1.1 sur http-8080
mai 17, 2015 8:51:36 AM org.apache.catalina.startup.Catalina start
INFOS: Server startup in 13906 ms

Posted by thwo at May 17, 2015 09:59

Your XPath should be:


You can always test your XPath.

Posted by aktur at May 17, 2015 12:35

my xpath should be //relay[@id='10']/status or /relays/relay[@id='10']/status
Both should be working...

Imho both your expressions are correct. I did not make the the switch, but if I specify http command and the custom sensor as depicted on the right (click to enlarge), I do see on in the label I defined on my screen.

So I quess that should work for the binary switch status

Posted by pz1 at May 17, 2015 14:27


thanks to both of you!

What was wrong : 1 / 0 in place of "1" / "0" and i had left the http method blank.

Both /relays/relay[@id='10']/status and /relays/relay[@id='10']/status/text() are working...

Thanks also for the xpath testing link


Posted by thwo at May 17, 2015 16:44
Document generated by Confluence on Jun 05, 2016 09:33