serial data string out if switch activated

Topics (not sure which fora)
when not sure where to post, post here and mods will move it to right forum.

Moderators: leecollings, remb0

Post Reply
Dave21w
Posts: 407
Joined: Sunday 29 November 2015 21:55
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: UK
Contact:

serial data string out if switch activated

Post by Dave21w »

Is it possible to send a predifined string of ascii characters out of the serial port (or usb) when a specific switch is activated ?

Thx
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: serial data string out if switch activated

Post by waaren »

Dave21w wrote: Sunday 19 July 2020 9:31 Is it possible to send a predifined string of ascii characters out of the serial port (or usb) when a specific switch is activated ?
Did you try this bash command? (after changing /dev/ttyUSB0 to the port you want)

Code: Select all

sudo echo "predefined string"  > /dev/ttyUSB0
If that works you can use dzVents, Lua or Blockly, PHP or other scriptlanguage to do this using os.execute() when the specific switch is activated.
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Dave21w
Posts: 407
Joined: Sunday 29 November 2015 21:55
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: UK
Contact:

Re: serial data string out if switch activated

Post by Dave21w »

Thanks for the quick response Waaren, I'll give that a try later and report back :)
Dave21w
Posts: 407
Joined: Sunday 29 November 2015 21:55
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: UK
Contact:

Re: serial data string out if switch activated

Post by Dave21w »

Hopefully some one can give me a quick answer on this, I have an FTDI USB to serial converter plugged into the USB port, it's being seen as:-

Bus 001 Device 007: ID 0403:6001 Future Technology Devices International, Ltd FT232 Serial (UART) IC

I've followed the previous instructions in this thread, I'm seeing nothing coming out but not getting any errors on screen either, what am I missing?

Thx
Dave21w
Posts: 407
Joined: Sunday 29 November 2015 21:55
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: UK
Contact:

Re: serial data string out if switch activated

Post by Dave21w »

Really need some help here guys, trying to send my txt string as per Warren's instructions, the data gets sent but ignored because of some extra characters that are being appended to the start, here is what I'm sending:-
sudo echo -en "#A,0,1,0442187,0,test message" > /dev/ttyUSB0

And this is what is coming out:-
^@0#A,0,1,0442187,0,test message

The first three characters should not be there, does anyone have any ideas?

Thx
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest