homecontrol: use sqlite with dataset

This commit is contained in:
Konstantin Koslowski 2019-11-05 01:18:25 +01:00
parent c82216b5f9
commit 64f1ce24ad
11 changed files with 286 additions and 118 deletions

Binary file not shown.

15
scripts/actor_command.sh Executable file
View file

@ -0,0 +1,15 @@
#!/bin/bash
ID=${1:-1}
LEVEL=${2:-65280}
COMMAND=set_level
DATA='{"id":"'$ID'", "command":"'$COMMAND'", "data":{"level":"'$LEVEL'"}}'
REQ=POST
URL=http://localhost:5000/actor/command
echo "$REQ $URL --> $DATA"
read -p "continue?" -n 1 cont
curl \
-X $REQ $URL \
-H "Content-Type: application/json" \
-d "$DATA"

9
scripts/actor_get.sh Executable file
View file

@ -0,0 +1,9 @@
#!/bin/bash
REQ=GET
URL=http://localhost:5000/actor/get
echo "$REQ $URL"
read -p "continue?" -n 1 foo
curl \
-X $REQ $URL \
-H "Content-Type: application/json"

11
scripts/actor_get_levels.sh Executable file
View file

@ -0,0 +1,11 @@
#!/bin/bash
ACTORID=${1:-11111111}
LIMIT=${2:-0}
REQ=GET
URL=http://localhost:5000/actor/get_levels/$ACTORID?limit=$LIMIT
echo "$REQ $URL"
read -p "continue?" -n 1 foo
curl \
-X $REQ $URL \
-H "Content-Type: application/json"

9
scripts/sensor_get.sh Executable file
View file

@ -0,0 +1,9 @@
#!/bin/bash
REQ=GET
URL=http://localhost:5000/sensor/get
echo "$REQ $URL"
read -p "continue?" -n 1 foo
curl \
-X $REQ $URL \
-H "Content-Type: application/json"

12
scripts/sensor_get_values.sh Executable file
View file

@ -0,0 +1,12 @@
#!/bin/bash
SENSORID=${1:-11111111}
LIMIT=${2:-0}
REQ=GET
URL=http://localhost:5000/sensor/get_values/$SENSORID?limit=$LIMIT
# URL=http://localhost:5000/sensor/get_values/$SENSORID
echo "$REQ $URL"
read -p "continue?" -n 1 foo
curl \
-X $REQ $URL \
-H "Content-Type: application/json"

15
scripts/sensor_update.sh Executable file
View file

@ -0,0 +1,15 @@
#!/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"