Merge PR #108: New Plugin: CoinMarketCap

This commit is contained in:
Jenkins nymea 2019-10-22 01:09:53 +02:00
commit 2d5b7975a3
12 changed files with 315 additions and 152 deletions

4
debian/changelog vendored
View File

@ -1,3 +1,7 @@
nymea-plugins (0.16.0) UNRELEASED; urgency=medium
-- Michael Zanetti <michael.zanetti@guh.io> Fri, 20 Sep 2019 12:40:45 +0200
nymea-plugins (0.15.2) xenial; urgency=medium
[ Bernhard Trinnes ]

15
debian/control vendored
View File

@ -100,6 +100,21 @@ Description: nymea.io plugin for bose soundtouch
This package will install the nymea.io plugin for bose soundtouch.
Package: nymea-plugin-coinmarketcap
Architecture: any
Depends: ${shlibs:Depends},
${misc:Depends},
nymea-plugins-translations,
Description: nymea.io plugin for coin market cap
The nymea daemon is a plugin based IoT (Internet of Things) server. The
server works like a translator for devices, things and services and
allows them to interact.
With the powerful rule engine you are able to connect any device available
in the system and create individual scenes and behaviors for your environment.
.
This package will install the nymea.io plugin for coinmarketcap
Package: nymea-plugin-commandlauncher
Architecture: any
Depends: ${shlibs:Depends},

View File

@ -0,0 +1 @@
usr/lib/@DEB_HOST_MULTIARCH@/nymea/plugins/libnymea_deviceplugincoinmarketcap.so

View File

