Error in Rules execution -> Error processing MQTT message

Hello,

i have no idea whats wrong here. I use Tasmota Software on a Wemos D1 mini for IR Receive and send.

Sitemap (part):

Frame
	{
    Switch item=TV_Action mappings=[progminus="P-", progplus="P+", leiser="VOL-", lauter="VOL+", mute="mute", quelle="Quelle"] icon="screen"
    Selection item=LR_TV_Channel label="TV Channel"
			  mappings=[0="Das Erste", 1="ZDF", 2="BR", 3="RTL", 4="RTL 2", 5="SAT 1", 6="PRO 7", 7="Super RTL", 8="Kabel 1", 9="Tele 5",
			            10="VOX", 11="3 Sat", 12="arte", 13="phoenix", 14="KIKA", 15="ONE", 16="ZDFinfo", 17="ZDFneo", 18="Test", 19="Ausschalten"] icon="screen"
	}

Items file:
String TV_Action “TV"
String LR_TV_Channel “TV Channel"
String IR_Receive “IR_Receive [%s]”
{ mqtt=”<[broker:tele/sonoff-87786C/RESULT:state:JSONPATH($.IrReceived.DATA):.IrReceived.]” }

Rules File:

val sonoff_device_ids = newArrayList(
“sonoff-87786C”
)

rule “TV”

when
Item TV_Action received command
then
if (TV_Action.state == NULL)
{
logInfo(“TV.rules”, “Item is null, cancelling…”)
return;
}

logInfo("TV.rules", "TV: " + receivedCommand)
var irSend1 = "{" + "\"" + "PROTOCOL" + "\"" + ":" + "\"" + "NEC" + "\"" + "," + "\"" + "BITS" + "\"" + ":32," + "\"" + "DATA" + "\"" + ":" + "\""
var irSend2 = "\"" + "}"
for (String device_id : sonoff_device_ids) {
    switch (receivedCommand) {
        case "lauter" :
            publish("broker", "cmnd/" + device_id + "/irSend", irSend1 + "551502015" + irSend2) 
        case "leiser" :
            publish("broker", "cmnd/" + device_id + "/irSend", irSend1 + "551534655" + irSend2) 
        case "progplus" : 
            publish("broker", "cmnd/" + device_id + "/irSend", irSend1 + "551485695" + irSend2) 
        case "progminus" : 
            publish("broker", "cmnd/" + device_id + "/irSend", irSend1 + "551518335" + irSend2) 
        case "quelle" : 
            publish("broker", "cmnd/" + device_id + "/irSend", irSend1 + "551538735" + irSend2) 
        case "mute" : 
            publish("broker", "cmnd/" + device_id + "/irSend", irSend1 + "551522415" + irSend2)                                                 
    }
}
TV_Action.postUpdate(receivedCommand)

end

rule “TV_Channel”

when
Item LR_TV_Channel received command
then
if (LR_TV_Channel.state == NULL)
{
logInfo(“TV.rules”, “Item is null, cancelling…”)
return;
}

logInfo("TV.rules", "TV: " + receivedCommand)
var irSend1 = "{" + "\"" + "PROTOCOL" + "\"" + ":" + "\"" + "NEC" + "\"" + "," + "\"" + "BITS" + "\"" + ":32," + "\"" + "DATA" + "\"" + ":" + "\""
var irSend2 = "\"" + "}"
var backlog = "/Backlog IRSend "+irSend1+"551520375"+irSend2+"; "+"IRSend "+irSend1+"551487735"+irSend2
for (String device_id : sonoff_device_ids) {        
    switch (receivedCommand) {
        case "0" :
            publish("broker", "cmnd/" + device_id + "/irSend", irSend1 + "551520375" + irSend2)  
        case "1" :
            publish("broker", "cmnd/" + device_id + "/irSend", irSend1 + "551504055" + irSend2) 
        case "2" : 
            publish("broker", "cmnd/" + device_id + "/irSend", irSend1 + "551536695" + irSend2) 
        case "3" : 
            publish("broker", "cmnd/" + device_id + "/irSend", irSend1 + "551495895" + irSend2)
        case "4" :
            publish("broker", "cmnd/" + device_id + "/irSend", irSend1 + "551528535" + irSend2)  
        case "5" :
            publish("broker", "cmnd/" + device_id + "/irSend", irSend1 + "551512215" + irSend2) 
        case "6" : 
            publish("broker", "cmnd/" + device_id + "/irSend", irSend1 + "551544855" + irSend2) 
        case "7" : 
            publish("broker", "cmnd/" + device_id + "/irSend", irSend1 + "551491815" + irSend2)
        case "8" :
            publish("broker", "cmnd/" + device_id + "/irSend", irSend1 + "551524455" + irSend2)  
        case "9" :
            {
            publish("broker", "cmnd/" + device_id + "/irSend", irSend1 + "551520375" + irSend2)
            publish("broker", "cmnd/" + device_id + "/status","1") // Pause notwendig zwischen Tastendrücken     
            publish("broker", "cmnd/" + device_id + "/irSend", irSend1 + "551487735" + irSend2)
            } 
        case "10" :
            {
            publish("broker", "cmnd/" + device_id + "/irSend", irSend1 + "551520375" + irSend2) 
            publish("broker", "cmnd/" + device_id + "/status","1") // Pause notwendig zwischen Tastendrücken     
            publish("broker", "cmnd/" + device_id + "/irSend", irSend1 + "551520375" + irSend2)
            } 
        case "11" :
            {
            publish("broker", "cmnd/" + device_id + "/irSend", irSend1 + "551520375" + irSend2)
            publish("broker", "cmnd/" + device_id + "/status","1") // Pause notwendig zwischen Tastendrücken 
            publish("broker", "cmnd/" + device_id + "/irSend", irSend1 + "551504055" + irSend2)
            } 
        case "12" :
            {
            publish("broker", "cmnd/" + device_id + "/irSend", irSend1 + "551520375" + irSend2)
            publish("broker", "cmnd/" + device_id + "/status","1") // Pause notwendig zwischen Tastendrücken
            publish("broker", "cmnd/" + device_id + "/irSend", irSend1 + "551536695" + irSend2) 
            } 
        case "13" :
            {
            publish("broker", "cmnd/" + device_id + "/irSend", irSend1 + "551520375" + irSend2)
            publish("broker", "cmnd/" + device_id + "/status","1") // Pause notwendig zwischen Tastendrücken
            publish("broker", "cmnd/" + device_id + "/irSend", irSend1 + "551495895" + irSend2)
            } 
        case "14" :
            {
            publish("broker", "cmnd/" + device_id + "/irSend", irSend1 + "551520375" + irSend2)
            publish("broker", "cmnd/" + device_id + "/status","1") // Pause notwendig zwischen Tastendrücken
            publish("broker", "cmnd/" + device_id + "/irSend", irSend1 + "551528535" + irSend2) 
            } 
        case "15" :
            { 
            publish("broker", "cmnd/" + device_id + "/irSend", irSend1 + "551520375" + irSend2)
            publish("broker", "cmnd/" + device_id + "/status","1") // Pause notwendig zwischen Tastendrücken
            publish("broker", "cmnd/" + device_id + "/irSend", irSend1 + "551512215" + irSend2) 
            } 
        case "16" :
            { 
            publish("broker", "cmnd/" + device_id + "/irSend", irSend1 + "551520375" + irSend2)
            publish("broker", "cmnd/" + device_id + "/status","1") // Pause notwendig zwischen Tastendrücken
            publish("broker", "cmnd/" + device_id + "/irSend", irSend1 + "551544855" + irSend2)  
            } 
        case "17" :
            { 
            publish("broker", "cmnd/" + device_id + "/irSend", irSend1 + "551520375" + irSend2)
            publish("broker", "cmnd/" + device_id + "/status","1") // Pause notwendig zwischen Tastendrücken
            publish("broker", "cmnd/" + device_id + "/irSend", irSend1 + "551491815" + irSend2)
            } 
        case "18" :
            {
            logInfo("TV.rules", "Backlog: " + "cmnd/" + device_id + backlog)        
            publish("broker", "cmnd/" + device_id + backlog)
            } 
        case "19" : // Ausschalten !!
            {
            publish("broker", "cmnd/" + device_id + "/irSend", irSend1 + "123456789" + irSend2)
            }                
    }
}
LR_TV_Channel.postUpdate(receivedCommand)

end

rule “IR Receive and Send again”

when
Item IR_Receive changed
then
if (IR_Receive.state == NULL)
{
logInfo(“TV.rules”, “Item is null, cancelling…”)
return;
}

var irData = IR_Receive.state.toString
val irVal =  Integer.parseInt(irData, 16) as Number
var irString = irVal.toString
logInfo("IR_Repeater.rules", "Received IR Codes (hex): " + irData +" IR Codes (dec): " + irString)
var irSend = "{" + "\"" + "PROTOCOL" + "\"" + ":" + "\"" + "NEC" + "\"" + "," + "\"" + "BITS" + "\"" + ":32," 
    + "\"" + "DATA" + "\"" + ":" + "\"" + irString + "\"" + "}"
for (String device_id : sonoff_device_ids) {
    publish("broker", "cmnd/" + device_id + "/irSend", irSend) 
}

end

i always get this errors and case “18” is non working.

==> /var/log/openhab2/openhab.log <==

2018-02-03 15:20:29.412 [INFO ] [thome.model.script.IR_Repeater.rules] - Received IR Codes (hex): FF58A7 IR Codes (dec): 16734375

2018-02-03 15:20:29.558 [ERROR] [.mqtt.internal.MqttMessageSubscriber] - Error processing MQTT message.

org.openhab.core.transform.TransformationException: Invalid path ‘$.POWER’ in ‘{“IRSend”:“Done”}’

at org.openhab.core.transform.TransformationHelper$TransformationServiceDelegate.transform(TransformationHelper.java:67) [207:org.openhab.core.compat1x:2.2.0]

at org.openhab.binding.mqtt.internal.MqttMessageSubscriber.processMessage(MqttMessageSubscriber.java:138) [227:org.openhab.binding.mqtt:1.11.0]

at org.openhab.io.transport.mqtt.internal.MqttBrokerConnection.messageArrived(MqttBrokerConnection.java:556) [208:org.openhab.io.transport.mqtt:1.11.0]

at org.eclipse.paho.client.mqttv3.internal.CommsCallback.deliverMessage(CommsCallback.java:475) [208:org.openhab.io.transport.mqtt:1.11.0]

at org.eclipse.paho.client.mqttv3.internal.CommsCallback.handleMessage(CommsCallback.java:379) [208:org.openhab.io.transport.mqtt:1.11.0]

at org.eclipse.paho.client.mqttv3.internal.CommsCallback.run(CommsCallback.java:183) [208:org.openhab.io.transport.mqtt:1.11.0]

at java.lang.Thread.run(Thread.java:748) [?:?]

Error Case “18”:

2018-02-03 15:27:14.680 [ome.event.ItemCommandEvent] - Item ‘LR_TV_Channel’ received command 18

2018-02-03 15:27:14.691 [vent.ItemStateChangedEvent] - LR_TV_Channel changed from NULL to 18

==> /var/log/openhab2/openhab.log <==

2018-02-03 15:27:14.710 [INFO ] [ipse.smarthome.model.script.TV.rules] - TV: 18

2018-02-03 15:27:14.745 [INFO ] [ipse.smarthome.model.script.TV.rules] - Backlog: cmnd/sonoff-87786C/Backlog IRSend {“PROTOCOL”:“NEC”,“BITS”:32,“DATA”:“551520375”}; IRSend {“PROTOCOL”:“NEC”,“BITS”:32,“DATA”:“551487735”}

2018-02-03 15:27:14.753 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule ‘TV_Channel’: An error occurred during the script execution: index=2, size=2

Found one error:

i have defined this (other items file!) for a PIR connected to the WEMOS:

Switch Pir “PIR”
{ mqtt="<[broker:stat/sonoff-87786C/RESULT:state:JSONPATH($.POWER)]" }

an idea to get both working together?

Error Case 18 is still there :frowning:

2018-02-03 16:05:05.395 [ome.event.ItemCommandEvent] - Item ‘LR_TV_Channel’ received command 18

==> /var/log/openhab2/openhab.log <==

2018-02-03 16:05:05.430 [INFO ] [ipse.smarthome.model.script.TV.rules] - TV: 18

2018-02-03 16:05:05.487 [INFO ] [ipse.smarthome.model.script.TV.rules] - Backlog: cmnd/sonoff-87786C/Backlog IRSend {“PROTOCOL”:“NEC”,“BITS”:32,“DATA”:“551520375”}; IRSend {“PROTOCOL”:“NEC”,“BITS”:32,“DATA”:“551487735”}

2018-02-03 16:05:05.498 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule ‘TV_Channel’: An error occurred during the script execution: index=2, size=2