Skip to content

Instantly share code, notes, and snippets.

@reeFridge
Created February 5, 2022 15:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save reeFridge/ad4bd63e558eb545875b21c949b536ff to your computer and use it in GitHub Desktop.
Save reeFridge/ad4bd63e558eb545875b21c949b536ff to your computer and use it in GitHub Desktop.
key_mapping_automation

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment