update man page

fix test scripts
This commit is contained in:
Simon Stürz 2015-08-04 19:32:21 +02:00 committed by Michael Zanetti
parent 214cbb7f3e
commit e358fbda71
30 changed files with 69 additions and 185 deletions

17
debian/guhd.1 vendored
View File

@ -1,6 +1,6 @@
.\" Manpage for guhd. .\" Manpage for guhd.
.\" Contact simon.stuerz@guh.guru to correct errors or typos. .\" Contact simon.stuerz@guh.guru to correct errors or typos.
.TH man 1 "June 2015" "1.1" "guhd man page" .TH man 1 "August 2015" "1.2" "guhd man page"
.SH NAME .SH NAME
guhd \- Server for home automation systems guhd \- Server for home automation systems
.SH SYNOPSIS .SH SYNOPSIS
@ -38,11 +38,21 @@ Print the debug messages from the device manager.
.IP \fIHardware\fR\ (default\ disabled) .IP \fIHardware\fR\ (default\ disabled)
Print the debug messages from hardware resources in guh. Print the debug messages from hardware resources in guh.
.IP \fIJsonRpc\fR\ (default\ disabled) .IP \fIJsonRpc\fR\ (default\ disabled)
Print the debug messages from JSON-RPC interface. Print the debug messages from JSON-RPC API.
.IP \fILogEngine\fR\ (default\ disabled) .IP \fILogEngine\fR\ (default\ disabled)
Print the debug messages from logging engine. Print the debug messages from logging engine.
.IP \fIRest\fR\ (default\ disbaled)
Print the debug messages from REST API.
.IP \fIRuleEngine\fR\ (default\ enabled) .IP \fIRuleEngine\fR\ (default\ enabled)
Print the debug messages from the rule engine. Print the debug messages from the rule engine.
.IP \fITcpServer\fR\ (default\ disabled)
Print the debug messages from the TCP server.
.IP \fIWarning\fR\ (default\ enabled)
Print warnings.
.IP \fIWebServer\fR\ (default\ enabled)
Print the debug messages from the web server.
.IP \fIWebSocketServer\fR\ (default\ enabled)
Print the debug messages from the websocket server.
.TP .TP
\fBDebug\ categories\ for\ plugins:\fR \fBDebug\ categories\ for\ plugins:\fR
Since guh loads the plugins dynamically, the list of supported Since guh loads the plugins dynamically, the list of supported
@ -58,6 +68,9 @@ To start guhd in the foreground, disable debug messages from the DeviceManager
and enable debug messages for JsonRpc and LogEngine: and enable debug messages for JsonRpc and LogEngine:
.IP .IP
$ guhd -n -d NoDeviceManager JsonRpc LogEngine $ guhd -n -d NoDeviceManager JsonRpc LogEngine
.SH FILES
.TP
The settings of the guh server can be found in \fI/etc/guh/guhd.conf\fR
.SH SEE ALSO .SH SEE ALSO
Full developer documentation at: <http://dev.guh.guru> Full developer documentation at: <http://dev.guh.guru>
.br .br

View File

@ -28,6 +28,7 @@
\section2 Quicklinks \section2 Quicklinks
\list \list
\li \l{All guh Classes} \li \l{All guh Classes}
\li \l{All Modules}
\endlist \endlist
*/ */

View File

@ -12,7 +12,7 @@
transport channel is not based on HTTP. It is an internal RPC mechanism to allow communication transport channel is not based on HTTP. It is an internal RPC mechanism to allow communication
between the guh Server and the main controller interface. This communication socket is not meant between the guh Server and the main controller interface. This communication socket is not meant
to be exported to the outside of the of the systen as it allows arbitrary commands to manipulate to be exported to the outside of the of the systen as it allows arbitrary commands to manipulate
the system. A more limited REST API implementation might be added in the main controller interface. the system.
The JSON message protocol communicates by exchanging JSON Objects with the following properties: The JSON message protocol communicates by exchanging JSON Objects with the following properties:
\list \list
@ -34,14 +34,12 @@
Parameters are optional if the type is the type is prefixed with "o:" for optional. Parameters are optional if the type is the type is prefixed with "o:" for optional.
\section1 Communicating with the server \section1 Communicating with the server
The server listens on TCP port 1234 for incoming TCP connections. It will respond to incoming The server listens by default on TCP port 2222 for incoming TCP connections. It will respond to incoming connections with a some information about the server. Telnet can be used to issue commands for testing.
connections with a some information about the server. Telnet can be used to issue commands for
testing.
An example how to communicate with the API using telnet on the same host where the guh server An example how to communicate with the API using telnet on the same host where the guh server
is running: is running:
\code \code
$ telnet localhost 1234 $ telnet localhost 2222
\endcode \endcode
\code \code
Trying 127.0.0.1... Trying 127.0.0.1...
@ -49,9 +47,9 @@
Escape character is '^]'. Escape character is '^]'.
{ {
"id": 0, "id": 0,
"protocol version": 9, "protocol version": 28,
"server": "guh JSONRPC interface", "server": "guh JSONRPC interface",
"version": "0.2.0" "version": "0.6.0"
} }
\endcode \endcode
Now the connection is established and waits for commands. Now the connection is established and waits for commands.
@ -163,7 +161,7 @@
} }
\endcode \endcode
\section1 API Description \section1 Newest JSON-RPC API
\quotefile tests/auto/api.json \quotefile tests/auto/api.json
*/ */

