-
Notifications
You must be signed in to change notification settings - Fork 0
/
sbevmon
37 lines (30 loc) · 872 Bytes
/
sbevmon
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/sh
# monitor event0, event1 and event2 keys and send a raw hexcode to home assistant webhook
WH="87161aac-f0ae-4939-8ad3-4f36b6482bb9"
HA="homeassistant.local"
HP=8123
loopev0() {
while true; do
KEYVAL="$(hexdump "/dev/input/event0" -n 12 | awk '{print $7}')"
if [ -n "$KEYVAL" ]; then
wget --post-data "key=$KEYVAL" http://$HA:$HP/api/webhook/$WH -q -O-
fi
done
}
loopev1() {
while true; do
KEYVAL="$(hexdump "/dev/input/event1" -n 12 | awk '{print $7}')"
if [ -n "$KEYVAL" ]; then
wget --post-data "key=$KEYVAL" http://$HA:$HP/api/webhook/$WH -q -O-
fi
done
}
loopev2() {
while true; do
KEYVAL="$(hexdump "/dev/input/event2" -n 14 | awk '{print $7 $8}')"
if [ -n "$KEYVAL" ]; then
wget --post-data "key=$KEYVAL" http://$HA:$HP/api/webhook/$WH -q -O-
fi
done
}
loopev0 & loopev1 & loopev2 &