NullPointerException trying to transmit via Lirc binding

this is openHab2.2 and I’m trying to control an LED strip with IR remote from a raspberry pi. Everything works as intended from the command line, both on the raspi with the IR transmitter installed or from some other machine in the network when I tested it with nc.

I installed the LIRC binding via the paper UI, there is a thing LIRC SERVER with Location, Hostname, Port set correctly. There is another related thing, named IR_i24 with 2 chanels, Button Event and Transmit Command, the latter detailed as lirc:remote:f642d87f:i24:transmit and String. The remote name i24 was correctly autodiscovered by the Binding.

Next, I open the Editor and create an .items file with

String i24Transmit {channel="lirc:remote:f642d87f:i24:transmit"}

And I have a rule:

rule "rule triggered  by LedColor received command "
when 	
    Item  LedColor received command
then

    if (receivedCommand==ON) { 
        
        logInfo("IR-Led", "LedColor received command ON")
        sendCommand("i24Transmit","KEY_POWER")
       
    } 
    
    if (receivedCommand==OFF) { 

        logInfo("IR-Led", "LedColor received command OFF")
        sendCommand("i24Transmit","KEY_Exit")
        
    }

end

The problems start when I click that item, from the openhab.log:

2018-02-07 15:09:37.984 [INFO ] [clipse.smarthome.model.script.IR-Led] - LedColor received command ON
2018-02-07 15:09:38.000 [ERROR] [nal.common.AbstractInvocationHandler] - An error occurred while calling method 'ThingHandler.handleCommand()' on 'org.eclipse.smarthome.binding.lirc.handler.LIRCRemoteHandler@1e6a30b': null
java.lang.NullPointerException: null
        at org.eclipse.smarthome.binding.lirc.internal.connector.LIRCConnector.sendCommand(LIRCConnector.java:145) [259:org.eclipse.smarthome.binding.lirc:0.10.0.b1]
        at org.eclipse.smarthome.binding.lirc.internal.connector.LIRCConnector.transmit(LIRCConnector.java:141) [259:org.eclipse.smarthome.binding.lirc:0.10.0.b1]
        at org.eclipse.smarthome.binding.lirc.internal.connector.LIRCConnector.transmit(LIRCConnector.java:124) [259:org.eclipse.smarthome.binding.lirc:0.10.0.b1]
        at org.eclipse.smarthome.binding.lirc.handler.LIRCBridgeHandler.transmit(LIRCBridgeHandler.java:171) [259:org.eclipse.smarthome.binding.lirc:0.10.0.b1]
        at org.eclipse.smarthome.binding.lirc.handler.LIRCRemoteHandler.handleCommand(LIRCRemoteHandler.java:65) [259:org.eclipse.smarthome.binding.lirc:0.10.0.b1]
        at sun.reflect.GeneratedMethodAccessor297.invoke(Unknown Source) ~[?:?]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
        at java.lang.reflect.Method.invoke(Method.java:498) ~[?:?]
        at org.eclipse.smarthome.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:153) [109:org.eclipse.smarthome.core:0.10.0.b1]
        at org.eclipse.smarthome.core.internal.common.InvocationHandlerSync.invoke(InvocationHandlerSync.java:59) [109:org.eclipse.smarthome.core:0.10.0.b1]
        at com.sun.proxy.$Proxy170.handleCommand(Unknown Source) [259:org.eclipse.smarthome.binding.lirc:0.10.0.b1]
        at org.eclipse.smarthome.core.thing.internal.profiles.ProfileCallbackImpl.handleCommand(ProfileCallbackImpl.java:72) [116:org.eclipse.smarthome.core.thing:0.10.0.b1]
        at org.eclipse.smarthome.core.thing.internal.profiles.SystemDefaultProfile.onCommandFromItem(SystemDefaultProfile.java:49) [116:org.eclipse.smarthome.core.thing:0.10.0.b1]
        at sun.reflect.GeneratedMethodAccessor105.invoke(Unknown Source) ~[?:?]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
        at java.lang.reflect.Method.invoke(Method.java:498) ~[?:?]
        at org.eclipse.smarthome.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:153) [109:org.eclipse.smarthome.core:0.10.0.b1]
        at org.eclipse.smarthome.core.internal.common.Invocation.call(Invocation.java:53) [109:org.eclipse.smarthome.core:0.10.0.b1]
        at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:?]
        at java.lang.Thread.run(Thread.java:748) [?:?]

