diff --git a/libhive/devicemanager.cpp b/libhive/devicemanager.cpp index 029414db..029af352 100644 --- a/libhive/devicemanager.cpp +++ b/libhive/devicemanager.cpp @@ -21,6 +21,7 @@ DeviceManager::DeviceManager(QObject *parent) : QObject(parent) { m_radio433 = new Radio433(this); + connect(m_radio433, &Radio433::dataReceived, this, &DeviceManager::radio433SignalReceived); QMetaObject::invokeMethod(this, "loadPlugins", Qt::QueuedConnection); QMetaObject::invokeMethod(this, "loadConfiguredDevices", Qt::QueuedConnection); diff --git a/plugins/deviceplugins/devicepluginelro/devicepluginelro.cpp b/plugins/deviceplugins/devicepluginelro/devicepluginelro.cpp index 77b4c2d1..ddf8c1b1 100644 --- a/plugins/deviceplugins/devicepluginelro/devicepluginelro.cpp +++ b/plugins/deviceplugins/devicepluginelro/devicepluginelro.cpp @@ -7,8 +7,8 @@ #include #include -QUuid elroRemote = QUuid("d85c1ef4-197c-4053-8e40-707aa671d302"); -QUuid elroDevicePlugin = QUuid("308ae6e6-38b3-4b3a-a513-3199da2764f8"); +QUuid elroRemoteId = QUuid("d85c1ef4-197c-4053-8e40-707aa671d302"); +QUuid elroSwitchId = QUuid("308ae6e6-38b3-4b3a-a513-3199da2764f8"); DevicePluginElro::DevicePluginElro() { @@ -20,8 +20,8 @@ QList DevicePluginElro::supportedDevices() const QList ret; // Remote - DeviceClass deviceClassDevicePluginElro(pluginId(), elroRemote); - deviceClassDevicePluginElro.setName("Elro Remote"); + DeviceClass deviceClassElroRemote(pluginId(), elroRemoteId); + deviceClassElroRemote.setName("Elro Remote"); QVariantList deviceParamsRemote; QVariantMap channelParam; @@ -41,7 +41,7 @@ QList DevicePluginElro::supportedDevices() const channelParam.insert("type", "bool"); deviceParamsRemote.append(channelParam); - deviceClassDevicePluginElro.setParams(deviceParamsRemote); + deviceClassElroRemote.setParams(deviceParamsRemote); QList buttonTriggers; @@ -76,12 +76,12 @@ QList DevicePluginElro::supportedDevices() const buttonETrigger.setParameters(paramsRemote); buttonTriggers.append(buttonETrigger); - deviceClassDevicePluginElro.setTriggers(buttonTriggers); - ret.append(deviceClassDevicePluginElro); + deviceClassElroRemote.setTriggers(buttonTriggers); + ret.append(deviceClassElroRemote); // Switch - DeviceClass deviceClassRfSwitchMumbi(pluginId(), elroDevicePlugin); - deviceClassRfSwitchMumbi.setName("Elro Power Switch"); + DeviceClass deviceClassElroSwitch(pluginId(), elroSwitchId); + deviceClassElroSwitch.setName("Elro Power Switch"); QVariantList deviceParamsSwitch; QVariantMap paramSwitch; @@ -116,22 +116,24 @@ QList DevicePluginElro::supportedDevices() const paramSwitch.insert("type", "bool"); deviceParamsSwitch.append(paramSwitch); - QVariantList paramsSwitch; + deviceClassElroSwitch.setParams(deviceParamsSwitch); + + + QVariantList actionParamsSwitch; QVariantMap actionParamSwitch; actionParamSwitch.insert("name", "power"); actionParamSwitch.insert("type", "bool"); - paramsSwitch.append(actionParamSwitch); - + actionParamsSwitch.append(actionParamSwitch); QList switchActions; ActionType powerAction(QUuid("31c9758e-6567-4f89-85bb-29e1a7c55d44")); powerAction.setName("power"); - powerAction.setParameters(paramsSwitch); + powerAction.setParameters(actionParamsSwitch); switchActions.append(powerAction); - deviceClassRfSwitchMumbi.setActions(switchActions); - ret.append(deviceClassRfSwitchMumbi); + deviceClassElroSwitch.setActions(switchActions); + ret.append(deviceClassElroSwitch); return ret; } @@ -250,7 +252,7 @@ void DevicePluginElro::receiveData(QList rawData) if(rawData.length() != 49){ return; } - + int delay = rawData.first()/31; QByteArray binCode; @@ -332,7 +334,7 @@ void DevicePluginElro::receiveData(QList rawData) } Device *device = 0; - QList deviceList = deviceManager()->findConfiguredDevices(elroRemote); + QList deviceList = deviceManager()->findConfiguredDevices(elroRemoteId); foreach (Device *dev, deviceList) { if (dev->params().contains("channel1") && dev->params().value("channel1").toBool() == group.at(0) && dev->params().contains("channel2") && dev->params().value("channel2").toBool() == group.at(1) && diff --git a/plugins/deviceplugins/devicepluginmeisteranker/devicepluginmeisteranker.cpp b/plugins/deviceplugins/devicepluginmeisteranker/devicepluginmeisteranker.cpp index 20f0744e..c347aa17 100644 --- a/plugins/deviceplugins/devicepluginmeisteranker/devicepluginmeisteranker.cpp +++ b/plugins/deviceplugins/devicepluginmeisteranker/devicepluginmeisteranker.cpp @@ -136,4 +136,6 @@ void DevicePluginMeisterAnker::receiveData(QList rawData) } + + } diff --git a/tests/addconfigureddevice.sh b/tests/addconfigureddevice.sh index b2468b84..57e6edf2 100755 --- a/tests/addconfigureddevice.sh +++ b/tests/addconfigureddevice.sh @@ -5,7 +5,7 @@ if [ -z $1 ]; then echo "usage $0 host" else (echo '{"id":1, "method":"Devices.AddConfiguredDevice", "params":{"deviceClass": "{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":{"deviceClass": "{308ae6e6-38b3-4b3a-a513-3199da2764f8}","deviceParams":{"channel1":"false","channel2":"false", "channel3":"false", "channel4": "false","channel5":"false","A":"false","B":"true","C":"false","D":"false","E":"false" }}}'; sleep 1) | nc $1 1234 + (echo '{"id":1, "method":"Devices.AddConfiguredDevice", "params":{"deviceClass": "{308ae6e6-38b3-4b3a-a513-3199da2764f8}","deviceParams":{"channel1":"false","channel2":"false", "channel3":"false", "channel4": "false","channel5":"false","A":"false","B":"true","C":"false","D":"false","E":"false" }}}'; sleep 1) | nc $1 1234 (echo '{"id":1, "method":"Devices.AddConfiguredDevice", "params":{"deviceClass": "{ab73ad2f-6594-45a3-9063-8f72d365c5e5}","deviceParams":{"familycode":"J"}}}'; sleep 1) | nc $1 1234 fi diff --git a/tests/addrule.sh b/tests/addrule.sh index 5292f58e..50ed14df 100755 --- a/tests/addrule.sh +++ b/tests/addrule.sh @@ -3,5 +3,5 @@ if test -z $3; then echo "usage: $1 host triggerId actionId" else - (echo '{"id":1, "method":"Rules.AddRule", "params":{"triggerId": "'$2'", "actionId": "'$3'" }}'; sleep 1) | nc $1 1234 + (echo '{"id":1, "method":"Rules.AddRule", "params":{"triggerTypeId": "'$2'", "action":{ "deviceId":"'$3'", "name":"rule 1", "actionParams":{"power":"on"}}}}'; sleep 1) | nc $1 1234 fi