This repository has been archived on 2026-05-31. You can view files and clone it, but cannot push or open issues or pull requests.
2014-03-31 20:54:26 +02:00

9 lines
672 B
Bash
Executable File

#!/bin/bash
if test -z $5; then
echo "usage: $0 host sourceDevice eventTypeId targetDeviceId actionTypeId"
else
(echo '{"id":1, "method":"Rules.AddRule", "params":{"events": {"eventTypeId": "'$3'", "deviceId":"'$2'", "params":{"power":"true"}}, "actions": [ { "deviceId":"'$4'", "actionTypeId":"'$5'", "params":{"power":"true"}}]}}'; sleep 1) | nc $1 1234
# (echo '{"id":1, "method":"Rules.AddRule", "params":{"events": {"eventTypeId": "'$2'", "deviceId":"'$3'", "params":{"power":"false"}}, "actions": [ { "deviceId":"'$4'", "name":"rule 1", "params":{"power":"false"}},{ "deviceId":"'$5'", "name":"rule 1", "params":{"power":"true"}}]}}'; sleep 1) | nc $1 1234
fi