Detect presence of RaZberry

Discussions about RaZberry - Z-Wave board for Raspberry computer
Post Reply
skiv71
Posts: 124
Joined: 01 May 2014 13:46
Location: United Kingdom
Contact:

Detect presence of RaZberry

Post by skiv71 »

Hi,

I'm looking to detect the presence of the RaZberry GPIO board.

I've found out that the port, ttyAMA0 is always present in Raspbian, regardless of any device that might be connected.

With that in mind, is there any way I can probe the serial to discover if RaZ is actually present?

Thanks

Neil
pofs
Posts: 688
Joined: 25 Mar 2011 19:03

Re: Detect presence of RaZberry

Post by pofs »

Sure it is :) Try to initialize the library (or its JS binding) on that port, if discover fails then it is not a valid Z-Wave device.
skiv71
Posts: 124
Joined: 01 May 2014 13:46
Location: United Kingdom
Contact:

Re: Detect presence of RaZberry

Post by skiv71 »

I've been in touch with ps @ zwave and he's mentioned the get-tty but I really need to do this by sending a hex string and looking for a response. Not sure what to send though and what to expect
skiv71
Posts: 124
Joined: 01 May 2014 13:46
Location: United Kingdom
Contact:

Re: Detect presence of RaZberry

Post by skiv71 »

I sussed it myself...

#!/bin/bash

# initialise
port=/dev/ttyAMA0

# set port
stty -F $port cs8 raw 115200

# test port
echo -ne "\x01\x03\x00\x07\xFB" >$port
a=($(xxd -p -l 12 -c 2 <$port))
b=$(printf %.d 0x${a[3]})

# evaluate
if [ "$b" = "327" ]; then
echo z-wave.me
fi
pofs
Posts: 688
Joined: 25 Mar 2011 19:03

Re: Detect presence of RaZberry

Post by pofs »

This may actually fail in case there's a number of devices in your network reporting to controller. So report from device will be read instead of actual response (which will come later).
So it basically works, but is not 100% reliable.
Post Reply