#!/bin/bash # PODNAME: cheerlights # ABSTRACT: make hypnocube respond to cheerlights # to change global cheerlights colors # http://www.cheerlights.com/control-cheerlights # Example Tweet: @CheerLights Paint the town red lastcolor="" while true do # let us know that things are still working # echo "clear black ; update" >>/tmp/hypnocube # sleep 0.5 # fetch the cheelightss status and update the hypnocube color=`curl -s http://api.thingspeak.com/channels/1417/field/1/last.json | perl -ne '/.*?"field1":"(.*?)"/ ; print "$1";'` if [ "$color" != "$lastcolor" ] ; then date=`date` echo "$date : $color" lastcolor=$color fi cube 'sphere $color ; update' # and give it a chance to change sleep 10 done # perl pod may get added so lets exit before thats an issue exit ; __END__ =pod =encoding UTF-8 =head1 NAME cheerlights - make hypnocube respond to cheerlights =head1 VERSION version 1.3 =head1 AUTHOR Kevin Mulholland =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2014 by Kevin Mulholland. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut