SendCommand on serial not working

Hi

I’ve connected an arduino via serial to a raspberry pi 2. Everything is working receiving wise, I can send from the arduino, parse the data and update the items. I’ve go a rule to send command to the serial on a switch change which according to the logs is working but the arduino is definitely not receiving anything. My code seems fine

Items:

Group Power "Power"
Group Heating "Heating"
Group Lighting "Lighting"
Group Engine "Engine"
Group Saloon “Saloon Lighting” (Lighting)
Group Bedroom “Bedroom Lighting” (Lighting)
Group Navigation “Navigation Lighting” (Lighting)
Group Water

String arduino_update { serial="/dev/ttyAMA0@9600" }
String arduino_send { serial="/dev/ttyAMA0@9600" , autoupdate=“false”}

/Lighting/
Switch saloon_light “Saloon Light” (Saloon)
Switch saloon_downlight “Saloon Downlight” (Saloon)
Switch bathroom_light “Bathroom Light” (Lighting)
Switch galley_light “Galley Light” (Lighting)
Switch bedroom_light “Bedroom Light” (Bedroom)
Switch bedroom_nightlight “Bedroom Nightlight” (Bedroom)
Switch nav_lights “Navigation Lights” (Navigation)
Switch cockpit_light “Cockpit Light” (Navigation)
Switch head_light “Head Lamp” (Navigation)

String voltage “Battery Voltage” (Power)
String amps_in “Charging Rate” (Power)
String amps_out “Power Consumption” (Power)
Dimmer webasto “Webasto” (Heating)
Dimmer radiator “Radiator” (Heating)
Switch engine_state “Engine” (Engine)
String engine_temp “Engine Temerature” (Engine)
String oil_pressure “Oil Pressure” (Engine)
String diesel “Fuel Level” (Engine)
String water “Water Level” (Water)

Rules:

import org.openhab.core.library.types.*
import org.openhab.model.script.actions.*
import java.util.regex.Matcher
import java.util.regex.Pattern
    
rule "update_all"

when   
        Item arduino_update received update
then   
        var String newvalue = ""
		newvalue = arduino_update.state.toString			
		//logInfo("update", newvalue)		
		
		var String expr = "mainlight,([^:]+)"			
		var Pattern pattern = Pattern::compile(expr)
		var Matcher matcher = pattern.matcher(newvalue)
		matcher.find()
		if (matcher.group(1) == "On"){
		sendCommand(saloon_light, ON)
		} else {
		sendCommand(saloon_light, OFF)}
		
		expr = "downlight,([^:]+)"
		pattern = Pattern::compile(expr)
		matcher = pattern.matcher(newvalue)
		matcher.find()
		if (matcher.group(1) == "On"){
		sendCommand(saloon_downlight, ON)
		} else {
		sendCommand(saloon_downlight, OFF)}
		
        expr = "headslight,([^:]+)"
		pattern = Pattern::compile(expr)
		matcher = pattern.matcher(newvalue)
		matcher.find()
		if (matcher.group(1) == "On"){
		sendCommand(bathroom_light, ON)
		} else {
		sendCommand(bathroom_light, OFF)}
		
        expr = "galleylight,([^:]+)"
		pattern = Pattern::compile(expr)
		matcher = pattern.matcher(newvalue)
		matcher.find()
		if (matcher.group(1) == "On"){
		sendCommand(galley_light, ON)
		} else {
		sendCommand(galley_light, OFF)}
		
        expr = "bedlight,([^:]+)"			
		pattern = Pattern::compile(expr)
		matcher = pattern.matcher(newvalue)
		matcher.find()
		if (matcher.group(1) == "On"){
		sendCommand(bedroom_light, ON)
		} else {
		sendCommand(bedroom_light, OFF)}
					
        expr = "nightlight,([^:]+)"			
		pattern = Pattern::compile(expr)
		matcher = pattern.matcher(newvalue)
		matcher.find()
		if (matcher.group(1) == "On"){
		sendCommand(bedroom_nightlight, ON)
		} else {
		sendCommand(bedroom_nightlight, OFF)}
		
        expr = "navlight,([^:]+)"			
		pattern = Pattern::compile(expr)
		matcher = pattern.matcher(newvalue)
		matcher.find()
		if (matcher.group(1) == "On"){
		sendCommand(nav_lights, ON)
		} else {
		sendCommand(nav_lights, OFF)}
		
        expr = "cockpitlight,([^:]+)"
		pattern = Pattern::compile(expr)
		matcher = pattern.matcher(newvalue)
		matcher.find()
		if (matcher.group(1) == "On"){
		sendCommand(cockpit_light, ON)
		} else {
		sendCommand(cockpit_light, OFF)}
		
        expr = "frontlight,([^:]+)"
		pattern = Pattern::compile(expr)
		matcher = pattern.matcher(newvalue)
		matcher.find()
		if (matcher.group(1) == "On"){
		sendCommand(head_light, ON)
		} else {
		sendCommand(head_light, OFF)}
		
        expr = "voltage,([^:]+)"
		pattern = Pattern::compile(expr)
		matcher = pattern.matcher(newvalue)
		matcher.find()
		postUpdate(voltage, matcher.group(1))
		
        expr = "charge,([^:]+)"
		pattern = Pattern::compile(expr)
		matcher = pattern.matcher(newvalue)
		matcher.find()
		postUpdate(amps_in, matcher.group(1))
		
        expr = "amps,([^:]+)"
		pattern = Pattern::compile(expr)
		matcher = pattern.matcher(newvalue)
		matcher.find()
		postUpdate(amps_out, matcher.group(1))
		
        //var String expr = "webasto,([^:]+)"
		//var Pattern pattern = Pattern::compile(expr)
		//var Matcher matcher = pattern.matcher(newvalue)
		//matcher.find()
		//postUpdate(webasto, matcher.group(1))
		
        //var String expr = "radiator,([^:]+)"
		//var Pattern pattern = Pattern::compile(expr)
		//var Matcher matcher = pattern.matcher(newvalue)
		//matcher.find()
		//postUpdate(radiator, matcher.group(1))
		
        //var String expr = "engine,([^:]+)"
		//var Pattern pattern = Pattern::compile(expr)
		//var Matcher matcher = pattern.matcher(newvalue)
		//matcher.find()
		//postUpdate(engine, matcher.group(1))
		
        expr = "temp,([^:]+)"
		pattern = Pattern::compile(expr)
		matcher = pattern.matcher(newvalue)
		matcher.find()
		postUpdate(engine_temp, matcher.group(1))
		
        expr = "oil,([^:]+)"
		pattern = Pattern::compile(expr)
		matcher = pattern.matcher(newvalue)
		matcher.find()
		postUpdate(oil_pressure, matcher.group(1))
		
        expr = "diesel,([^:]+)"
		pattern = Pattern::compile(expr)
		matcher = pattern.matcher(newvalue)
		matcher.find()
		postUpdate(diesel, matcher.group(1))
		
        expr = "water,([^:]+)"
		pattern = Pattern::compile(expr)
		matcher = pattern.matcher(newvalue)
		matcher.find()
		postUpdate(water, matcher.group(1))
end

rule "light_on"

when 
		Item saloon_light changed
		
then
		//var String this = "";
		//this = saloon_light.state.toString;
		arduino_send.sendCommand("z");
		
		
end

Everything shows up in the logs correctly so I think openhab is allowed to read the serial but not write to it…any suggestions? Please!

Did you solve your problem? I am having a similar issue.