Skip to content

Instantly share code, notes, and snippets.

@Breakerz
Created March 26, 2018 15:36
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Breakerz/0a8bbcec890aee6d5ec2262b8934f47e to your computer and use it in GitHub Desktop.
Save Breakerz/0a8bbcec890aee6d5ec2262b8934f47e to your computer and use it in GitHub Desktop.
#!/bin/bash
tmpfile="/tmp/$(cat /dev/urandom | tr -cd 'a-f0-9' | head -c 32)"
if curl -s 'http://api.thingspeak.com/channels/1417/field/2/last.json' > $tmpfile
then
cat $tmpfile| jq -r '.field2'| mosquitto_pub -h 192.168.0.123 -i clientmood -l -t "moodlight/mood"
fi
rm $tmpfile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment