Skip to content

Instantly share code, notes, and snippets.

@jdevoo
Last active November 24, 2019 12:33
Show Gist options
  • Save jdevoo/23c0fad1b16995592c30dbcc68b5bcb9 to your computer and use it in GitHub Desktop.
Save jdevoo/23c0fad1b16995592c30dbcc68b5bcb9 to your computer and use it in GitHub Desktop.

gatttool

obtain mac with hcitool lescan (here FD:19:AF:BA:73:C0)

gatttool -b FD:19:AF:BA:73:C0 -t random --char-desc

spot the following lines (see source)

handle = 0x003f, uuid = ef680406-9b35-4933-9b10-52ffa9740042
handle = 0x0040, uuid = 00002902-0000-1000-8000-00805f9b34fb

handle 0x40 is the CCCD to get notifications from the motion service (0406 raw data characteristic)

gatttool -b FD:19:AF:BA:73:C0 -t random --char-write-req --handle 0x40 --value 0100 --listen

by writing 0100 (msb first?) to the handle, we can subscribe to the values in hex

bash

IFS=$'\n'
while true; do
  timeout 10s gatttool -b FD:19:AF:BA:73:C0 -t random --char-write-req --handle 0x40 --value 0100 --listen | cut -d ' ' -f 6-11
  echo $(date +'%F %T')
  sleep 185s
done

node

sudo setcap cap_net_raw+eip $(eval readlink -f /opt/node-v8.16.2-linux-armv7l/bin/node)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment