OpenHab2 - Raspberry PI 3B+
RFlink on Arduino Mega 2560
Serial Binding V - 1.13.0
Hy.
I have a text box linked to the serial port that perfectly receives the information from the RFlink
But I can not send orders on this one.
My sitemap:{
sitemap rf_test label= "RfLink Test"{
Text item=RFLinkRaw // ["%s"]
}
}
My items
String RFLinkRaw "RFLink raw data [%s]" <text> { serial="/dev/ttyUSB0@57600" }
Switch Test_RFlinj "Send Command"
My rules
rule "RFLink IN"
when
Item RFLinkRaw received update
then
//treatment values received
end
rule "RFLink OUT"
when
Item Test_RFlink received command ON
then
RFLinkRaw.sendCommand("10;Newkaku;02128800;1;ON")
end
When I send the command I receive this error:
16:01:43.799 [ERROR] [untime.internal.engine.RuleEngineImpl] - Rule ‘RFLink IN’: 5
I do not have to have everything understood to send information on / dev / ttyUSB0 …
Please Help me
openHAB’s autoupdate will “helpfully” update your Item state when you send it a command.
The update will trigger your “RFLink IN” which presumably fails in the code that you have kept secret, or perhaps the code that isn’t there yet, while trying to analyze your own command.
You could stop that by turning off autoupdate for this Item
String RFLinkRaw "RFLink raw data [%s]" <text> { serial="/dev/ttyUSB0@57600", autoupdate="false" }
That won’t fix whatever you are sending out though. Your different patterns don’t seem to have much in common.
You might need to pin down exactly what your are supposed to send, you may also need to look at character encoding.
I advanced in my problems:
if I send the commands on the item related to the serial port it works now
rule "Light Cuisine "
when
Item Cuisine received command
then
if (Cuisine.state == ON ){
RFLinkRaw.sendCommand("10;POWERFIX;0B00;03;ON\n\r")
} else {
RFLinkRaw.sendCommand("10;POWERFIX;0B00;03;OFF\n\r")
}
end
but I must have a syntax error in the direct command from the switch that works on the ‘OFF’ function but not on the ‘ON’
I voluntarily reversed on ‘ON’ for RFlink the OFF command of the Switch and there I can turn on my lamp when switch Off
but the extinction does not work with Switch ON
In this case I do not know how to turn on my lamp but I know how to turn it off!
Which reinforces me in the sense that I must have an error in the syntax of this line
17:12:50.476 [DEBUG] [.binding.serial.internal.SerialDevice] - Writing '10;POWERFIX;0B00;03;OFF
' to serial port /dev/ttyUSB0
17:12:50.479 [INFO ] [smarthome.event.ItemCommandEvent ] - Item 'RFLinkRaw' received command 10;POWERFIX;0B00;03;OFF
17:12:50.498 [INFO ] [smarthome.event.ItemStateChangedEvent] - RFLinkRaw changed from 20;41;OK;
to 10;POWERFIX;0B00;03;OFF
17:12:51.473 [DEBUG] [.binding.serial.internal.SerialDevice] - Received message '20;42;OK;
' on serial port /dev/ttyUSB0
17:12:51.496 [INFO ] [smarthome.event.ItemStateChangedEvent] - RFLinkRaw changed from 10;POWERFIX;0B00;03;OFF
to 20;42;OK;
There are fairly obvious differences between
RFLinkRaw.sendCommand(“10;POWERFIX;0B00;03;OFF\n\r”)
and
serial="/dev/ttyUSB0@57600,ON(10;POWERFIX;0B00;03;OFF;\n)
This is a result of ignoring the advice about autoupdate.