Hi there,
I’m trying to integrate JSON output from Snips in my openhab rules but somehow the transformation doesn’t seem to work.
The rule is the following:
var String intentName = transform("JSONPATH", "$.intent.intentName", Snips_Intent.state.toString)
And Snips_Intent.state.toString contains:
gistfile1.txt
{
"sessionId": "bff1ec5b-7ec4-4047-a1c1-9ca7dbd5b05c",
"customData": null,
"siteId": "default",
"input": "schalte das licht im bad aus",
"asrTokens": [
[{
"value": "schalte",
"confidence": 1,
"rangeStart": 0,
This file has been truncated. show original
The rule should output
[ "domi:LampenAusSchalten" ]
But logInfo(“snips.rule”, "intent name: " + intentName) outputs:
gistfile1.txt
2019-03-16 11:19:33.082 [INFO ] [se.smarthome.model.script.snips.rule] - intent name: {"sessionId":"82081858-ac4a-4b67-92ca-46bc8abf6c3e","customData":null,"siteId":"default","input":"schalte das licht im bad aus","asrTokens":[[{"value":"schalte","confidence":1.0,"rangeStart":0,"rangeEnd":7,"time":{"start":0.0,"end":0.59999996}},{"value":"das","confidence":1.0,"rangeStart":8,"rangeEnd":11,"time":{"start":0.59999996,"end":0.96}},{"value":"licht","confidence":1.0,"rangeStart":12,"rangeEnd":17,"time":{"start":0.96,"end":1.05}},{"value":"im","confidence":1.0,"rangeStart":18,"rangeEnd":20,"time":{"start":1.05,"end":1.26}},{"value":"bad","confidence":1.0,"rangeStart":21,"rangeEnd":24,"time":{"start":1.26,"end":1.26}},{"value":"aus","confidence":1.0,"rangeStart":25,"rangeEnd":28,"time":{"start":1.26,"end":2.52}}]],"intent":{"intentName":"domi:LampenAusSchalten","confidenceScore":0.8482069},"slots":[{"rawValue":"bad","value":{"kind":"Custom","value":"Badezimmer"},"range":{"start":21,"end":24},"entity":"objectLocation","slotName":"deviceLocation","confidenceScore":1.0}]}
As you can see it outputs the complete JSON again?
What’s wrong here? According to an online JSONPATH tester it should work?
Openhab Version 2.4