I read some related threads here including https://community.openhab.org/t/problems-with-implementing-lirc-to-control-ir-devices/38123 , created new things in config files following the example in the Binding’s short docu and got no further.
I let the openhab-cli console list me all links and I see

i24Transmit -> lirc:remote:f642d87f:i24:transmit
lirc_remote_f642d87f_i24_event -> lirc:remote:f642d87f:i24:event
lirc_remote_f642d87f_i24_transmit -> lirc:remote:f642d87f:i24:transmit

so it looks like the system already created items for both channels. If I sendCommand to the auto-created items I get the very same exception, though.
Checking from the console I see the key has been written ino the item before the crash occurs:

lirc_remote_f642d87f_i24_transmit (Type=StringItem, State=KEY_Exit, Label=Transmit Command, Category=null)

Clearly missing something basic here but I’m out of ideas.
Thanks in advance for all pointers or detailling questions!

Daniel

Does the control work either on the BasicUI nor in the App ? The second item i24 looks strange, your led strip should be the lirc_remote_f642d87f_i24 -right ?

I post my script here, perhaps you can take something out of it. Here it is:

.items


Group remotes
Number		HarmanKardon			""								<none>					(gLounge)		{ autoupdate="false" }
String		Remote_harman_kardon															    			{ channel="lirc:remote:local:harman-kardon:transmit" }
//Number		appletv			""										<none>					(gLounge)		{ autoupdate="false" }
String		Remote_appletv																					{ channel="lirc:remote:local:appletv:transmit" }
//Number		fernseher			""							 		<none>					(gLounge)		{ autoupdate="false" }
String		Remote_fernseher																				{ channel="lirc:remote:local:fernseher:transmit" }
//Number		ledstrip			""							 		<none>					(gLounge)		{ autoupdate="false" }
String		Remote_ledstrip																					{ channel="lirc:remote:local:ledstrip:transmit" }

.things


Bridge lirc:bridge:local [ host="xxx.xxx.xxx.x", port="8765" ] {
    Thing remote harman-kardon [ remote="Harman-Kardon" ]
    Thing remote appletv [ remote="appletv" ]
    Thing remote fernseher [ remote="fernseher" ]
    Thing remote ledstrip [ remote="ledstrip" ]
    
}

.rules


import org.eclipse.xtext.xbase.lib.Functions

val logName = "Media"

val Functions$Function3<String, String, String, Boolean> lirc= [ r, k, ln |
	logInfo(ln, "LIRC Send " + r + " " + k)

	sendCommand("Remote_" + r, k)
    true
]

rule "Harman Kardon"

when
	Item HarmanKardon received command