View File

@ -62,11 +62,11 @@ int main(int argc, char *argv[])
s_loggingFilters.insert("DeviceManager", true); s_loggingFilters.insert("DeviceManager", true);
s_loggingFilters.insert("RuleEngine", true); s_loggingFilters.insert("RuleEngine", true);
s_loggingFilters.insert("Connection", true); s_loggingFilters.insert("Connection", true);
s_loggingFilters.insert("TcpServer", true); s_loggingFilters.insert("TcpServer", false);
s_loggingFilters.insert("WebServer", true); s_loggingFilters.insert("WebServer", false);
s_loggingFilters.insert("WebSocketServer", true); s_loggingFilters.insert("WebSocketServer", false);
s_loggingFilters.insert("JsonRpc", false); s_loggingFilters.insert("JsonRpc", false);
s_loggingFilters.insert("Rest", true); s_loggingFilters.insert("Rest", false);
s_loggingFilters.insert("Hardware", false); s_loggingFilters.insert("Hardware", false);
s_loggingFilters.insert("LogEngine", false); s_loggingFilters.insert("LogEngine", false);

View File

@ -1,34 +0,0 @@
From af93f794e40ebfd342d2bb0b1b050c7b2a6224f5 Mon Sep 17 00:00:00 2001
From: Michael Zanetti <mzanetti@kde.org>
Date: Fri, 10 Oct 2014 00:19:56 +0200
Subject: [PATCH] fix cmdmgr
---
tests/scripts/cmdmgr.py | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/tests/scripts/cmdmgr.py b/tests/scripts/cmdmgr.py
index da3d430..6930e06 100755
--- a/tests/scripts/cmdmgr.py
+++ b/tests/scripts/cmdmgr.py
@@ -262,13 +262,13 @@ def add_device():
print "Empty deviceClass. Can't continue"
return
deviceClass = get_deviceClass(deviceClassId)
- print "createmethod is", deviceClass['createMethod']
- if deviceClass['createMethod'] == "CreateMethodUser":
+ print "createmethods are", deviceClass['createMethods']
+ if "CreateMethodUser" in deviceClass['createMethods']:
add_configured_device(deviceClassId)
- elif deviceClass['createMethod'] == "CreateMethodDiscovery":
+ elif "CreateMethodDiscovery" in deviceClass['createMethods']:
deviceDescriptorId = discover_device(deviceClassId)
add_discovered_device(deviceClassId, deviceDescriptorId)
- elif deviceClass['createMethod'] == "CreateMethodAuto":
+ elif "CreateMethodAuto" in deviceClass['createMethods']:
print "Can't create this device manually. It'll be created automatically when hardware is discovered."
def select_device():
--
2.1.0

View File

