Ok I’ve finally managed to get text rules working with this which makes life a lot easier for me. I had to create another channel running of the MQTT message tele/nspanel/result and linking an Item. You can then get at the json strings.
I have the Music screen running. I can pick up the strings you mentioned.
I did the page as follows which I think is causing a problem in the groovy script I’m not sure about how to code the Music page - no title is coming up. I get an error listed below and in the console
case "10" :
if (refresh) {
json = makePage(10,'Master Bedroom',6)
json<<format<<',buttons:['
json<<makeButton(1,"Walls",1,1)
json<<makeButton(2,"Bath",1,1)
json<<makeButton(3,"Blinds",1,10)
json<<makeButton(4,"Velux",2,10)
json<<makeButton(5,"Music",10,11,13,11)
json<<"]}}"
} else {
json = '{ "sync": {} }'
}
events.sendCommand("nxpanel_command",json.toString())
logger.info("nxpanel_command: "+json)
break
case "11" :
if (refresh) {
json = makePage(11,'Music',13)
json<<format<<',buttons:['
json<<makeButton(1,"Walls",1,1)
json<<makeButton(2,"Bath",1,1)
json<<makeButton(3,"Blinds",1,10)
json<<makeButton(4,"Velux",2,10)
json<<makeButton(5,"Music",10,11,13,11)
json<<"]}}"
} else {
json = '{ "sync": {} }'
}
events.sendCommand("nxpanel_command",json.toString())
break
}
I get the openhab.log error :
2022-02-09 18:23:20.757 [ERROR] [internal.handler.ScriptActionHandler] - Script execution of rule with UID 'ca275a12c8' failed: javax.script.ScriptException: java.lang.StringIndexOutOfBoundsException: begin 6, end -1, length 26
And In the console:
18:34:09.820 MQT: tele/NSPanel/RESULT = {"media":{"action":previous"}}
18:34:09.826 BRY: ERROR, bad json: {"media":{"action":previous"}