Serial

Hi,

I am currently trying to send some data through the serial port to my arduino, but I do not know why it is currently don’t working. This is the code:

rule "Video Light"  
 when   
     Item camera_light changed  
 then  
 
 	if(camera_light.state == 0){
      sendCommand (Arduino , "light=OFF")  
 	}
 	if(camera_light.state == 1){
      sendCommand (Arduino , "light=ON")
 	}
end  

On events.log I am only receiving this:

2017-09-29 00:49:35 - camera_light received command ON
2017-09-29 00:49:41 - camera_light received command OFF

And on openhab.log any error.

Do you know where can I see a log of the actions that openhab is making? Or how to solve my problem?

Thanks

0 is not the same as ON, Your rule does nothing unless the state is 0 or 1, but your item only gets ON or OFF commands.

If your item is really a switch type it will only be ON or OFF, so you should alter your if() clauses to look for those states.

Ah,

And do you know how can I monitor the serial output to Arduino?

Thank you very much, I will try to see how it goes?

Well, I guess you would use a serial monitor - something lika an old laptop is useful for this kind of thing.

Now I have tested it and it seems to work.

So then I guest that there is no log with the outputs and actions that openhab execute no?

Of course there is (but it cannot monitor what actually arrives at a serial device)

http://docs.openhab.org/administration/logging.html

Once you find the logs, you will also find the logInfo() really useful to put into your rules so that you can see progress etc.

When I try to log to the console with:

ssh -p 8101 openhab@localhost

It tells me this:

ssh: connect to host localhost port 8101: Connection refused

I supose this is the log console which is described in the article you send me. Do you know why is this error reporting?

Thanks

Also, I didn’t want to monitor what does arrive to the serial port, I just wanted to know what goes out by openhab

No idea. I use Windows hosts.

Over to others … ?

This looks relevant

Wait a minute here …

Are you running Openhab2 ? If you are still on OH1 that logging help page will not apply.

Well I currently used this steps for installing it:

I do not know which version was it, but I assume that is was the lastest, althought maybe like you said it is not