Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- !/bin/sh
- hex=`echo $1 | tr '[:lower:]' '[:upper:]'`
- a=`echo $hex | cut -c-2`
- b=`echo $hex | cut -c3-4`
- c=`echo $hex | cut -c5-6`
- r=`echo "ibase=16; $a" | bc`
- g=`echo "ibase=16; $b" | bc`
- b=`echo "ibase=16; $c" | bc`
- #post to pimatic
- #generate value to variable, seperated by a comma
- value=$r','$g','$b
- #pimatic username
- user=yourusername
- #pimatic password
- password=yourpassword
- #variable you want to change
- variable=test
- #pimatic ip address
- pimaticip=192.168.0.0
- #do the actual variable change through patching
- curl -s -X PATCH --header "Content-Type:application/json" --data '{"type": "value", "valueOrExpression": "'$value'"}' --user "$user:$password" http://$pimaticip/api/variables/$variable > /dev/null
- exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement