homecontrol/scripts/sensor_update.sh

16 lines
312 B
Bash
Raw Normal View History

2019-11-05 01:18:25 +01:00
#!/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"