@ -1,94 +0,0 @@
From 83d98f475710868cb5c626af43415d94520964f3 Mon Sep 17 00:00:00 2001
From: Michael Zanetti <mzanetti@kde.org>
Date: Fri, 10 Oct 2014 01:14:39 +0200
Subject: [PATCH] fix some plugin's json
---
libguh/plugin/deviceplugin.cpp | 6 ++++++
plugins/deviceplugins/lircd/devicepluginlircd.json | 2 +-
.../deviceplugins/openweathermap/devicepluginopenweathermap.json | 8 ++++----
server/jsonrpc/jsontypes.cpp | 1 +
4 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/libguh/plugin/deviceplugin.cpp b/libguh/plugin/deviceplugin.cpp
index a88fd7e..d90ea31 100644
--- a/libguh/plugin/deviceplugin.cpp
+++ b/libguh/plugin/deviceplugin.cpp
@@ -163,6 +163,7 @@ QList<DeviceClass> DevicePlugin::supportedDevices() const
deviceClass.setCreateMethods(createMethods);
deviceClass.setDiscoveryParamTypes(parseParamTypes(jo.value("discoveryParamTypes").toArray()));
+ qDebug() << "loaded deviceClass" << deviceClass.discoveryParamTypes();
QString setupMethod = jo.value("setupMethod").toString();
if (setupMethod == "pushButton") {
@@ -293,6 +294,11 @@ QList<ParamType> DevicePlugin::parseParamTypes(const QJsonArray &array) const
foreach (const QJsonValue &paramTypesJson, array) {
QJsonObject pt = paramTypesJson.toObject();
QVariant::Type t = QVariant::nameToType(pt.value("type").toString().toLatin1().data());
+ Q_ASSERT_X(t != QVariant::Invalid,
+ pluginName().toLatin1().data(),
+ QString("Invalid type %1 for param %2 in json file.")
+ .arg(pt.value("type").toString())
+ .arg(pt.value("name").toString()).toLatin1().data());
ParamType paramType(pt.value("name").toString(), t, pt.value("defaultValue").toVariant());
QVariantList allowedValues;
foreach (const QJsonValue &allowedTypesJson, pt.value("allowedValues").toArray()) {
diff --git a/plugins/deviceplugins/lircd/devicepluginlircd.json b/plugins/deviceplugins/lircd/devicepluginlircd.json
index 0f75dc9..976ab3a 100644
--- a/plugins/deviceplugins/lircd/devicepluginlircd.json
+++ b/plugins/deviceplugins/lircd/devicepluginlircd.json
@@ -23,7 +23,7 @@
"paramTypes": [
{
"name": "button",
- "type": "string"
+ "type": "QString"
},
{
"name": "repeat",
diff --git a/plugins/deviceplugins/openweathermap/devicepluginopenweathermap.json b/plugins/deviceplugins/openweathermap/devicepluginopenweathermap.json
index aac6f81..cdc8e1e 100644
--- a/plugins/deviceplugins/openweathermap/devicepluginopenweathermap.json
+++ b/plugins/deviceplugins/openweathermap/devicepluginopenweathermap.json
@@ -13,21 +13,21 @@
"discoveryParamTypes": [
{
"name": "location",
- "type": "string"
+ "type": "QString"
}
],
"paramTypes": [
{
"name": "location",
- "type": "string"
+ "type": "QString"
},
{
"name": "country",
- "type": "string"
+ "type": "QString"
},
{
"name": "id",
- "type": "string"
+ "type": "QString"
}
],
"actionTypes": [
diff --git a/server/jsonrpc/jsontypes.cpp b/server/jsonrpc/jsontypes.cpp
index dc96635..cece93f 100644
--- a/server/jsonrpc/jsontypes.cpp
+++ b/server/jsonrpc/jsontypes.cpp
@@ -371,6 +371,7 @@ QVariantMap JsonTypes::packDeviceClass(const DeviceClass &deviceClass)
}
QVariantList discoveryParamTypes;
foreach (const ParamType &paramType, deviceClass.discoveryParamTypes()) {
+ qDebug() << "packing discoverparam" << packParamType(paramType);
discoveryParamTypes.append(packParamType(paramType));
}
--
2.1.0

View File

@ -10,36 +10,36 @@ elif [ -z $2 ]; then
else else
if [ $2 == "elroremote" ]; then if [ $2 == "elroremote" ]; then
# Adds an ELRO remote control on channel 00000 # Adds an ELRO remote control on channel 00000
(echo '{"id":1, "method":"Devices.AddConfiguredDevice", "params":{"deviceClassId": "{d85c1ef4-197c-4053-8e40-707aa671d302}","deviceParams":{"channel1":"false", "channel2":"false", "channel3":"false", "channel4": "false", "channel5":"false" }}}'; sleep 1) | nc $1 1234 (echo '{"id":1, "method":"Devices.AddConfiguredDevice", "params":{"deviceClassId": "{d85c1ef4-197c-4053-8e40-707aa671d302}","deviceParams":{"channel1":"false", "channel2":"false", "channel3":"false", "channel4": "false", "channel5":"false" }}}'; sleep 1) | nc $1 2222
elif [ $2 == "elroswitch" ]; then elif [ $2 == "elroswitch" ]; then
# Adds a ELRO power switch on channel 00000 and group D # Adds a ELRO power switch on channel 00000 and group D
(echo '{"id":1, "method":"Devices.AddConfiguredDevice", "params":{"deviceClassId": "{308ae6e6-38b3-4b3a-a513-3199da2764f8}","deviceParams":{"channel1":"false","channel2":"false", "channel3":"false", "channel4": "false","channel5":"false","A":"true","B":"false","C":"false","D":"false","E":"false" }}}'; sleep 1) | nc $1 1234 (echo '{"id":1, "method":"Devices.AddConfiguredDevice", "params":{"deviceClassId": "{308ae6e6-38b3-4b3a-a513-3199da2764f8}","deviceParams":{"channel1":"false","channel2":"false", "channel3":"false", "channel4": "false","channel5":"false","A":"true","B":"false","C":"false","D":"false","E":"false" }}}'; sleep 1) | nc $1 2222
elif [ $2 == "intertechnoremote" ]; then elif [ $2 == "intertechnoremote" ]; then
# Adds an intertechno remote control # Adds an intertechno remote control
(echo '{"id":1, "method":"Devices.AddConfiguredDevice", "params":{"deviceClassId": "{ab73ad2f-6594-45a3-9063-8f72d365c5e5}","deviceParams":{"familyCode":"J"}}}'; sleep 1) | nc $1 1234 (echo '{"id":1, "method":"Devices.AddConfiguredDevice", "params":{"deviceClassId": "{ab73ad2f-6594-45a3-9063-8f72d365c5e5}","deviceParams":{"familyCode":"J"}}}'; sleep 1) | nc $1 2222
# elif [ $2 == "meisteranker" ]; then # elif [ $2 == "meisteranker" ]; then
# # Adds an intertechno remote control # # Adds an intertechno remote control
# (echo '{"id":1, "method":"Devices.AddConfiguredDevice", "params":{"deviceClassId": "{e37e9f34-95b9-4a22-ae4f-e8b874eec871}","deviceParams":{"id":"1"}}}'; sleep 1) | nc $1 1234 # (echo '{"id":1, "method":"Devices.AddConfiguredDevice", "params":{"deviceClassId": "{e37e9f34-95b9-4a22-ae4f-e8b874eec871}","deviceParams":{"id":"1"}}}'; sleep 1) | nc $1 2222
elif [ $2 == "wifidetector" ]; then elif [ $2 == "wifidetector" ]; then
# Adds a WiFi detector # Adds a WiFi detector
(echo '{"id":1, "method":"Devices.AddConfiguredDevice", "params":{"deviceClassId": "{bd216356-f1ec-4324-9785-6982d2174e17}","deviceParams":{"mac":"90:cf:15:1b:ce:bb"}}}'; sleep 1) | nc $1 1234 (echo '{"id":1, "method":"Devices.AddConfiguredDevice", "params":{"deviceClassId": "{bd216356-f1ec-4324-9785-6982d2174e17}","deviceParams":{"mac":"90:cf:15:1b:ce:bb"}}}'; sleep 1) | nc $1 2222
elif [ $2 == "mock1" ]; then elif [ $2 == "mock1" ]; then
# Adds a Mock device # Adds a Mock device
(echo '{"id":1, "method":"Devices.AddConfiguredDevice", "params":{"deviceClassId": "{753f0d32-0468-4d08-82ed-1964aab03298}","deviceParams":{"httpport":"8081"}}}'; sleep 1) | nc $1 1234 (echo '{"id":1, "method":"Devices.AddConfiguredDevice", "params":{"deviceClassId": "{753f0d32-0468-4d08-82ed-1964aab03298}","deviceParams":{"httpport":"8081"}}}'; sleep 1) | nc $1 2222
elif [ $2 == "mock2" ]; then elif [ $2 == "mock2" ]; then
# Adds a Mock device # Adds a Mock device
(echo '{"id":1, "method":"Devices.AddConfiguredDevice", "params":{"deviceClassId": "{753f0d32-0468-4d08-82ed-1964aab03298}","deviceParams":{"httpport":"8082"}}}'; sleep 1) | nc $1 1234 (echo '{"id":1, "method":"Devices.AddConfiguredDevice", "params":{"deviceClassId": "{753f0d32-0468-4d08-82ed-1964aab03298}","deviceParams":{"httpport":"8082"}}}'; sleep 1) | nc $1 2222
elif [ $2 == "openweathermap" ]; then elif [ $2 == "openweathermap" ]; then
(echo '{"id":1, "method":"Devices.AddConfiguredDevice", "params":{"deviceClassId": "{985195aa-17ad-4530-88a4-cdd753d747d7}","deviceDescriptorId":"'$4'"}}'; sleep 1) | nc $1 1234 (echo '{"id":1, "method":"Devices.AddConfiguredDevice", "params":{"deviceClassId": "{985195aa-17ad-4530-88a4-cdd753d747d7}","deviceDescriptorId":"'$4'"}}'; sleep 1) | nc $1 2222
elif [ $2 == "wol" ]; then elif [ $2 == "wol" ]; then
(echo '{"id":1, "method":"Devices.AddConfiguredDevice", "params":{"deviceClassId": "{3c8f2447-dcd0-4882-8c09-99e579e4d24c}","deviceParams":{"mac":"'$3'", "name":"Wohnzimmer-PC"}}}'; sleep 1) | nc $1 1234 (echo '{"id":1, "method":"Devices.AddConfiguredDevice", "params":{"deviceClassId": "{3c8f2447-dcd0-4882-8c09-99e579e4d24c}","deviceParams":{"mac":"'$3'", "name":"Wohnzimmer-PC"}}}'; sleep 1) | nc $1 2222
elif [ $2 == "lirc" ]; then elif [ $2 == "lirc" ]; then
(echo '{"id":1, "method":"Devices.AddConfiguredDevice", "params":{"deviceClassId": "{5c2bc4cd-ba6c-4052-b6cd-1db83323ea22}","deviceParams":{"remoteName":"'$3'"}}}'; sleep 1) | nc $1 1234 (echo '{"id":1, "method":"Devices.AddConfiguredDevice", "params":{"deviceClassId": "{5c2bc4cd-ba6c-4052-b6cd-1db83323ea22}","deviceParams":{"remoteName":"'$3'"}}}'; sleep 1) | nc $1 2222
elif [ $2 == "discovered" ]; then elif [ $2 == "discovered" ]; then
if [ -z $4]; then if [ -z $4]; then
echo "usage $0 host device [deviceClassId descriptorId]. In case of a discovered device, deviceClassId and descriptorId are mandatory." echo "usage $0 host device [deviceClassId descriptorId]. In case of a discovered device, deviceClassId and descriptorId are mandatory."
else else
(echo '{"id":1, "method":"Devices.AddConfiguredDevice", "params":{"deviceClassId": "'$3'", "deviceDescriptorId": "'$4'"}}'; sleep 1) | nc $1 1234 (echo '{"id":1, "method":"Devices.AddConfiguredDevice", "params":{"deviceClassId": "'$3'", "deviceDescriptorId": "'$4'"}}'; sleep 1) | nc $1 2222
fi fi
else else
echo "unknown type $2. Possible values are: elroremote, elroswitch, intertechnoremote, wifidetector, mock1, mock2, openweathermap, lirc, discovered. (In case of discovered, a deviceDescriptorId is required)" echo "unknown type $2. Possible values are: elroremote, elroswitch, intertechnoremote, wifidetector, mock1, mock2, openweathermap, lirc, discovered. (In case of discovered, a deviceDescriptorId is required)"

View File

@ -3,5 +3,5 @@
if [ -z $2 ]; then if [ -z $2 ]; then
echo "usage: $0 host user password sendTo" echo "usage: $0 host user password sendTo"
else else
(echo '{"id":1, "method":"Devices.AddConfiguredDevice", "params":{"deviceClassId": "{3869884a-1592-4b8f-84a7-994be18ff555}","deviceParams":{"user":"'$2'", "password":"'$3'", "recipient":"'$4'"}}}'; sleep 1) | nc $1 1234 (echo '{"id":1, "method":"Devices.AddConfiguredDevice", "params":{"deviceClassId": "{3869884a-1592-4b8f-84a7-994be18ff555}","deviceParams":{"user":"'$2'", "password":"'$3'", "recipient":"'$4'"}}}'; sleep 1) | nc $1 2222
fi fi

View File

@ -3,10 +3,10 @@
if test -z $5; then if test -z $5; then
echo "usage: $0 host sourceDevice eventTypeId targetDeviceId actionTypeId [paramname paramvalue]" echo "usage: $0 host sourceDevice eventTypeId targetDeviceId actionTypeId [paramname paramvalue]"
elif test -z $6; then elif test -z $6; then
(echo '{"id":1, "method":"Rules.AddRule", "params":{"eventDescriptor": {"eventTypeId": "'$3'", "deviceId":"'$2'"}, "actions": [ { "deviceId":"'$4'", "actionTypeId":"'$5'"}]}}'; sleep 1) | nc $1 1234 (echo '{"id":1, "method":"Rules.AddRule", "params":{"eventDescriptor": {"eventTypeId": "'$3'", "deviceId":"'$2'"}, "actions": [ { "deviceId":"'$4'", "actionTypeId":"'$5'"}]}}'; sleep 1) | nc $1 2222
elif test -z $7; then elif test -z $7; then
echo "usage: $0 host sourceDevice eventTypeId targetDeviceId actionTypeId [paramname paramvalue]" echo "usage: $0 host sourceDevice eventTypeId targetDeviceId actionTypeId [paramname paramvalue]"
else else
(echo '{"id":1, "method":"Rules.AddRule", "params":{"event": {"eventTypeId": "'$3'", "deviceId":"'$2'"}, "actions": [ { "deviceId":"'$4'", "actionTypeId":"'$5'", "params":{"'$6'":"'$7'"}}]}}'; sleep 1) | nc $1 1234 (echo '{"id":1, "method":"Rules.AddRule", "params":{"event": {"eventTypeId": "'$3'", "deviceId":"'$2'"}, "actions": [ { "deviceId":"'$4'", "actionTypeId":"'$5'", "params":{"'$6'":"'$7'"}}]}}'; sleep 1) | nc $1 2222
# (echo '{"id":1, "method":"Rules.AddRule", "params":{"event": {"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 # (echo '{"id":1, "method":"Rules.AddRule", "params":{"event": {"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 2222
fi fi

View File

@ -3,14 +3,14 @@
if [ -z $3 ]; then if [ -z $3 ]; then
echo "usage: $0 host actionTypeId deviceId [paramname paramvalue] [paramname paramvalue]" echo "usage: $0 host actionTypeId deviceId [paramname paramvalue] [paramname paramvalue]"
elif [ -z $4 ]; then elif [ -z $4 ]; then
(echo '{"id":1, "method":"Actions.ExecuteAction","params":{"actionTypeId": "{'$2'}", "deviceId":"{'$3'}"}}'; sleep 1) | nc $1 1234 (echo '{"id":1, "method":"Actions.ExecuteAction","params":{"actionTypeId": "{'$2'}", "deviceId":"{'$3'}"}}'; sleep 1) | nc $1 2222
elif [ -z $5 ]; then elif [ -z $5 ]; then
echo "usage: $0 host actionTypeId deviceId [paramname paramvalue] [paramname paramvalue]" echo "usage: $0 host actionTypeId deviceId [paramname paramvalue] [paramname paramvalue]"
elif [ -z $6 ]; then elif [ -z $6 ]; then
echo calling.. $4 $5 echo calling.. $4 $5
(echo '{"id":1, "method":"Actions.ExecuteAction","params":{"actionTypeId": "{'$2'}", "deviceId":"{'$3'}","params":[{ "name": "'$4'", "value":"'$5'"}]}}'; sleep 1) | nc $1 1234 (echo '{"id":1, "method":"Actions.ExecuteAction","params":{"actionTypeId": "{'$2'}", "deviceId":"{'$3'}","params":[{ "name": "'$4'", "value":"'$5'"}]}}'; sleep 1) | nc $1 2222
elif [ -z $7 ]; then elif [ -z $7 ]; then
echo "usage: $0 host actionTypeId deviceId [paramname paramvalue] [paramname paramvalue]" echo "usage: $0 host actionTypeId deviceId [paramname paramvalue] [paramname paramvalue]"
else else
(echo '{"id":1, "method":"Actions.ExecuteAction","params":{"actionTypeId": "{'$2'}", "deviceId":"{'$3'}","params":[{"name": "'$4'", "value":"'$5'"}, {"name": "'$6'", "value": "'$7'"}]}}'; sleep 1) | nc $1 1234 (echo '{"id":1, "method":"Actions.ExecuteAction","params":{"actionTypeId": "{'$2'}", "deviceId":"{'$3'}","params":[{"name": "'$4'", "value":"'$5'"}, {"name": "'$6'", "value": "'$7'"}]}}'; sleep 1) | nc $1 2222
fi fi

View File

@ -3,5 +3,5 @@
if [ -z $2 ]; then if [ -z $2 ]; then
echo "usage: $0 host actionTypeId" echo "usage: $0 host actionTypeId"
else else
(echo '{"id":1, "method":"Actions.GetActionType", "params":{"actionTypeId":"'$2'"}}'; sleep 1) | nc $1 1234 (echo '{"id":1, "method":"Actions.GetActionType", "params":{"actionTypeId":"'$2'"}}'; sleep 1) | nc $1 2222
fi fi

View File

@ -3,5 +3,5 @@
if [ -z $2 ]; then if [ -z $2 ]; then
echo "usage: $0 host deviceClassId" echo "usage: $0 host deviceClassId"
else else
(echo '{"id":1, "method":"Devices.GetActionTypes", "params":{"deviceClassId":"'$2'"}}'; sleep 1) | nc $1 1234 (echo '{"id":1, "method":"Devices.GetActionTypes", "params":{"deviceClassId":"'$2'"}}'; sleep 1) | nc $1 2222
fi fi

View File

@ -3,5 +3,5 @@
if [ -z $1 ]; then if [ -z $1 ]; then
echo "usage: $0 host" echo "usage: $0 host"
else else
(echo '{"id":1, "method":"Devices.GetConfiguredDevices"}'; sleep 1) | nc $1 1234 (echo '{"id":1, "method":"Devices.GetConfiguredDevices"}'; sleep 1) | nc $1 2222
fi fi

View File

@ -3,9 +3,9 @@
if [ -z $2 ]; then if [ -z $2 ]; then
echo "usage $0 host deviceclassid [paramname paramvalue]" echo "usage $0 host deviceclassid [paramname paramvalue]"
elif [ -z $3 ]; then elif [ -z $3 ]; then
(echo '{"id":1, "method":"Devices.GetDiscoveredDevices", "params":{"deviceClassId":"'$2'", "discoveryParams": {"location":""}}}'; sleep 6) | nc $1 1234 (echo '{"id":1, "method":"Devices.GetDiscoveredDevices", "params":{"deviceClassId":"'$2'", "discoveryParams": {"location":""}}}'; sleep 6) | nc $1 2222
elif [ -z $4 ]; then elif [ -z $4 ]; then
echo "usage $0 host deviceclassid [paramname paramvalue]" echo "usage $0 host deviceclassid [paramname paramvalue]"
else else
(echo '{"id":1, "method":"Devices.GetDiscoveredDevices", "params":{"deviceClassId":"'$2'", "discoveryParams": {"'$3'":"'$4'"}}}'; sleep 6) | nc $1 1234 (echo '{"id":1, "method":"Devices.GetDiscoveredDevices", "params":{"deviceClassId":"'$2'", "discoveryParams": {"'$3'":"'$4'"}}}'; sleep 6) | nc $1 2222
fi fi

View File

@ -3,5 +3,5 @@
if [ -z $2 ]; then if [ -z $2 ]; then
echo "usage: $0 host deviceClassId" echo "usage: $0 host deviceClassId"
else else
(echo '{"id":1, "method":"Devices.GetEventTypes", "params":{"deviceClassId":"'$2'"}}'; sleep 1) | nc $1 1234 (echo '{"id":1, "method":"Devices.GetEventTypes", "params":{"deviceClassId":"'$2'"}}'; sleep 1) | nc $1 2222
fi fi

View File

@ -3,5 +3,5 @@
if [ -z $2 ]; then if [ -z $2 ]; then
echo "usage $0 host pluginid" echo "usage $0 host pluginid"
else else
(echo '{"id":1, "method":"Devices.GetPluginConfiguration", "params":{"pluginId":"'$2'"}}'; sleep 1) | nc $1 1234 (echo '{"id":1, "method":"Devices.GetPluginConfiguration", "params":{"pluginId":"'$2'"}}'; sleep 1) | nc $1 2222
fi fi

View File

@ -3,5 +3,5 @@
if [ -z $1 ]; then if [ -z $1 ]; then
echo "usage $0 host" echo "usage $0 host"
else else
(echo '{"id":1, "method":"Devices.GetPlugins"}'; sleep 1) | nc $1 1234 (echo '{"id":1, "method":"Devices.GetPlugins"}'; sleep 1) | nc $1 2222
fi fi

View File

@ -3,5 +3,5 @@
if [ -z $1 ]; then if [ -z $1 ]; then
echo "usage: $0 host" echo "usage: $0 host"
else else
(echo '{"id":1, "method":"Rules.GetRules"}'; sleep 1) | nc $1 1234 (echo '{"id":1, "method":"Rules.GetRules"}'; sleep 1) | nc $1 2222
fi fi

View File

@ -3,5 +3,5 @@
if [ -z $2 ]; then if [ -z $2 ]; then
echo "usage: $0 host deviceClassId" echo "usage: $0 host deviceClassId"
else else
(echo '{"id":1, "method":"Devices.GetStateTypes", "params":{"deviceClassId":"'$2'"}}'; sleep 1) | nc $1 1234 (echo '{"id":1, "method":"Devices.GetStateTypes", "params":{"deviceClassId":"'$2'"}}'; sleep 1) | nc $1 2222
fi fi

View File

@ -3,5 +3,5 @@
if [ -z $3 ]; then if [ -z $3 ]; then
echo "usage: $0 host deviceId stateTypeId" echo "usage: $0 host deviceId stateTypeId"
else else
(echo '{"id":1, "method":"Devices.GetStateValue", "params":{"deviceId":"'$2'", "stateTypeId":"'$3'"}}'; sleep 1) | nc $1 1234 (echo '{"id":1, "method":"Devices.GetStateValue", "params":{"deviceId":"'$2'", "stateTypeId":"'$3'"}}'; sleep 1) | nc $1 2222
fi fi

View File

@ -3,7 +3,7 @@
if [ -z $1 ]; then if [ -z $1 ]; then
echo "usage $0 host" echo "usage $0 host"
elif [ -z $2 ]; then elif [ -z $2 ]; then
(echo '{"id":1, "method":"Devices.GetSupportedDevices"}'; sleep 1) | nc $1 1234 (echo '{"id":1, "method":"Devices.GetSupportedDevices"}'; sleep 1) | nc $1 2222
else else
(echo '{"id":1, "method":"Devices.GetSupportedDevices", "params":{"vendorId":"'$2'"}}'; sleep 1) | nc $1 1234 (echo '{"id":1, "method":"Devices.GetSupportedDevices", "params":{"vendorId":"'$2'"}}'; sleep 1) | nc $1 2222
fi fi

View File

@ -3,5 +3,5 @@
if [ -z $1 ]; then if [ -z $1 ]; then
echo "usage $0 host" echo "usage $0 host"
else else
(echo '{"id":1, "method":"Devices.GetSupportedVendors"}'; sleep 1) | nc $1 1234 (echo '{"id":1, "method":"Devices.GetSupportedVendors"}'; sleep 1) | nc $1 2222
fi fi

View File

@ -3,5 +3,5 @@
if [ -z $1 ]; then if [ -z $1 ]; then
echo "usage: $0 host" echo "usage: $0 host"
else else
(echo '{"id":1, "method": "JSONRPC.Version"}'; sleep 1) | nc $1 1234 (echo '{"id":1, "method": "JSONRPC.Version"}'; sleep 1) | nc $1 2222
fi fi

View File

@ -3,5 +3,5 @@
if [ -z $1 ]; then if [ -z $1 ]; then
echo "usage: $0 host" echo "usage: $0 host"
else else
(echo '{"id":1, "method": "JSONRPC.Introspect"}'; sleep 1) | nc $1 1234 (echo '{"id":1, "method": "JSONRPC.Introspect"}'; sleep 1) | nc $1 2222
fi fi

View File

@ -3,9 +3,9 @@
if [ -z $3 ]; then if [ -z $3 ]; then
echo "usage: $0 host justadd|discovery deviceClassId [deviceDescriptorId]" echo "usage: $0 host justadd|discovery deviceClassId [deviceDescriptorId]"
elif [ $2 == "justadd" ]; then elif [ $2 == "justadd" ]; then
(echo '{"id":1, "method":"Devices.PairDevice", "params":{"deviceClassId":"'$3'"}}'; sleep 1) | nc $1 1234 (echo '{"id":1, "method":"Devices.PairDevice", "params":{"deviceClassId":"'$3'"}}'; sleep 1) | nc $1 2222
elif [ $2 == "discovery" ]; then elif [ $2 == "discovery" ]; then
(echo '{"id":1, "method":"Devices.PairDevice", "params":{"deviceClassId":"'$3'", "deviceDescriptorId":"'$4'"}}'; sleep 1) | nc $1 1234 (echo '{"id":1, "method":"Devices.PairDevice", "params":{"deviceClassId":"'$3'", "deviceDescriptorId":"'$4'"}}'; sleep 1) | nc $1 2222
else else
echo "usage: $0 host justadd|discovery deviceClassId [deviceDescriptorId]" echo "usage: $0 host justadd|discovery deviceClassId [deviceDescriptorId]"
fi fi

View File

@ -3,5 +3,5 @@
if [ -z $2 ]; then if [ -z $2 ]; then
echo "usage: $0 host deviceId" echo "usage: $0 host deviceId"
else else
(echo '{"id":1, "method":"Devices.RemoveConfiguredDevice", "params":{"deviceId":"'$2'"}}'; sleep 1) | nc $1 1234 (echo '{"id":1, "method":"Devices.RemoveConfiguredDevice", "params":{"deviceId":"'$2'"}}'; sleep 1) | nc $1 2222
fi fi

View File

@ -3,5 +3,5 @@
if [ -z $2 ]; then if [ -z $2 ]; then
echo "usage: $0 host ruleId" echo "usage: $0 host ruleId"
else else
(echo '{"id":1, "method":"Rules.RemoveRule", "params":{"ruleId":"'$2'"}}'; sleep 1) | nc $1 1234 (echo '{"id":1, "method":"Rules.RemoveRule", "params":{"ruleId":"'$2'"}}'; sleep 1) | nc $1 2222
fi fi

View File

@ -3,5 +3,5 @@
if [ -z $1 ]; then if [ -z $1 ]; then
echo "usage: $0 host deviceId subject body" echo "usage: $0 host deviceId subject body"
else else
(echo '{"id":1, "method":"Actions.ExecuteAction","params":{"actionTypeId": "{054613b0-3666-4dad-9252-e0ebca187edc}", "deviceId":"{'$2'}","params":[{"subject":"'$3'"}, {"body":"'$4'"}]}}'; sleep 1) | nc $1 1234 (echo '{"id":1, "method":"Actions.ExecuteAction","params":{"actionTypeId": "{054613b0-3666-4dad-9252-e0ebca187edc}", "deviceId":"{'$2'}","params":[{"subject":"'$3'"}, {"body":"'$4'"}]}}'; sleep 1) | nc $1 2222
fi fi

View File

@ -3,9 +3,9 @@
if [ -z $4 ]; then if [ -z $4 ]; then
echo "usage $0 host pluginid param1name param1value [param2name param2value]" echo "usage $0 host pluginid param1name param1value [param2name param2value]"
elif [ -z $5 ]; then elif [ -z $5 ]; then
(echo '{"id":1, "method":"Devices.SetPluginConfiguration", "params":{"pluginId":"'$2'", "configuration":[{"'$3'":"'$4'"}]}}'; sleep 1) | nc $1 1234 (echo '{"id":1, "method":"Devices.SetPluginConfiguration", "params":{"pluginId":"'$2'", "configuration":[{"'$3'":"'$4'"}]}}'; sleep 1) | nc $1 2222
elif [ -z $6 ]; then elif [ -z $6 ]; then
echo "usage $0 host pluginid param1name param1value [param2name param2value]" echo "usage $0 host pluginid param1name param1value [param2name param2value]"
else else
(echo '{"id":1, "method":"Devices.SetPluginConfiguration", "params":{"pluginId":"'$2'", "configuration":{[{"'$3'":"'$4'"}, {"'$5'":"'$6'"}]}}}'; sleep 1) | nc $1 1234 (echo '{"id":1, "method":"Devices.SetPluginConfiguration", "params":{"pluginId":"'$2'", "configuration":{[{"'$3'":"'$4'"}, {"'$5'":"'$6'"}]}}}'; sleep 1) | nc $1 2222
fi fi

View File

@ -3,5 +3,5 @@
if [ -z $1 ]; then if [ -z $1 ]; then
echo "usage $0 host" echo "usage $0 host"
else else
(echo '{"id":1, "method":"JSONRPC.SetNotificationStatus", "params":{"enabled":"true"}}'; read) | nc $1 1234 (echo '{"id":1, "method":"JSONRPC.SetNotificationStatus", "params":{"enabled":"true"}}'; read) | nc $1 2222
fi fi