homecontrol/scripts/sensor_update.sh

15 lines
312 B
Bash
Executable file

#!/bin/bash
REQ=POST
URL=http://localhost:5000/sensor/update
ID=${1:-11111111}
VALUE=${2:-20.2}
TYPE=${3:-temperature}
data="{\"id\":\"$ID\", \"type\":\"$TYPE\", \"value\":$VALUE}"
echo "$REQ $URL $data"
read -p "continue?" -n 1 foo
curl \
-X $REQ $URL \
-H "Content-Type: application/json" \
-d "$data"