then
	if (receivedCommand == 1) lirc.apply("harman_kardon", "KEY_POWER", logName)
	
	if (receivedCommand == 2) lirc.apply("harman_kardon", "KEY_POWER2", logName)
	
	if (receivedCommand == 3) lirc.apply("harman_kardon", "KEY_F", logName)
	
	if (receivedCommand == 4) lirc.apply("harman_kardon", "KEY_F1", logName)

	if (receivedCommand == 5) lirc.apply("harman_kardon", "KEY_F2", logName)
	
	if (receivedCommand == 6) lirc.apply("harman_kardon", "KEY_F3", logName)
	
	if (receivedCommand == 7) lirc.apply("harman_kardon", "KEY_F4", logName)
	
	if (receivedCommand == 8) lirc.apply("harman_kardon", "KEY_VOLUMEUP", logName)
	
	if (receivedCommand == 9) lirc.apply("harman_kardon", "KEY_VOLUMEDOWN", logName)	
		
	if (receivedCommand == 10) lirc.apply("appletv", "KEY_UP", logName)
	
	if (receivedCommand == 11) lirc.apply("appletv", "KEY_DOWN", logName)
	
	if (receivedCommand == 12) lirc.apply("appletv", "KEY_LEFT", logName)
	
	if (receivedCommand == 13) lirc.apply("appletv", "KEY_RIGHT", logName)
	
	if (receivedCommand == 14) lirc.apply("appletv", "KEY_MENU", logName)

	if (receivedCommand == 15) lirc.apply("appletv", "KEY_PLAY", logName)
	
	if (receivedCommand == 16) lirc.apply("appletv", "KEY_OK", logName)
	
	if (receivedCommand == 17) lirc.apply("fernseher", "KEY_POWER", logName)

	if (receivedCommand == 101) lirc.apply("ledstrip", "BRIGHT_UP", logName)
	
	if (receivedCommand == 102) lirc.apply("ledstrip", "BRIGHT_DOWN", logName)
	
	if (receivedCommand == 103) lirc.apply("ledstrip", "SKIP", logName)
	
	if (receivedCommand == 104) lirc.apply("ledstrip", "POWER", logName)

	if (receivedCommand == 105) lirc.apply("ledstrip", "RED", logName)
	
	if (receivedCommand == 106) lirc.apply("ledstrip", "GREEN", logName)
	
	if (receivedCommand == 107) lirc.apply("ledstrip", "BLUE", logName)
	
	if (receivedCommand == 108) lirc.apply("ledstrip", "WHITE", logName)
	
	if (receivedCommand == 109) lirc.apply("ledstrip", "ORANGE", logName)	
		
	if (receivedCommand == 1010) lirc.apply("ledstrip", "PEA_GREEN", logName)
	
	if (receivedCommand == 1011) lirc.apply("ledstrip", "DARK_BLUE", logName)
	
	if (receivedCommand == 1012) lirc.apply("ledstrip", "DARK_YELLOW", logName)
	
	if (receivedCommand == 1013) lirc.apply("ledstrip", "YELLOW", logName)
	
	if (receivedCommand == 1014) lirc.apply("ledstrip", "STRAW_YELLOW", logName)

	if (receivedCommand == 1015) lirc.apply("ledstrip", "SKY_BLUE", logName)
	
	if (receivedCommand == 1016) lirc.apply("ledstrip", "PURPLE", logName)
	
	if (receivedCommand == 1017) lirc.apply("ledstrip", "LIGHT_BLUE", logName)	
	
	if (receivedCommand == 1018) lirc.apply("ledstrip", "CYAN", logName)
	
	if (receivedCommand == 1019) lirc.apply("ledstrip", "BROWN", logName)
	
	if (receivedCommand == 1020) lirc.apply("ledstrip", "PINK", logName)
	
	if (receivedCommand == 1021) lirc.apply("ledstrip", "WHITE_1", logName)

	if (receivedCommand == 1022) lirc.apply("ledstrip", "WHITE_2", logName)
	
	if (receivedCommand == 1023) lirc.apply("ledstrip", "WHITE_3", logName)
	
	if (receivedCommand == 1024) lirc.apply("ledstrip", "WHITE_4", logName)
	
	if (receivedCommand == 1025) lirc.apply("ledstrip", "RED_UP", logName)
	
	if (receivedCommand == 1026) lirc.apply("ledstrip", "RED_DOWN", logName)	
		
	if (receivedCommand == 1027) lirc.apply("ledstrip", "DIY_1", logName)
	
	if (receivedCommand == 1028) lirc.apply("ledstrip", "DIY_4", logName)
	
	if (receivedCommand == 1029) lirc.apply("ledstrip", "DIY_2", logName)
	
	if (receivedCommand == 1030) lirc.apply("ledstrip", "DIY_5", logName)
	
	if (receivedCommand == 1031) lirc.apply("ledstrip", "DIY_3", logName)

	if (receivedCommand == 1032) lirc.apply("ledstrip", "DIY_6", logName)
	
	if (receivedCommand == 1033) lirc.apply("ledstrip", "GREEN_UP", logName)
	
	if (receivedCommand == 1034) lirc.apply("ledstrip", "GREEN_DOWN", logName)	
	
	if (receivedCommand == 1035) lirc.apply("ledstrip", "BLUE_UP", logName)
	
	if (receivedCommand == 1036) lirc.apply("ledstrip", "BLUE_DOWN", logName)
	
	if (receivedCommand == 1037) lirc.apply("ledstrip", "QUICK", logName)
	
	if (receivedCommand == 1038) lirc.apply("ledstrip", "SLOW", logName)

	if (receivedCommand == 1039) lirc.apply("ledstrip", "AUTO", logName)
	
	if (receivedCommand == 1040) lirc.apply("ledstrip", "FLASH", logName)
	
	if (receivedCommand == 1041) lirc.apply("ledstrip", "FADE_7", logName)
	
	if (receivedCommand == 1042) lirc.apply("ledstrip", "FADE_3", logName)
	
	if (receivedCommand == 1043) lirc.apply("ledstrip", "JUMP_7", logName)	
		
	if (receivedCommand == 1044) lirc.apply("ledstrip", "JUMP_3", logName)		
end

.sitemmap

		
		  Text label="Fernbedienungen" icon="remote"{
				Frame label="HARMAN KARDON" {
			  		Switch item=HarmanKardon label="AVR" icon=receiver mappings=[1="ON", 2="OFF"]
			  		Selection item=HarmanKardon label="Eingang" mappings=[3="AVR", 4="Sky", 5="XBOX", 6="Apple TV", 7="Alexa"] icon="input"
			  		Switch item=HarmanKardon label="Lautstärke" icon=soundvolume mappings=[8="▲", 9="▼"]}
		  		Frame label="APPLE TV" { 
		  				      Switch item=sheldon  label="Sheldon"
		  			
		  	  		Switch item=HarmanKardon mappings=[100="",10="▲", 100=""]
			  		Switch item=HarmanKardon icon=appletv mappings=[12="◄",16="OK", 13="►"]
			  		Switch item=HarmanKardon mappings=[14="Menü",11="▼", 15="► ❙❙"]}
		  		Frame label="FERNSEHER" {
		  	  		Switch item=HarmanKardon icon="tv" mappings=[17="An / Aus"]}
		  		Frame label="LOWBOARD LED - STREIFEN" {
		  	  		Switch item=HarmanKardon mappings=[101="Heller",102="Dunkler",103="Play",104="An / Aus"]
		  	  		Switch item=HarmanKardon mappings=[105="Rot" ,106="Grün",107="Blau",108="Weiss"]
		  	  		Switch item=HarmanKardon mappings=[109="ORANGE",1010="PEA_GREEN",1011="DARK_BLUE",1012="DARK_YELLOW"]
		  	  		Switch item=HarmanKardon mappings=[1013="YELLOW",1014="STRAW_YELLOW",1015="SKY_BLUE",1016="PURPLE"]
		  	  		Switch item=HarmanKardon mappings=[1017="LIGHT_BLUE",1018="CYAN",1019="BROWN",1020="PINK"]
		  	  		Switch item=HarmanKardon mappings=[1021="WHITE_1",1022="WHITE_2",1023="WHITE_3",1024="WHITE_4"]
		  	  		Switch item=HarmanKardon mappings=[1025="RED_UP",1026="RED_DOWN",1027="DIY_1",1028="DIY_4"]
		  	  		Switch item=HarmanKardon mappings=[1029="DIY_2",1030="DIY_5",1031="DIY_3",1032="DIY_6"]
		  	  		Switch item=HarmanKardon mappings=[1033="GREEN_UP",1034="GREEN_DOWN",1035="BLUE_UP",1036="BLUE_DOWN"]
		  	  		Switch item=HarmanKardon mappings=[1037="QUICK",1038="SLOW",1039="AUTO",1040="FLASH"]
		  	  		Switch item=HarmanKardon mappings=[1041="FADE_7",1042="FADE_3",1043="JUMP_7",1044="JUMP_3"]
		  	  		Switch item=HarmanKardon mappings=[41="FADE_7",42="FADE_3",43="JUMP_7",44="JUMP_3"]

turns out the effect is not reproducible after a restart of openHab2, ahemm.