Create pipe
mkfifo pewpipe
Forward mqtt events into pewpipe:
mosquitto_sub -h 192.168.88.223 -t "/irblaster/johndoe/output" -v | awk '{print $2; fflush();}' | tee -a pewpipe
Script keymapper.sh
#!/bin/bash
OUT_FILE=$1
KEY_NAME=""
echo "out: "$OUT_FILE
while true; do
echo ">>>"
read -p "Enter KEY_NAME: " KEY_NAME
read -p "Wait for keypress: " PIPE_OUT < pewpipe
echo "[Key.$KEY_NAME]:" $PIPE_OUT | tee -a $OUT_FILE
done
./keymapper.sh samsung_keys.ts
Watch changes in output:
tail -f samsung_keys.ts