OpenHabian send RAW over NanoCUL

Hello

A year ago i have set up a OpenHabian server and send raw data over CUL with echo (commandline and script) was no problem. (to trigger a switch with unkonwn protocol)

Now i have setup a new server for testing and have no luck :frowning:

The nanoCul work on the other Server also when i send the plain ascii chars over a windows terminal so the CUL is working.

I think there is something wrong in the openhabien config (sending permissions) but i dont find whats going wrong.

I can get the Version of the CUL … i can set it to monitor mode and recive data … but i cant send something.

The device ist set to chmod 777 so everyone should have the full access:

[14:02:52] openhabian@patandkat:~$ ls -l /dev/ttyUSB0
crwxrwxrwx 1 root dialout 188, 0 Sep 26 13:59 /dev/ttyUSB0

But when i want to send:
sudo echo ‘G0030af13403b1610097ee8’ > /dev/ttyUSB0

Nothing happend …

With the other server and over Windows its no problem to send the raw command …

Sorry for my bad english :frowning:

Thank You

Also the openhabian user is in the dialout group

The openhab user needs to be in the dialout group. openhab is the user OH runs under. openhabian is the user you use to log into the RPi.

But that doesn’t matter when the device set to 777 (though that setting will likely go back to 755 on a reboot).

I’m not familiar with this device or binding so can offer no further help. I just wanted to clear up some misconceptions.

Now i have get ist to work :slightly_smiling_face:

I dont know why it worked on the old server out of the box …

The Steps:

  1. By default every serialport is only in canonical mode so i have to add raw and -echo mode (setting up the port):
    stty -F /dev/ttyUSB0 38400 raw -echo

  2. Open the port i have used cat in background mode:
    cat /dev/ttyUSB0 &

  3. Send the Echo:
    echo G0030af13403b1610097ee8 > /dev/ttyUSB0

  4. Kill the cat process

All this i can run automatic with the following setup:

A simple Rule bind to a switch or other item:

(Replace G0030ae143f3b1814097ee8 with the raw code you want to send)

when
    Item test_sw2 received update ON
then
   executeCommandLine("sh /etc/openhab2/scripts/sendtoculraw.sh G0030ae143f3b1814097ee8")
   postUpdate(test_sw2, OFF)
end

And the sendtoculraw.sh script (change portpaths to your needs):

#!/bin/sh

# Set up the serialport
stty -F /dev/ttyUSB0 38400 raw -echo

# Open the serialport with cat in background mode
cat /dev/ttyUSB0 &

# Capture PID of cat process to terminate it when done
catPid=$!

# Wait 1.5 seconds so the serial port will be open when we send
sleep 1.5

# Echo the raw command
echo $1 > /dev/ttyUSB0

# Kill the cat process
kill $catPid

I think this is a realy cool solution to trigger or read Devices with an unknown protocol.

You can simply read the incoming raw signal from the unknown device lets say a remote control.

And then send out the raw signal over openhub to trigger the device :slight_smile:

Thank You

1 Like