@ -29,52 +29,30 @@ DevicePluginGenericElements::DevicePluginGenericElements()
{
}
Device::DeviceSetupStatus DevicePluginGenericElements::setupDevice(Device *device)
void DevicePluginGenericElements::setupDevice(DeviceSetupInfo *info)
{
// Toggle Button
if (device->deviceClassId() == toggleButtonDeviceClassId) {
return Device::DeviceSetupStatusSuccess;
}
// Button
if (device->deviceClassId() == buttonDeviceClassId) {
return Device::DeviceSetupStatusSuccess;
}
// ON/OFF Button
if (device->deviceClassId() == onOffButtonDeviceClassId) {
return Device::DeviceSetupStatusSuccess;
}
return Device::DeviceSetupStatusFailure;
info->finish(Device::DeviceErrorNoError);
}
Device::DeviceError DevicePluginGenericElements::executeAction(Device *device, const Action &action)
void DevicePluginGenericElements::executeAction(DeviceActionInfo *info)
{
Device *device = info->device();
Action action = info->action();
// Toggle Button
if (device->deviceClassId() == toggleButtonDeviceClassId ) {
if (action.actionTypeId() == toggleButtonStateActionTypeId) {
device->setStateValue(toggleButtonStateStateTypeId, action.params().paramValue(toggleButtonStateActionStateParamTypeId).toBool());
return Device::DeviceErrorNoError;
}
return Device::DeviceErrorActionTypeNotFound;
if (action.actionTypeId() == toggleButtonStateActionTypeId) {
device->setStateValue(toggleButtonStateStateTypeId, action.params().paramValue(toggleButtonStateActionStateParamTypeId).toBool());
}
// Button
if (device->deviceClassId() == buttonDeviceClassId ) {
if (action.actionTypeId() == buttonButtonPressActionTypeId) {
emit emitEvent(Event(buttonButtonPressedEventTypeId, device->id()));
return Device::DeviceErrorNoError;
}
return Device::DeviceErrorActionTypeNotFound;
if (action.actionTypeId() == buttonButtonPressActionTypeId) {
emit emitEvent(Event(buttonButtonPressedEventTypeId, device->id()));
}
// ON/OFF Button
if (device->deviceClassId() == onOffButtonDeviceClassId ) {
if (action.actionTypeId() == onOffButtonOnActionTypeId) {
emit emitEvent(Event(onOffButtonOnEventTypeId, device->id()));
return Device::DeviceErrorNoError;
}
if (action.actionTypeId() == onOffButtonOffActionTypeId) {
emit emitEvent(Event(onOffButtonOffEventTypeId, device->id()));
return Device::DeviceErrorNoError;
}
return Device::DeviceErrorActionTypeNotFound;
if (action.actionTypeId() == onOffButtonOnActionTypeId) {
emit emitEvent(Event(onOffButtonOnEventTypeId, device->id()));
}
return Device::DeviceErrorDeviceClassNotFound;
if (action.actionTypeId() == onOffButtonOffActionTypeId) {
emit emitEvent(Event(onOffButtonOffEventTypeId, device->id()));
}
info->finish(Device::DeviceErrorNoError);
}

View File

@ -34,10 +34,10 @@ class DevicePluginGenericElements : public DevicePlugin
public:
explicit DevicePluginGenericElements();
Device::DeviceSetupStatus setupDevice(Device *device) override;
void setupDevice(DeviceSetupInfo *info) override;
public slots:
Device::DeviceError executeAction(Device *device, const Action &action) override;
void executeAction(DeviceActionInfo *info) override;
};

View File

@ -4,90 +4,93 @@
<context>
<name>GenericElements</name>
<message>
<location filename="../plugininfo.h" line="40"/>
<location filename="../../../build-nymea-plugins-Desktop-Debug/genericelements/plugininfo.h" line="39"/>
<source>Generic Elements</source>
<extracomment>The name of the plugin GenericElements (6e22161e-39b7-4416-8623-39e730721efb)</extracomment>
<extracomment>The name of the plugin GenericElements ({6e22161e-39b7-4416-8623-39e730721efb})</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../plugininfo.h" line="43"/>
<location filename="../../../build-nymea-plugins-Desktop-Debug/genericelements/plugininfo.h" line="60"/>
<source>nymea</source>
<extracomment>The name of the vendor (2062d64d-3232-433c-88bc-0d33c0ba2ba6)</extracomment>
<extracomment>The name of the vendor ({2062d64d-3232-433c-88bc-0d33c0ba2ba6})</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../plugininfo.h" line="46"/>
<location filename="../../../build-nymea-plugins-Desktop-Debug/genericelements/plugininfo.h" line="54"/>
<source>Toggle Button</source>
<extracomment>The name of the DeviceClass (c0f511f9-70f5-499b-bd70-2c0e9ddd68c4)</extracomment>
<extracomment>The name of the DeviceClass ({c0f511f9-70f5-499b-bd70-2c0e9ddd68c4})</extracomment>
<translation>Toggle Taster</translation>
</message>
<message>
<location filename="../plugininfo.h" line="49"/>
<location filename="../../../build-nymea-plugins-Desktop-Debug/genericelements/plugininfo.h" line="81"/>
<source>state changed</source>
<extracomment>The name of the autocreated EventType (DeviceClass: toggleButton, StateType: state, ID: b5e90567-54aa-49bd-a78a-3c19fb38aaf5)</extracomment>
<extracomment>The name of the EventType ({b5e90567-54aa-49bd-a78a-3c19fb38aaf5}) of DeviceClass toggleButton</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../plugininfo.h" line="52"/>
<location filename="../plugininfo.h" line="58"/>
<location filename="../../../build-nymea-plugins-Desktop-Debug/genericelements/plugininfo.h" line="72"/>
<location filename="../../../build-nymea-plugins-Desktop-Debug/genericelements/plugininfo.h" line="75"/>
<location filename="../../../build-nymea-plugins-Desktop-Debug/genericelements/plugininfo.h" line="78"/>
<source>state</source>
<extracomment>The name of the ParamType for the autocreated EventType (DeviceClass: toggleButton, StateType: state, ID: b5e90567-54aa-49bd-a78a-3c19fb38aaf5
<extracomment>The name of the ParamType (DeviceClass: toggleButton, ActionType: state, ID: {b5e90567-54aa-49bd-a78a-3c19fb38aaf5})
----------
The name of the ParamType for the autocreated ActionType (DeviceClass: toggleButton, StateType: state, ID: b5e90567-54aa-49bd-a78a-3c19fb38aaf5)</extracomment>
The name of the ParamType (DeviceClass: toggleButton, EventType: state, ID: {b5e90567-54aa-49bd-a78a-3c19fb38aaf5})
----------
The name of the StateType ({b5e90567-54aa-49bd-a78a-3c19fb38aaf5}) of DeviceClass toggleButton</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../plugininfo.h" line="55"/>
<location filename="../../../build-nymea-plugins-Desktop-Debug/genericelements/plugininfo.h" line="51"/>
<source>Set state</source>
<extracomment>The name of the autocreated ActionType (DeviceClass: toggleButton, StateType: state, ID: b5e90567-54aa-49bd-a78a-3c19fb38aaf5)</extracomment>
<extracomment>The name of the ActionType ({b5e90567-54aa-49bd-a78a-3c19fb38aaf5}) of DeviceClass toggleButton</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../plugininfo.h" line="61"/>
<location filename="../../../build-nymea-plugins-Desktop-Debug/genericelements/plugininfo.h" line="36"/>
<source>Button</source>
<extracomment>The name of the DeviceClass (820b2f2d-0d92-48c8-8fd4-f94ce8fc4103)</extracomment>
<extracomment>The name of the DeviceClass ({820b2f2d-0d92-48c8-8fd4-f94ce8fc4103})</extracomment>
<translation>Taster</translation>
</message>
<message>
<location filename="../plugininfo.h" line="64"/>
<location filename="../../../build-nymea-plugins-Desktop-Debug/genericelements/plugininfo.h" line="63"/>
<source>press</source>
<extracomment>The name of the ActionType 01f38af1-b2ab-4ec3-844e-ef52f0f229a9 of deviceClass button</extracomment>
<extracomment>The name of the ActionType ({01f38af1-b2ab-4ec3-844e-ef52f0f229a9}) of DeviceClass button</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../plugininfo.h" line="67"/>
<location filename="../../../build-nymea-plugins-Desktop-Debug/genericelements/plugininfo.h" line="57"/>
<source>button pressed</source>
<extracomment>The name of the EventType effdbc2d-e467-4b0b-80a9-9dda251bfa5c of deviceClass button</extracomment>
<extracomment>The name of the EventType ({effdbc2d-e467-4b0b-80a9-9dda251bfa5c}) of DeviceClass button</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../plugininfo.h" line="70"/>
<location filename="../../../build-nymea-plugins-Desktop-Debug/genericelements/plugininfo.h" line="48"/>
<source>ON/OFF Button</source>
<extracomment>The name of the DeviceClass (430d188c-476d-4825-a9bd-86dfa3094b56)</extracomment>
<extracomment>The name of the DeviceClass ({430d188c-476d-4825-a9bd-86dfa3094b56})</extracomment>
<translation>An/Aus Taster</translation>
</message>
<message>
<location filename="../plugininfo.h" line="73"/>
<location filename="../../../build-nymea-plugins-Desktop-Debug/genericelements/plugininfo.h" line="69"/>
<source>press ON</source>
<extracomment>The name of the ActionType 892596d2-0863-4807-97da-469b9f7003f2 of deviceClass onOffButton</extracomment>
<extracomment>The name of the ActionType ({892596d2-0863-4807-97da-469b9f7003f2}) of DeviceClass onOffButton</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../plugininfo.h" line="76"/>
<location filename="../../../build-nymea-plugins-Desktop-Debug/genericelements/plugininfo.h" line="66"/>
<source>press OFF</source>
<extracomment>The name of the ActionType a8d64050-0b58-4ccf-b052-77ce2b7368ad of deviceClass onOffButton</extracomment>
<extracomment>The name of the ActionType ({a8d64050-0b58-4ccf-b052-77ce2b7368ad}) of DeviceClass onOffButton</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../plugininfo.h" line="79"/>
<location filename="../../../build-nymea-plugins-Desktop-Debug/genericelements/plugininfo.h" line="45"/>
<source>ON pressed</source>
<extracomment>The name of the EventType 4eeba6a2-e4c7-4a2e-8360-2797d98114e6 of deviceClass onOffButton</extracomment>
<extracomment>The name of the EventType ({4eeba6a2-e4c7-4a2e-8360-2797d98114e6}) of DeviceClass onOffButton</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../plugininfo.h" line="82"/>
<location filename="../../../build-nymea-plugins-Desktop-Debug/genericelements/plugininfo.h" line="42"/>
<source>OFF pressed</source>
<extracomment>The name of the EventType b636c5f3-2eb0-4682-96d4-88a4aa9d2c12 of deviceClass onOffButton</extracomment>
<extracomment>The name of the EventType ({b636c5f3-2eb0-4682-96d4-88a4aa9d2c12}) of DeviceClass onOffButton</extracomment>
<translation type="unfinished"></translation>
</message>
</context>

View File

@ -4,90 +4,93 @@
<context>
<name>GenericElements</name>
<message>
<location filename="../plugininfo.h" line="40"/>
<location filename="../../../build-nymea-plugins-Desktop-Debug/genericelements/plugininfo.h" line="39"/>
<source>Generic Elements</source>
<extracomment>The name of the plugin GenericElements (6e22161e-39b7-4416-8623-39e730721efb)</extracomment>
<extracomment>The name of the plugin GenericElements ({6e22161e-39b7-4416-8623-39e730721efb})</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../plugininfo.h" line="43"/>
<location filename="../../../build-nymea-plugins-Desktop-Debug/genericelements/plugininfo.h" line="60"/>
<source>nymea</source>
<extracomment>The name of the vendor (2062d64d-3232-433c-88bc-0d33c0ba2ba6)</extracomment>
<extracomment>The name of the vendor ({2062d64d-3232-433c-88bc-0d33c0ba2ba6})</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../plugininfo.h" line="46"/>
<location filename="../../../build-nymea-plugins-Desktop-Debug/genericelements/plugininfo.h" line="54"/>
<source>Toggle Button</source>
<extracomment>The name of the DeviceClass (c0f511f9-70f5-499b-bd70-2c0e9ddd68c4)</extracomment>
<extracomment>The name of the DeviceClass ({c0f511f9-70f5-499b-bd70-2c0e9ddd68c4})</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../plugininfo.h" line="49"/>
<location filename="../../../build-nymea-plugins-Desktop-Debug/genericelements/plugininfo.h" line="81"/>
<source>state changed</source>
<extracomment>The name of the autocreated EventType (DeviceClass: toggleButton, StateType: state, ID: b5e90567-54aa-49bd-a78a-3c19fb38aaf5)</extracomment>
<extracomment>The name of the EventType ({b5e90567-54aa-49bd-a78a-3c19fb38aaf5}) of DeviceClass toggleButton</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../plugininfo.h" line="52"/>
<location filename="../plugininfo.h" line="58"/>
<location filename="../../../build-nymea-plugins-Desktop-Debug/genericelements/plugininfo.h" line="72"/>
<location filename="../../../build-nymea-plugins-Desktop-Debug/genericelements/plugininfo.h" line="75"/>
<location filename="../../../build-nymea-plugins-Desktop-Debug/genericelements/plugininfo.h" line="78"/>
<source>state</source>
<extracomment>The name of the ParamType for the autocreated EventType (DeviceClass: toggleButton, StateType: state, ID: b5e90567-54aa-49bd-a78a-3c19fb38aaf5
<extracomment>The name of the ParamType (DeviceClass: toggleButton, ActionType: state, ID: {b5e90567-54aa-49bd-a78a-3c19fb38aaf5})
----------
The name of the ParamType for the autocreated ActionType (DeviceClass: toggleButton, StateType: state, ID: b5e90567-54aa-49bd-a78a-3c19fb38aaf5)</extracomment>
The name of the ParamType (DeviceClass: toggleButton, EventType: state, ID: {b5e90567-54aa-49bd-a78a-3c19fb38aaf5})
----------
The name of the StateType ({b5e90567-54aa-49bd-a78a-3c19fb38aaf5}) of DeviceClass toggleButton</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../plugininfo.h" line="55"/>
<location filename="../../../build-nymea-plugins-Desktop-Debug/genericelements/plugininfo.h" line="51"/>
<source>Set state</source>
<extracomment>The name of the autocreated ActionType (DeviceClass: toggleButton, StateType: state, ID: b5e90567-54aa-49bd-a78a-3c19fb38aaf5)</extracomment>
<extracomment>The name of the ActionType ({b5e90567-54aa-49bd-a78a-3c19fb38aaf5}) of DeviceClass toggleButton</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../plugininfo.h" line="61"/>
<location filename="../../../build-nymea-plugins-Desktop-Debug/genericelements/plugininfo.h" line="36"/>
<source>Button</source>
<extracomment>The name of the DeviceClass (820b2f2d-0d92-48c8-8fd4-f94ce8fc4103)</extracomment>
<extracomment>The name of the DeviceClass ({820b2f2d-0d92-48c8-8fd4-f94ce8fc4103})</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../plugininfo.h" line="64"/>
<location filename="../../../build-nymea-plugins-Desktop-Debug/genericelements/plugininfo.h" line="63"/>
<source>press</source>
<extracomment>The name of the ActionType 01f38af1-b2ab-4ec3-844e-ef52f0f229a9 of deviceClass button</extracomment>
<extracomment>The name of the ActionType ({01f38af1-b2ab-4ec3-844e-ef52f0f229a9}) of DeviceClass button</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../plugininfo.h" line="67"/>
<location filename="../../../build-nymea-plugins-Desktop-Debug/genericelements/plugininfo.h" line="57"/>
<source>button pressed</source>
<extracomment>The name of the EventType effdbc2d-e467-4b0b-80a9-9dda251bfa5c of deviceClass button</extracomment>
<extracomment>The name of the EventType ({effdbc2d-e467-4b0b-80a9-9dda251bfa5c}) of DeviceClass button</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../plugininfo.h" line="70"/>
<location filename="../../../build-nymea-plugins-Desktop-Debug/genericelements/plugininfo.h" line="48"/>
<source>ON/OFF Button</source>
<extracomment>The name of the DeviceClass (430d188c-476d-4825-a9bd-86dfa3094b56)</extracomment>
<extracomment>The name of the DeviceClass ({430d188c-476d-4825-a9bd-86dfa3094b56})</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../plugininfo.h" line="73"/>
<location filename="../../../build-nymea-plugins-Desktop-Debug/genericelements/plugininfo.h" line="69"/>
<source>press ON</source>
<extracomment>The name of the ActionType 892596d2-0863-4807-97da-469b9f7003f2 of deviceClass onOffButton</extracomment>
<extracomment>The name of the ActionType ({892596d2-0863-4807-97da-469b9f7003f2}) of DeviceClass onOffButton</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../plugininfo.h" line="76"/>
<location filename="../../../build-nymea-plugins-Desktop-Debug/genericelements/plugininfo.h" line="66"/>
<source>press OFF</source>
<extracomment>The name of the ActionType a8d64050-0b58-4ccf-b052-77ce2b7368ad of deviceClass onOffButton</extracomment>
<extracomment>The name of the ActionType ({a8d64050-0b58-4ccf-b052-77ce2b7368ad}) of DeviceClass onOffButton</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../plugininfo.h" line="79"/>
<location filename="../../../build-nymea-plugins-Desktop-Debug/genericelements/plugininfo.h" line="45"/>
<source>ON pressed</source>
<extracomment>The name of the EventType 4eeba6a2-e4c7-4a2e-8360-2797d98114e6 of deviceClass onOffButton</extracomment>
<extracomment>The name of the EventType ({4eeba6a2-e4c7-4a2e-8360-2797d98114e6}) of DeviceClass onOffButton</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../plugininfo.h" line="82"/>
<location filename="../../../build-nymea-plugins-Desktop-Debug/genericelements/plugininfo.h" line="42"/>
<source>OFF pressed</source>
<extracomment>The name of the EventType b636c5f3-2eb0-4682-96d4-88a4aa9d2c12 of deviceClass onOffButton</extracomment>
<extracomment>The name of the EventType ({b636c5f3-2eb0-4682-96d4-88a4aa9d2c12}) of DeviceClass onOffButton</extracomment>
<translation type="unfinished"></translation>
</message>
</context>

View File

@ -53,56 +53,36 @@ DevicePluginGenericInterfaces::DevicePluginGenericInterfaces()
{
}
Device::DeviceSetupStatus DevicePluginGenericInterfaces::setupDevice(Device *device)
void DevicePluginGenericInterfaces::setupDevice(DeviceSetupInfo *info)
{
if (device->deviceClassId() == awningDeviceClassId) {
return Device::DeviceSetupStatusSuccess;
}
if (device->deviceClassId() == blindDeviceClassId) {
return Device::DeviceSetupStatusSuccess;
}
if (device->deviceClassId() == shutterDeviceClassId) {
return Device::DeviceSetupStatusSuccess;
}
if (device->deviceClassId() == socketDeviceClassId) {
return Device::DeviceSetupStatusSuccess;
}
if (device->deviceClassId() == lightDeviceClassId) {
return Device::DeviceSetupStatusSuccess;
}
if (device->deviceClassId() == heatingDeviceClassId) {
return Device::DeviceSetupStatusSuccess;
}
return Device::DeviceSetupStatusFailure;
info->finish(Device::DeviceErrorNoError);
}
Device::DeviceError DevicePluginGenericInterfaces::executeAction(Device *device, const Action &action)
void DevicePluginGenericInterfaces::executeAction(DeviceActionInfo *info)
{
Device *device = info->device();
Action action = info->action();
if (device->deviceClassId() == awningDeviceClassId) {
if (action.actionTypeId() == awningOpenActionTypeId) {
device->setStateValue(awningStatusStateTypeId, "Opening");
device->setStateValue(awningClosingOutputStateTypeId, false);
device->setStateValue(awningOpeningOutputStateTypeId, true);
return Device::DeviceErrorNoError;
return info->finish(Device::DeviceErrorNoError);
}
if (action.actionTypeId() == awningStopActionTypeId) {
device->setStateValue(awningStatusStateTypeId, "Stopped");
device->setStateValue(awningOpeningOutputStateTypeId, false);
device->setStateValue(awningClosingOutputStateTypeId, false);
return Device::DeviceErrorNoError;
return info->finish(Device::DeviceErrorNoError);
}
if (action.actionTypeId() == awningCloseActionTypeId) {
device->setStateValue(awningStatusStateTypeId, "Closing");
device->setStateValue(awningOpeningOutputStateTypeId, false);
device->setStateValue(awningClosingOutputStateTypeId, true);
return Device::DeviceErrorNoError;
return info->finish(Device::DeviceErrorNoError);
}
return Device::DeviceErrorActionTypeNotFound;
return info->finish(Device::DeviceErrorActionTypeNotFound);
}
if (device->deviceClassId() == blindDeviceClassId ) {
@ -110,21 +90,21 @@ Device::DeviceError DevicePluginGenericInterfaces::executeAction(Device *device,
device->setStateValue(blindStatusStateTypeId, "Opening");
device->setStateValue(blindClosingOutputStateTypeId, false);
device->setStateValue(blindOpeningOutputStateTypeId, true);
return Device::DeviceErrorNoError;
return info->finish(Device::DeviceErrorNoError);
}
if (action.actionTypeId() == blindStopActionTypeId) {
device->setStateValue(blindStatusStateTypeId, "Stopped");
device->setStateValue(blindOpeningOutputStateTypeId, false);
device->setStateValue(blindClosingOutputStateTypeId, false);
return Device::DeviceErrorNoError;
return info->finish(Device::DeviceErrorNoError);
}
if (action.actionTypeId() == blindCloseActionTypeId) {
device->setStateValue(blindStatusStateTypeId, "Closing");
device->setStateValue(blindOpeningOutputStateTypeId, false);
device->setStateValue(blindClosingOutputStateTypeId, true);
return Device::DeviceErrorNoError;
return info->finish(Device::DeviceErrorNoError);
}
return Device::DeviceErrorActionTypeNotFound;
return info->finish(Device::DeviceErrorActionTypeNotFound);
}
if (device->deviceClassId() == shutterDeviceClassId) {
@ -132,45 +112,45 @@ Device::DeviceError DevicePluginGenericInterfaces::executeAction(Device *device,
device->setStateValue(shutterStatusStateTypeId, "Opening");
device->setStateValue(shutterClosingOutputStateTypeId, false);
device->setStateValue(shutterOpeningOutputStateTypeId, true);
return Device::DeviceErrorNoError;
return info->finish(Device::DeviceErrorNoError);
}
if (action.actionTypeId() == shutterStopActionTypeId) {
device->setStateValue(shutterStatusStateTypeId, "Stopped");
device->setStateValue(shutterOpeningOutputStateTypeId, false);
device->setStateValue(shutterClosingOutputStateTypeId, false);
return Device::DeviceErrorNoError;
return info->finish(Device::DeviceErrorNoError);
}
if (action.actionTypeId() == shutterCloseActionTypeId) {
device->setStateValue(shutterStatusStateTypeId, "Closing");
device->setStateValue(shutterOpeningOutputStateTypeId, false);
device->setStateValue(shutterClosingOutputStateTypeId, true);
return Device::DeviceErrorNoError;
return info->finish(Device::DeviceErrorNoError);
}
return Device::DeviceErrorActionTypeNotFound;
return info->finish(Device::DeviceErrorActionTypeNotFound);
}
if (device->deviceClassId() == socketDeviceClassId) {
if (action.actionTypeId() == socketPowerActionTypeId) {
device->setStateValue(socketPowerStateTypeId, action.param(socketPowerActionPowerParamTypeId).value());
return Device::DeviceErrorNoError;
return info->finish(Device::DeviceErrorNoError);
}
return Device::DeviceErrorActionTypeNotFound;
return info->finish(Device::DeviceErrorActionTypeNotFound);
}
if (device->deviceClassId() == lightDeviceClassId) {
if (action.actionTypeId() == lightPowerActionTypeId) {
device->setStateValue(lightPowerStateTypeId, action.param(lightPowerActionPowerParamTypeId).value());
return Device::DeviceErrorNoError;
return info->finish(Device::DeviceErrorNoError);
}
return Device::DeviceErrorActionTypeNotFound;
return info->finish(Device::DeviceErrorActionTypeNotFound);
}
if (device->deviceClassId() == heatingDeviceClassId) {
if (action.actionTypeId() == heatingPowerActionTypeId) {
device->setStateValue(heatingPowerStateTypeId, action.param(heatingPowerActionPowerParamTypeId).value());
return Device::DeviceErrorNoError;
return info->finish(Device::DeviceErrorNoError);
}
return Device::DeviceErrorActionTypeNotFound;
return info->finish(Device::DeviceErrorActionTypeNotFound);
}
return Device::DeviceErrorDeviceClassNotFound;
return info->finish(Device::DeviceErrorDeviceClassNotFound);
}

View File

@ -34,11 +34,8 @@ class DevicePluginGenericInterfaces : public DevicePlugin
public:
explicit DevicePluginGenericInterfaces();
Device::DeviceSetupStatus setupDevice(Device *device) override;
public slots:
Device::DeviceError executeAction(Device *device, const Action &action) override;
void setupDevice(DeviceSetupInfo *info) override;
void executeAction(DeviceActionInfo *info) override;
};
#endif // DEVICEPLUGINGENERICINTERFACES_H

View File

@ -1,4 +1,185 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1">
</TS>
<context>
<name>GenericInterfaces</name>
<message>
<source>Awning interface</source>
<extracomment>The name of the DeviceClass ({9e69585f-90ba-44e4-ad90-5b4bffbe345a})</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>Blind interface</source>
<extracomment>The name of the DeviceClass ({17ee3657-6ad8-4ae2-8959-3cf66cec8d13})</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>Close</source>
<extracomment>The name of the ActionType ({cf5303f1-67c7-4cef-b11c-eb9de6fc8a87}) of DeviceClass shutter
----------
The name of the ActionType ({86e9cf21-7487-47c4-b4be-4a940d7235fb}) of DeviceClass blind
----------
The name of the ActionType ({53b5ba77-9a34-4cd6-ad24-fb01fc465f98}) of DeviceClass awning</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>Closing output</source>
<extracomment>The name of the ParamType (DeviceClass: shutter, EventType: closingOutput, ID: {1c35df0e-4c41-455f-893a-0145377952a0})
----------
The name of the StateType ({1c35df0e-4c41-455f-893a-0145377952a0}) of DeviceClass shutter
----------
The name of the ParamType (DeviceClass: blind, EventType: closingOutput, ID: {9b673430-572d-4a9c-85d3-dafadbe541cd})
----------
The name of the StateType ({9b673430-572d-4a9c-85d3-dafadbe541cd}) of DeviceClass blind
----------
The name of the ParamType (DeviceClass: awning, EventType: closingOutput, ID: {59bfd575-709f-4e43-9726-de26e6d4ca8b})
----------
The name of the StateType ({59bfd575-709f-4e43-9726-de26e6d4ca8b}) of DeviceClass awning</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>Closing output changed</source>
<extracomment>The name of the EventType ({1c35df0e-4c41-455f-893a-0145377952a0}) of DeviceClass shutter
----------
The name of the EventType ({9b673430-572d-4a9c-85d3-dafadbe541cd}) of DeviceClass blind
----------
The name of the EventType ({59bfd575-709f-4e43-9726-de26e6d4ca8b}) of DeviceClass awning</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>Generic Interfaces</source>
<extracomment>The name of the plugin GenericInterfaces ({b3188696-2585-4806-bf98-30ab576ce5c8})</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>Heating interface</source>
<extracomment>The name of the DeviceClass ({392854c4-3d14-4cf8-96cd-d933526bd197})</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>Light interface</source>
<extracomment>The name of the DeviceClass ({c50d3216-f307-4f9f-8190-4391510c385c})</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>Open</source>
<extracomment>The name of the ActionType ({9deb662d-2378-4345-a898-8742d41e43c1}) of DeviceClass shutter
----------
The name of the ActionType ({120dc265-dbbb-4f19-9d31-c372c23479c0}) of DeviceClass blind
----------
The name of the ActionType ({979e9c51-5a93-4635-85e3-01874306b229}) of DeviceClass awning</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>Opening output</source>
<extracomment>The name of the ParamType (DeviceClass: shutter, EventType: openingOutput, ID: {cc547728-b309-4695-b355-49748ef2521c})
----------
The name of the StateType ({cc547728-b309-4695-b355-49748ef2521c}) of DeviceClass shutter
----------
The name of the ParamType (DeviceClass: blind, EventType: openingOutput, ID: {b2dbf25c-27e5-4f7e-a57d-2ef6d087fa2b})
----------
The name of the StateType ({b2dbf25c-27e5-4f7e-a57d-2ef6d087fa2b}) of DeviceClass blind
----------
The name of the ParamType (DeviceClass: awning, EventType: openingOutput, ID: {4bb951a4-ea23-4cf0-9269-41d2c4eaf5a4})
----------
The name of the StateType ({4bb951a4-ea23-4cf0-9269-41d2c4eaf5a4}) of DeviceClass awning</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>Opening output changed</source>
<extracomment>The name of the EventType ({cc547728-b309-4695-b355-49748ef2521c}) of DeviceClass shutter
----------
The name of the EventType ({b2dbf25c-27e5-4f7e-a57d-2ef6d087fa2b}) of DeviceClass blind
----------
The name of the EventType ({4bb951a4-ea23-4cf0-9269-41d2c4eaf5a4}) of DeviceClass awning</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>Power</source>
<extracomment>The name of the ParamType (DeviceClass: heating, ActionType: power, ID: {409b635e-a754-4b5c-b3f0-d1c5a0fb3f03})
----------
The name of the ParamType (DeviceClass: heating, EventType: power, ID: {409b635e-a754-4b5c-b3f0-d1c5a0fb3f03})
----------
The name of the StateType ({409b635e-a754-4b5c-b3f0-d1c5a0fb3f03}) of DeviceClass heating
----------
The name of the ParamType (DeviceClass: light, ActionType: power, ID: {8b6e4a67-6522-408b-b676-8d2f09ed2d54})
----------
The name of the ParamType (DeviceClass: light, EventType: power, ID: {8b6e4a67-6522-408b-b676-8d2f09ed2d54})
----------
The name of the StateType ({8b6e4a67-6522-408b-b676-8d2f09ed2d54}) of DeviceClass light
----------
The name of the ParamType (DeviceClass: socket, ActionType: power, ID: {018038d7-1d02-4b17-8fe3-babca044b087})
----------
The name of the ParamType (DeviceClass: socket, EventType: power, ID: {018038d7-1d02-4b17-8fe3-babca044b087})
----------
The name of the StateType ({018038d7-1d02-4b17-8fe3-babca044b087}) of DeviceClass socket</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>Power changed</source>
<extracomment>The name of the EventType ({409b635e-a754-4b5c-b3f0-d1c5a0fb3f03}) of DeviceClass heating
----------
The name of the EventType ({8b6e4a67-6522-408b-b676-8d2f09ed2d54}) of DeviceClass light
----------
The name of the EventType ({018038d7-1d02-4b17-8fe3-babca044b087}) of DeviceClass socket</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>Set power</source>
<extracomment>The name of the ActionType ({409b635e-a754-4b5c-b3f0-d1c5a0fb3f03}) of DeviceClass heating
----------
The name of the ActionType ({8b6e4a67-6522-408b-b676-8d2f09ed2d54}) of DeviceClass light
----------
The name of the ActionType ({018038d7-1d02-4b17-8fe3-babca044b087}) of DeviceClass socket</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>Shutter interface</source>
<extracomment>The name of the DeviceClass ({7917c2e7-d7d2-4c47-a38d-41f7dd7693d9})</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>Socket interface</source>
<extracomment>The name of the DeviceClass ({4e7261af-a27b-4446-8346-914ea59f7547})</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>Status</source>
<extracomment>The name of the ParamType (DeviceClass: shutter, EventType: status, ID: {6d6e72dc-4d2b-4ec1-82c2-54405a682711})
----------
The name of the StateType ({6d6e72dc-4d2b-4ec1-82c2-54405a682711}) of DeviceClass shutter
----------
The name of the ParamType (DeviceClass: blind, EventType: status, ID: {5fdec1e0-51f6-48b9-b743-ba572504b2c1})
----------
The name of the StateType ({5fdec1e0-51f6-48b9-b743-ba572504b2c1}) of DeviceClass blind
----------
The name of the ParamType (DeviceClass: awning, EventType: status, ID: {ff6f2565-2a2e-4d34-b10f-d3f73b676399})
----------
The name of the StateType ({ff6f2565-2a2e-4d34-b10f-d3f73b676399}) of DeviceClass awning</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>Status changed</source>
<extracomment>The name of the EventType ({6d6e72dc-4d2b-4ec1-82c2-54405a682711}) of DeviceClass shutter
----------
The name of the EventType ({5fdec1e0-51f6-48b9-b743-ba572504b2c1}) of DeviceClass blind
----------
The name of the EventType ({ff6f2565-2a2e-4d34-b10f-d3f73b676399}) of DeviceClass awning</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>Stop</source>
<extracomment>The name of the ActionType ({db5f3332-1f4e-4f9e-84d2-93c5d7de315c}) of DeviceClass shutter
----------
The name of the ActionType ({1a924c9a-5dcb-4b1c-8fd6-ab101098e007}) of DeviceClass blind
----------
The name of the ActionType ({555cafe4-bd12-42c6-bab1-8cd59af6468e}) of DeviceClass awning</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>nymea</source>
<extracomment>The name of the vendor ({2062d64d-3232-433c-88bc-0d33c0ba2ba6})</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

View File

@ -6,6 +6,7 @@ PLUGIN_DIRS = \
awattar \
boblight \
bose \
coinmarketcap \
commandlauncher \
conrad \
datetime \

View File

@ -12,6 +12,6 @@ isEmpty(PLUGIN_PRI) {
error("plugin.pri not found. Cannot continue")
}
} else {
message("Using $$PLUGIN_PRI")
# message("Using $$PLUGIN_PRI")
include($$PLUGIN_PRI)
}