Transformations - Javascript

Hey guys!

I am sending a http-request and gets sensor-information back for all my pluwise-devices and then i need to call a js to extract the information i need for that particular item.

Therefore I am wondering: Is there any possibility to send an argument when calling the js?

This is my code now:

Number Circleplus_Power “Power [%.1f W]” { http ="<[http://localhost:8081/_graphview.pte?cmd=appliances&ids=,2:1000:JS(getValue.js)]" }

I want to do:
Number Circleplus_Power “Power [%.1f W]” { http ="<[http://localhost:8081/_graphview.pte?cmd=appliances&ids=,2:1000:JS(getValue.js(circleplus))]" }


As I understand it, the only argument that gets passed to your JS function is the contents of the new State. If that is not sufficient you will need to move the processing to a Rule.

If the data returned are formatted as JSON, you could instead use the JSONPATH transform, passing in the query as an argument to the transform, like


the data would have to look something like to match the above:


If the data coming back is in XML format, you could use the XSLT transform, but it, like the JS transform, can only take the name of the file, with no additional arguments allowed.

If this is a source from Plugwise, could you not use the Plugwise binding? See the wiki here.

Thanks for answering!

The Plugwise binding is to unstable for me to use…

OK, is there anything you could share that is needed to improve that binding? It was recently enhanced, and the person who enhanced it might be interested in further feedback. Thanks.

Yes, see here:

Thanks @bryeng. I assume you’ve tried the latest JAR with @wborn’s latest fixes. If so, what are the remaining instabilities that prevent your use of it? Many thanks for anything you can do to make openHAB better. :slight_smile:

It seems that on Windows the Plugwise Binding more often chokes on messages it receives from the serial port @watou. Sometimes the received messages on Windows are inconsistent. On Ubuntu serial communications are more reliable. Maybe there are issues with the Windows implementation of the serial library. Have you read/seen such issues before @watou?

Possibly; I’m not familiar with it. Another possibility could be how the library is being used. I found one issue of this sort. Another possibility, if only reported by one Windows user, is a strange hardware or OS problem (but if reported by more than one user, this is less likely).