added documentation for wakeonlan, googlemail and openweathermap
This commit is contained in:
parent
2e8f031d74
commit
154b8b0aed
@ -16,6 +16,120 @@
|
||||
* *
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
/*!
|
||||
\page googlemail.html
|
||||
\title Google Mail Notification
|
||||
|
||||
\ingroup plugins
|
||||
\ingroup services
|
||||
|
||||
The Google Mail plugin allows you to send a mail notification from your Google mail
|
||||
account by performing an \l{Action}.
|
||||
|
||||
ATTENTION: The password currently will be saved as plain text in the guh configuration file.
|
||||
|
||||
\section1 Examples
|
||||
\section2 Adding a Google Mail Notification service
|
||||
In order to add a Google Mail Notification service you need to configure
|
||||
the "Google Mail login" (user), the password for your Gmail account and the address
|
||||
of the recipient.
|
||||
\code
|
||||
{
|
||||
"id":1,
|
||||
"method":"Devices.AddConfiguredDevice",
|
||||
"params":{
|
||||
"deviceClassId": "{38ed6ffc-f43b-48f8-aea2-8d63cdcad87e}",
|
||||
"deviceParams":{
|
||||
"user":"my.address@gmail.com",
|
||||
"password":"my_secret_password"
|
||||
"sendTo":"recipient@example.com"}
|
||||
}
|
||||
}
|
||||
}
|
||||
\endcode
|
||||
Before the device will be added, the plugin trys to login. If the username or the password
|
||||
are wrong, an error message will be send.
|
||||
\code
|
||||
{
|
||||
"id": 1,
|
||||
"params": {
|
||||
"deviceId": "{0b99ea27-896a-4a23-a044-3f1441f6a9a7}",
|
||||
"errorMessage": "",
|
||||
"success": true
|
||||
},
|
||||
"status": "success"
|
||||
}
|
||||
\endcode
|
||||
|
||||
\section2 Sending a mail notification
|
||||
In order to send a mail notification from a configured Gmail service use following message
|
||||
format.
|
||||
\code
|
||||
{
|
||||
"id":1,
|
||||
"method":"Actions.ExecuteAction",
|
||||
"params":{
|
||||
"actionTypeId": "{fa54f834-34d0-4aaf-b0ab-a165191d39d3}",
|
||||
"deviceId":"{0b99ea27-896a-4a23-a044-3f1441f6a9a7}",
|
||||
"params":{
|
||||
"subject":"GUH notification",
|
||||
"body":"Hello world!"
|
||||
}
|
||||
}
|
||||
}
|
||||
\endcode
|
||||
response...
|
||||
\code
|
||||
{
|
||||
"id": 1,
|
||||
"params": {
|
||||
"errorMessage": "",
|
||||
"success": true
|
||||
},
|
||||
"status": "success"
|
||||
}
|
||||
\endcode
|
||||
|
||||
\section1 Plugin propertys:
|
||||
\section2 Plugin parameters
|
||||
Each configured plugin has following paramters:
|
||||
|
||||
\table
|
||||
\header
|
||||
\li Name
|
||||
\li Description
|
||||
\li Data Type
|
||||
\row
|
||||
\li user
|
||||
\li This parameter holds the username (mail address) for the login
|
||||
\li string
|
||||
\row
|
||||
\li password
|
||||
\li This parameter holds the password for the login
|
||||
\li string
|
||||
\row
|
||||
\li sendTo
|
||||
\li This parameter holds the mail address of the recipient of the notification
|
||||
\li string
|
||||
\endtable
|
||||
|
||||
\section2 Plugin actions:
|
||||
Following list contains all plugin \l{Action}s:
|
||||
\table
|
||||
\header
|
||||
\li Name
|
||||
\li Description
|
||||
\li UUID
|
||||
\row
|
||||
\li sendMail
|
||||
\li This action sends a mail to the recipient address of the configured device
|
||||
with a given subject and text body.
|
||||
\li fa54f834-34d0-4aaf-b0ab-a165191d39d3
|
||||
\endtable
|
||||
|
||||
|
||||
*/
|
||||
|
||||
#include "deviceplugingooglemail.h"
|
||||
|
||||
#include "plugin/device.h"
|
||||
@ -113,6 +227,7 @@ DeviceManager::DeviceError DevicePluginGoogleMail::executeAction(Device *device,
|
||||
qDebug() << "execute action " << sendMailActionTypeId.toString();
|
||||
if(action.actionTypeId() == sendMailActionTypeId){
|
||||
if(!m_smtpClient->login(device->paramValue("user").toString(), device->paramValue("password").toString())){
|
||||
qDebug() << "ERROR: could nt login for sending mail";
|
||||
return DeviceManager::DeviceErrorDeviceParameterError;
|
||||
}
|
||||
m_smtpClient->sendMail(device->paramValue("user").toString(), device->paramValue("sendTo").toString(), action.param("subject").value().toString(), action.param("body").value().toString());
|
||||
|
||||
@ -23,10 +23,151 @@
|
||||
\ingroup plugins
|
||||
\ingroup services
|
||||
|
||||
This plugin gives the possibility to get weather data...
|
||||
This plugin alows you to get the current weather data from \l{http://www.openweathermap.org}.
|
||||
The plugin offers two different search methods: if the user searches for a empty string,
|
||||
the plugin makes an autodetction with the WAN ip and offers the user the found autodetectresult.
|
||||
Otherwise the plugin return the list with the found searchresults.
|
||||
|
||||
\chapter Plugin propertys:
|
||||
\section1 Actions
|
||||
\section1 Examples
|
||||
\section2 Autodetect location
|
||||
If you want to autodetect your location dend a discovery request with an empty string.
|
||||
\code
|
||||
{
|
||||
"id":1,
|
||||
"method":"Devices.GetDiscoveredDevices",
|
||||
"params":{
|
||||
"deviceClassId":"985195aa-17ad-4530-88a4-cdd753d747d7",
|
||||
"discoveryParams": {
|
||||
"location":""
|
||||
}
|
||||
}
|
||||
}
|
||||
\endcode
|
||||
response from autodetection...
|
||||
\code
|
||||
{
|
||||
"id": 1,
|
||||
"params": {
|
||||
"deviceDescriptors": [
|
||||
{
|
||||
"description": "AT",
|
||||
"id": "{75607672-5354-428f-a752-910140c22b18}",
|
||||
"title": "Vienna"
|
||||
}
|
||||
],
|
||||
"errorMessage": "",
|
||||
"success": true
|
||||
},
|
||||
"status": "success"
|
||||
}
|
||||
\endcode
|
||||
\section2 Searching city
|
||||
If you want to search a string send following discovery message:
|
||||
\code
|
||||
{
|
||||
"id":1,
|
||||
"method":"Devices.GetDiscoveredDevices",
|
||||
"params":{
|
||||
"deviceClassId":"985195aa-17ad-4530-88a4-cdd753d747d7",
|
||||
"discoveryParams": {
|
||||
"location":"Vie"
|
||||
}
|
||||
}
|
||||
}
|
||||
\endcode
|
||||
response...
|
||||
\code
|
||||
{
|
||||
"id": 1,
|
||||
"params": {
|
||||
"deviceDescriptors": [
|
||||
{
|
||||
"description": "DE",
|
||||
"id": "{6dc6be43-5bdc-4dbd-bcbf-6f8e1f90000b}",
|
||||
"title": "Viersen"
|
||||
},
|
||||
{
|
||||
"description": "VN",
|
||||
"id": "{af275298-77f1-40b4-843a-d0f3c7aef6bb}",
|
||||
"title": "Viet Tri"
|
||||
},
|
||||
{
|
||||
"description": "DE",
|
||||
"id": "{86a4ab63-41b4-4348-9830-4bf6c87474bf}",
|
||||
"title": "Viernheim"
|
||||
},
|
||||
{
|
||||
"description": "AR",
|
||||
"id": "{3b5f8eea-6159-4375-bd01-1f07de9c3a9d}",
|
||||
"title": "Viedma"
|
||||
},
|
||||
{
|
||||
"description": "FR",
|
||||
"id": "{f3b91f26-3275-4bb4-a594-924202a2124e}",
|
||||
"title": "Vierzon"
|
||||
},
|
||||
{
|
||||
"description": "AT",
|
||||
"id": "{b59d15f7-f52b-43a0-a9c5-a3fa80cbc2bd}",
|
||||
"title": "Vienna"
|
||||
}
|
||||
],
|
||||
"errorMessage": "",
|
||||
"success": true
|
||||
},
|
||||
"status": "success"
|
||||
}
|
||||
\endcode
|
||||
\section2 Adding a discovered city
|
||||
If you want to add a dicovered city send the add "AddConfiguredDevice" message
|
||||
with the deviceDescriptorId from the searchresult list. In this example the id for Vienna.
|
||||
\code
|
||||
{
|
||||
"id":1,
|
||||
"method":"Devices.AddConfiguredDevice",
|
||||
"params":{
|
||||
"deviceClassId":"985195aa-17ad-4530-88a4-cdd753d747d7",
|
||||
"deviceDescriptorId": "b59d15f7-f52b-43a0-a9c5-a3fa80cbc2bd"
|
||||
}
|
||||
}
|
||||
\endcode
|
||||
response...
|
||||
\code
|
||||
{
|
||||
"id": 1,
|
||||
"params": {
|
||||
"deviceId": "{af0f1958-b901-48da-ad97-d4d64af88cf8}",
|
||||
"errorMessage": "",
|
||||
"success": true
|
||||
},
|
||||
"status": "success"
|
||||
}
|
||||
\endcode
|
||||
|
||||
\section1 Plugin propertys:
|
||||
\section2 Plugin parameters
|
||||
Each configured plugin has following paramters:
|
||||
|
||||
\table
|
||||
\header
|
||||
\li Name
|
||||
\li Description
|
||||
\li Data Type
|
||||
\row
|
||||
\li location
|
||||
\li This parameter holds the name of the city
|
||||
\li string
|
||||
\row
|
||||
\li country
|
||||
\li This parameter holds the country of the city
|
||||
\li string
|
||||
\row
|
||||
\li id
|
||||
\li This parameter holds the city id from \l{http://www.openweathermap.org}
|
||||
\li string
|
||||
\endtable
|
||||
|
||||
\section2 Actions
|
||||
Following list contains all plugin \l{Action}s:
|
||||
\table
|
||||
\header
|
||||
@ -35,23 +176,11 @@
|
||||
\li UUID
|
||||
\row
|
||||
\li refresh
|
||||
\li This action refreshes all states. Only, if a state value realy changed
|
||||
a notification get emited.
|
||||
\li This action refreshes all states.
|
||||
\li cfbc6504-d86f-4856-8dfa-97b6fbb385e4
|
||||
\endtable
|
||||
\section1 Events:
|
||||
Following list contains all plugin \l{Event}s:
|
||||
\table
|
||||
\header
|
||||
\li Name
|
||||
\li UUID
|
||||
\li Description
|
||||
\row
|
||||
\li
|
||||
\li
|
||||
\li
|
||||
\endtable
|
||||
\section1 States
|
||||
|
||||
\section2 States
|
||||
Following list contains all plugin \l{State}s:
|
||||
\table
|
||||
\header
|
||||
|
||||
@ -15,6 +15,104 @@
|
||||
* along with guh. If not, see <http://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
/*!
|
||||
\page wakeonlan.html
|
||||
\title Wake On Lan
|
||||
|
||||
\ingroup plugins
|
||||
\ingroup services
|
||||
|
||||
Wake-on-LAN (WOL) is an Ethernet computer networking standard that allows a computer
|
||||
to be turned on or awakened by a network message. This plugin allows you to send a
|
||||
a "magic packet" to a certain mac address in the local network. The WOL service must
|
||||
be enabled on the host computer.
|
||||
|
||||
\section1 Examples
|
||||
\section2 Adding a WOL device
|
||||
In order to add a WOL device you need to know the mac address of the host computer you
|
||||
want to wake up.
|
||||
\code
|
||||
{
|
||||
"id":1,
|
||||
"method":"Devices.AddConfiguredDevice",
|
||||
"params":{
|
||||
"deviceClassId": "{3c8f2447-dcd0-4882-8c09-99e579e4d24c}",
|
||||
"deviceParams":{
|
||||
"mac":"00:11:22:33:44:55",
|
||||
"name":"Wohnzimmer-PC"
|
||||
}
|
||||
}
|
||||
}
|
||||
\endcode
|
||||
response...
|
||||
\code
|
||||
{
|
||||
"id": 1,
|
||||
"params": {
|
||||
"deviceId": "{76347a44-2091-428c-b320-5a8db4c359f6}",
|
||||
"errorMessage": "",
|
||||
"success": true
|
||||
},
|
||||
"status": "success"
|
||||
}
|
||||
\endcode
|
||||
|
||||
\section2 Wake up a device
|
||||
In order to wake up a configured device send following message:
|
||||
\code
|
||||
{
|
||||
"id":1,
|
||||
"method":"Actions.ExecuteAction",
|
||||
"params":{
|
||||
"actionTypeId": "{fb9b9d87-218f-4f0d-9e16-39f8a105029a}",
|
||||
"deviceId":"{76347a44-2091-428c-b320-5a8db4c359f6}"
|
||||
}
|
||||
}
|
||||
\endcode
|
||||
response...
|
||||
\code
|
||||
{
|
||||
"id": 1,
|
||||
"params": {
|
||||
"errorMessage": "",
|
||||
"success": true
|
||||
},
|
||||
"status": "success"
|
||||
}
|
||||
\endcode
|
||||
\section1 Plugin propertys:
|
||||
\section2 Plugin parameters
|
||||
Each configured plugin has following paramters:
|
||||
|
||||
\table
|
||||
\header
|
||||
\li Name
|
||||
\li Description
|
||||
\li Data Type
|
||||
\row
|
||||
\li name
|
||||
\li This parameter holds the name/description of the target computer
|
||||
\li string
|
||||
\row
|
||||
\li mac
|
||||
\li This parameter holds the mac address of the target computer
|
||||
\li string
|
||||
\endtable
|
||||
\section2 Plugin actions:
|
||||
Following list contains all plugin \l{Action}s:
|
||||
\table
|
||||
\header
|
||||
\li Name
|
||||
\li Description
|
||||
\li UUID
|
||||
\row
|
||||
\li wakeup
|
||||
\li This action send the "magic package" to the mac address configured in the device parameter.
|
||||
\li fb9b9d87-218f-4f0d-9e16-39f8a105029a
|
||||
\endtable
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#include "devicepluginwakeonlan.h"
|
||||
|
||||
@ -49,6 +147,8 @@ QList<DeviceClass> DevicePluginWakeOnLan::supportedDevices() const
|
||||
deviceClassWakeOnLan.setName("Wake On Lan");
|
||||
|
||||
QList<ParamType> wolParams;
|
||||
ParamType nameParam("name", QVariant::String);
|
||||
wolParams.append(nameParam);
|
||||
ParamType wolParam("mac", QVariant::String);
|
||||
wolParams.append(wolParam);
|
||||
|
||||
|
||||
@ -32,7 +32,7 @@ else
|
||||
elif [ $2 == "openweathermap" ]; then
|
||||
(echo '{"id":1, "method":"Devices.AddConfiguredDevice", "params":{"deviceClassId": "{985195aa-17ad-4530-88a4-cdd753d747d7}","deviceDescriptorId":"'$4'"}}'; sleep 1) | nc $1 1234
|
||||
elif [ $2 == "wol" ]; then
|
||||
(echo '{"id":1, "method":"Devices.AddConfiguredDevice", "params":{"deviceClassId": "{3c8f2447-dcd0-4882-8c09-99e579e4d24c}","deviceParams":{"mac":"'$3'"}}}'; 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 1234
|
||||
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
|
||||
elif [ $2 == "discovered" ]; then
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
if [ -z $3 ]; then
|
||||
echo "usage: $0 host actionTypeId deviceId [paramname paramvalue]"
|
||||
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 1234
|
||||
elif [ -z $5 ]; then
|
||||
echo "usage: $0 host actionTypeId deviceId [paramname paramvalue]"
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user