Hi
I am creating a sitemap where a Text item has to show the status of an alarm contact received via MQTT
Messages are like this
{"TYPE": "ZON", "A": "N", "STA": "R"}
The sitemap definition using only JSONPATH works well.
Then I have introduced a map file named “statizone.map” placed under the usual /transform folder:
A=ALLARME
R=RIPOSO
Then I configured the sitemap like this
sitemap alarmapp label="Alarm App Test" {
Frame label="Zone" {
Text item=zona_5 label="Zona 5 [JSONPATH($.STA)∩MAP(statizone.map):%s]"
}
}
With this mapping i get exceptions in the log file: looks like the chained mappings are not parsed well by the interpreter.
org.eclipse.smarthome.core.transform.TransformationException: An error occurred while transforming JSON expression.
at org.openhab.transform.jsonpath.internal.JSonPathTransformationService.transform(JSonPathTransformationService.java:75) ~[?:?]
at org.eclipse.smarthome.ui.internal.items.ItemUIRegistryImpl.transform(ItemUIRegistryImpl.java:537) [bundleFile:?]
at org.eclipse.smarthome.ui.internal.items.ItemUIRegistryImpl.getLabel(ItemUIRegistryImpl.java:449) [bundleFile:?]
at org.eclipse.smarthome.io.rest.sitemap.internal.PageChangeListener.constructSitemapEvents(PageChangeListener.java:228) [bundleFile:?]
at org.eclipse.smarthome.io.rest.sitemap.internal.PageChangeListener.constructSitemapEvents(PageChangeListener.java:214) [bundleFile:?]
at org.eclipse.smarthome.io.rest.sitemap.internal.PageChangeListener.constructAndSendEvents(PageChangeListener.java:172) [bundleFile:?]
at org.eclipse.smarthome.io.rest.sitemap.internal.PageChangeListener.stateChanged(PageChangeListener.java:186) [bundleFile:?]
at org.eclipse.smarthome.core.items.GenericItem$1.run(GenericItem.java:261) [bundleFile:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_144]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_144]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_144]
Caused by: com.jayway.jsonpath.InvalidPathException: Arguments to function: 'STA)∩MAP' are not closed properly.
at com.jayway.jsonpath.internal.path.PathCompiler.parseFunctionParameters(PathCompiler.java:375) ~[?:?]
at com.jayway.jsonpath.internal.path.PathCompiler.readPropertyOrFunctionToken(PathCompiler.java:217) ~[?:?]
at com.jayway.jsonpath.internal.path.PathCompiler.readNextToken(PathCompiler.java:151) ~[?:?]
at com.jayway.jsonpath.internal.path.PathCompiler.readDotToken(PathCompiler.java:171) ~[?:?]
at com.jayway.jsonpath.internal.path.PathCompiler.readNextToken(PathCompiler.java:145) ~[?:?]
at com.jayway.jsonpath.internal.path.PathCompiler.readContextToken(PathCompiler.java:124) ~[?:?]
at com.jayway.jsonpath.internal.path.PathCompiler.compile(PathCompiler.java:58) ~[?:?]
at com.jayway.jsonpath.internal.path.PathCompiler.compile(PathCompiler.java:75) ~[?:?]
at com.jayway.jsonpath.JsonPath.<init>(JsonPath.java:101) ~[?:?]
at com.jayway.jsonpath.JsonPath.compile(JsonPath.java:467) ~[?:?]
at com.jayway.jsonpath.internal.JsonContext.read(JsonContext.java:87) ~[?:?]
at com.jayway.jsonpath.JsonPath.read(JsonPath.java:502) ~[?:?]
at org.openhab.transform.jsonpath.internal.JSonPathTransformationService.transform(JSonPathTransformationService.java:63) ~[?:?]
... 10 more
Any suggestion? Is it a bug or I use the wrong syntax?
Thanks for help