Hi,
I’m very new to openhab and home automation in general.
I am trying to sent data from an Arduino to openhab through serial USB.
minicom shows that it is able to read the data sent to the serial usb port.
i have added: -Dgnu.io.rxtx.SerialPorts=/dev/ttyUSB0
to both start.sh and start_debug.sh
some lines of instructions that i put in the items and sitemap file are below:
items:
Number Arduino “Arduino [%s]” (arduino) {serial="/dev/ttyUSB0"}
sitemap:
Text item=Arduino label=“Weight”
Is there anything I did wrong?
events.log also didn’t update, hence my problem
Sorry, if I missed a simple fix.
Thank you
Hi,
The item that is storing your serial data should be a ‘String’ and not a ‘Number’.
String Arduino “Arduino [%s]” (arduino) {serial="/dev/ttyUSB0"}
What if I want to use the same bit of data and use it in a graph, do I need to create another item or will the variable type String would still work?
Serial communication is always text/string. You would have to have a rule that converts the serial item to a number item.
I think something along this line for items
String Arduino “Arduino [%s]” (arduino) {serial="/dev/ttyUSB0"}
Number Weigth “Weigth [%s]” (arduino)
and as rule
rule "Arduino sends to Openhab"
when
Item Arduino received update
then
var Integer Weight = new Integer(Arduino)
Weigth.sendUpdate(Weight)
end rule
Thank you very much, I will read up a little bit more on the wiki, hopefully I learn more.