Fix plugins json content according to new white list parsing
This commit is contained in:
parent
6bd868f4a0
commit
540acbf2b1
@ -133,9 +133,9 @@ DeviceManager::DeviceError DevicePluginAwattar::executeAction(Device *device, co
|
|||||||
return DeviceManager::DeviceErrorHardwareNotAvailable;
|
return DeviceManager::DeviceErrorHardwareNotAvailable;
|
||||||
|
|
||||||
if (action.actionTypeId() == awattarSgSyncModeActionTypeId) {
|
if (action.actionTypeId() == awattarSgSyncModeActionTypeId) {
|
||||||
qCDebug(dcAwattar) << "Set sg sync mode to" << action.param(awattarSgSyncModeStateParamTypeId).value();
|
qCDebug(dcAwattar) << "Set sg sync mode to" << action.param(awattarSgSyncModeActionParamTypeId).value();
|
||||||
device->setStateValue(awattarSgSyncModeStateTypeId, action.param(awattarSgSyncModeStateParamTypeId).value());
|
device->setStateValue(awattarSgSyncModeStateTypeId, action.param(awattarSgSyncModeActionParamTypeId).value());
|
||||||
if (action.param(awattarSgSyncModeStateParamTypeId).value() == "auto")
|
if (action.param(awattarSgSyncModeActionParamTypeId).value() == "auto")
|
||||||
setSgMode(m_autoSgMode);
|
setSgMode(m_autoSgMode);
|
||||||
|
|
||||||
return DeviceManager::DeviceErrorNoError;
|
return DeviceManager::DeviceErrorNoError;
|
||||||
|
|||||||
@ -116,9 +116,9 @@ DeviceManager::DeviceError DevicePluginDenon::executeAction(Device *device, cons
|
|||||||
|
|
||||||
// Print information that we are executing now the update action
|
// Print information that we are executing now the update action
|
||||||
qCDebug(dcDenon) << "set power action" << action.id();
|
qCDebug(dcDenon) << "set power action" << action.id();
|
||||||
qCDebug(dcDenon) << "power: " << action.param(AVRX1000PowerStateParamTypeId).value().Bool;
|
qCDebug(dcDenon) << "power: " << action.param(AVRX1000PowerActionParamTypeId).value().Bool;
|
||||||
|
|
||||||
if (action.param(AVRX1000PowerStateParamTypeId).value().toBool() == true){
|
if (action.param(AVRX1000PowerActionParamTypeId).value().toBool() == true){
|
||||||
QByteArray cmd = "PWON\r";
|
QByteArray cmd = "PWON\r";
|
||||||
qCDebug(dcDenon) << "Execute power: " << action.id() << cmd;
|
qCDebug(dcDenon) << "Execute power: " << action.id() << cmd;
|
||||||
m_denonConnection->sendData(cmd);
|
m_denonConnection->sendData(cmd);
|
||||||
@ -132,7 +132,7 @@ DeviceManager::DeviceError DevicePluginDenon::executeAction(Device *device, cons
|
|||||||
|
|
||||||
} else if (action.actionTypeId() == AVRX1000VolumeActionTypeId) {
|
} else if (action.actionTypeId() == AVRX1000VolumeActionTypeId) {
|
||||||
|
|
||||||
QByteArray vol = action.param(AVRX1000VolumeStateParamTypeId).value().toByteArray();
|
QByteArray vol = action.param(AVRX1000VolumeActionParamTypeId).value().toByteArray();
|
||||||
QByteArray cmd = "MV" + vol + "\r";
|
QByteArray cmd = "MV" + vol + "\r";
|
||||||
|
|
||||||
qCDebug(dcDenon) << "Execute volume" << action.id() << cmd;
|
qCDebug(dcDenon) << "Execute volume" << action.id() << cmd;
|
||||||
@ -143,7 +143,7 @@ DeviceManager::DeviceError DevicePluginDenon::executeAction(Device *device, cons
|
|||||||
} else if (action.actionTypeId() == AVRX1000ChannelActionTypeId) {
|
} else if (action.actionTypeId() == AVRX1000ChannelActionTypeId) {
|
||||||
|
|
||||||
qCDebug(dcDenon) << "Execute update action" << action.id();
|
qCDebug(dcDenon) << "Execute update action" << action.id();
|
||||||
QByteArray channel = action.param(AVRX1000ChannelStateParamTypeId).value().toByteArray();
|
QByteArray channel = action.param(AVRX1000ChannelActionParamTypeId).value().toByteArray();
|
||||||
QByteArray cmd = "SI" + channel + "\r";
|
QByteArray cmd = "SI" + channel + "\r";
|
||||||
|
|
||||||
qCDebug(dcDenon) << "Change to channel:" << cmd;
|
qCDebug(dcDenon) << "Change to channel:" << cmd;
|
||||||
|
|||||||
@ -478,53 +478,53 @@ DeviceManager::DeviceError DevicePluginElgato::executeAction(Device *device, con
|
|||||||
AveaBulb *bulb = m_bulbs.value(device);
|
AveaBulb *bulb = m_bulbs.value(device);
|
||||||
|
|
||||||
if (action.actionTypeId() == aveaPowerActionTypeId) {
|
if (action.actionTypeId() == aveaPowerActionTypeId) {
|
||||||
bool power = action.param(aveaPowerStateParamTypeId).value().toBool();
|
bool power = action.param(aveaPowerActionParamTypeId).value().toBool();
|
||||||
device->setStateValue(aveaPowerStateTypeId, power);
|
device->setStateValue(aveaPowerStateTypeId, power);
|
||||||
if (!bulb->setPower(power))
|
if (!bulb->setPower(power))
|
||||||
return DeviceManager::DeviceErrorHardwareNotAvailable;
|
return DeviceManager::DeviceErrorHardwareNotAvailable;
|
||||||
|
|
||||||
return DeviceManager::DeviceErrorNoError;
|
return DeviceManager::DeviceErrorNoError;
|
||||||
} else if (action.actionTypeId() == aveaBrightnessActionTypeId) {
|
} else if (action.actionTypeId() == aveaBrightnessActionTypeId) {
|
||||||
int percentage = action.param(aveaBrightnessStateParamTypeId).value().toInt();
|
int percentage = action.param(aveaBrightnessActionParamTypeId).value().toInt();
|
||||||
if (!bulb->setBrightness(percentage))
|
if (!bulb->setBrightness(percentage))
|
||||||
return DeviceManager::DeviceErrorHardwareNotAvailable;
|
return DeviceManager::DeviceErrorHardwareNotAvailable;
|
||||||
|
|
||||||
device->setStateValue(aveaBrightnessStateTypeId, percentage);
|
device->setStateValue(aveaBrightnessStateTypeId, percentage);
|
||||||
return DeviceManager::DeviceErrorNoError;
|
return DeviceManager::DeviceErrorNoError;
|
||||||
} else if (action.actionTypeId() == aveaColorActionTypeId) {
|
} else if (action.actionTypeId() == aveaColorActionTypeId) {
|
||||||
QColor color = action.param(aveaColorStateParamTypeId).value().value<QColor>();
|
QColor color = action.param(aveaColorActionParamTypeId).value().value<QColor>();
|
||||||
if (!bulb->setColor(color))
|
if (!bulb->setColor(color))
|
||||||
return DeviceManager::DeviceErrorHardwareNotAvailable;
|
return DeviceManager::DeviceErrorHardwareNotAvailable;
|
||||||
|
|
||||||
device->setStateValue(aveaColorStateTypeId, color);
|
device->setStateValue(aveaColorStateTypeId, color);
|
||||||
return DeviceManager::DeviceErrorNoError;
|
return DeviceManager::DeviceErrorNoError;
|
||||||
} else if (action.actionTypeId() == aveaWhiteActionTypeId) {
|
} else if (action.actionTypeId() == aveaWhiteActionTypeId) {
|
||||||
int whiteValue = action.param(aveaWhiteStateParamTypeId).value().toInt();
|
int whiteValue = action.param(aveaWhiteActionParamTypeId).value().toInt();
|
||||||
if (!bulb->setWhite(whiteValue))
|
if (!bulb->setWhite(whiteValue))
|
||||||
return DeviceManager::DeviceErrorHardwareNotAvailable;
|
return DeviceManager::DeviceErrorHardwareNotAvailable;
|
||||||
|
|
||||||
device->setStateValue(aveaWhiteStateTypeId, whiteValue);
|
device->setStateValue(aveaWhiteStateTypeId, whiteValue);
|
||||||
return DeviceManager::DeviceErrorNoError;
|
return DeviceManager::DeviceErrorNoError;
|
||||||
} else if (action.actionTypeId() == aveaGreenActionTypeId) {
|
} else if (action.actionTypeId() == aveaGreenActionTypeId) {
|
||||||
int greenValue = action.param(aveaGreenStateParamTypeId).value().toInt();
|
int greenValue = action.param(aveaGreenActionParamTypeId).value().toInt();
|
||||||
if (!bulb->setGreen(greenValue))
|
if (!bulb->setGreen(greenValue))
|
||||||
return DeviceManager::DeviceErrorHardwareNotAvailable;
|
return DeviceManager::DeviceErrorHardwareNotAvailable;
|
||||||
|
|
||||||
return DeviceManager::DeviceErrorNoError;
|
return DeviceManager::DeviceErrorNoError;
|
||||||
} else if (action.actionTypeId() == aveaRedActionTypeId) {
|
} else if (action.actionTypeId() == aveaRedActionTypeId) {
|
||||||
int redValue = action.param(aveaRedStateParamTypeId).value().toInt();
|
int redValue = action.param(aveaRedActionParamTypeId).value().toInt();
|
||||||
if (!bulb->setRed(redValue))
|
if (!bulb->setRed(redValue))
|
||||||
return DeviceManager::DeviceErrorHardwareNotAvailable;
|
return DeviceManager::DeviceErrorHardwareNotAvailable;
|
||||||
|
|
||||||
return DeviceManager::DeviceErrorNoError;
|
return DeviceManager::DeviceErrorNoError;
|
||||||
} else if (action.actionTypeId() == aveaBlueActionTypeId) {
|
} else if (action.actionTypeId() == aveaBlueActionTypeId) {
|
||||||
int blueValue = action.param(aveaBlueStateParamTypeId).value().toInt();
|
int blueValue = action.param(aveaBlueActionParamTypeId).value().toInt();
|
||||||
if (!bulb->setBlue(blueValue))
|
if (!bulb->setBlue(blueValue))
|
||||||
return DeviceManager::DeviceErrorHardwareNotAvailable;
|
return DeviceManager::DeviceErrorHardwareNotAvailable;
|
||||||
|
|
||||||
return DeviceManager::DeviceErrorNoError;
|
return DeviceManager::DeviceErrorNoError;
|
||||||
} else if (action.actionTypeId() == aveaFadeActionTypeId) {
|
} else if (action.actionTypeId() == aveaFadeActionTypeId) {
|
||||||
int fadeValue = action.param(aveaFadeStateParamTypeId).value().toInt();
|
int fadeValue = action.param(aveaFadeActionParamTypeId).value().toInt();
|
||||||
device->setStateValue(aveaFadeStateTypeId, fadeValue);
|
device->setStateValue(aveaFadeStateTypeId, fadeValue);
|
||||||
if (!bulb->setFade(fadeValue))
|
if (!bulb->setFade(fadeValue))
|
||||||
return DeviceManager::DeviceErrorHardwareNotAvailable;
|
return DeviceManager::DeviceErrorHardwareNotAvailable;
|
||||||
|
|||||||
@ -162,7 +162,7 @@ DeviceManager::DeviceError DevicePluginEQ3::executeAction(Device *device, const
|
|||||||
int roomId = device->paramValue(wallThermostateRoomParamTypeId).toInt();
|
int roomId = device->paramValue(wallThermostateRoomParamTypeId).toInt();
|
||||||
|
|
||||||
if (action.actionTypeId() == wallThermostateDesiredTemperatureActionTypeId){
|
if (action.actionTypeId() == wallThermostateDesiredTemperatureActionTypeId){
|
||||||
cube->setDeviceSetpointTemp(rfAddress, roomId, action.param(wallThermostateDesiredTemperatureStateParamTypeId).value().toDouble(), action.id());
|
cube->setDeviceSetpointTemp(rfAddress, roomId, action.param(wallThermostateDesiredTemperatureActionParamTypeId).value().toDouble(), action.id());
|
||||||
} else if (action.actionTypeId() == wallThermostateSetAutoModeActionTypeId){
|
} else if (action.actionTypeId() == wallThermostateSetAutoModeActionTypeId){
|
||||||
cube->setDeviceAutoMode(rfAddress, roomId, action.id());
|
cube->setDeviceAutoMode(rfAddress, roomId, action.id());
|
||||||
} else if (action.actionTypeId() == wallThermostateSetManualModeActionTypeId){
|
} else if (action.actionTypeId() == wallThermostateSetManualModeActionTypeId){
|
||||||
@ -183,7 +183,7 @@ DeviceManager::DeviceError DevicePluginEQ3::executeAction(Device *device, const
|
|||||||
int roomId = device->paramValue(radiatorThermostateRoomParamTypeId).toInt();
|
int roomId = device->paramValue(radiatorThermostateRoomParamTypeId).toInt();
|
||||||
|
|
||||||
if (action.actionTypeId() == radiatorThermostateDesiredTemperatureActionTypeId){
|
if (action.actionTypeId() == radiatorThermostateDesiredTemperatureActionTypeId){
|
||||||
cube->setDeviceSetpointTemp(rfAddress, roomId, action.param(radiatorThermostateDesiredTemperatureStateParamTypeId).value().toDouble(), action.id());
|
cube->setDeviceSetpointTemp(rfAddress, roomId, action.param(radiatorThermostateDesiredTemperatureActionParamTypeId).value().toDouble(), action.id());
|
||||||
} else if (action.actionTypeId() == radiatorThermostateSetAutoModeActionTypeId){
|
} else if (action.actionTypeId() == radiatorThermostateSetAutoModeActionTypeId){
|
||||||
cube->setDeviceAutoMode(rfAddress, roomId, action.id());
|
cube->setDeviceAutoMode(rfAddress, roomId, action.id());
|
||||||
} else if (action.actionTypeId() == radiatorThermostateSetManualModeActionTypeId){
|
} else if (action.actionTypeId() == radiatorThermostateSetManualModeActionTypeId){
|
||||||
|
|||||||
@ -297,7 +297,7 @@ DeviceManager::DeviceError DevicePluginGpio::executeAction(Device *device, const
|
|||||||
if (deviceClass.vendorId() == raspberryPiVendorId) {
|
if (deviceClass.vendorId() == raspberryPiVendorId) {
|
||||||
if (action.actionTypeId() == gpioOutputRpiPowerValueActionTypeId) {
|
if (action.actionTypeId() == gpioOutputRpiPowerValueActionTypeId) {
|
||||||
bool success = false;
|
bool success = false;
|
||||||
if (action.param(gpioOutputRpiPowerValueStateParamTypeId).value().toBool()) {
|
if (action.param(gpioOutputRpiPowerValueActionParamTypeId).value().toBool()) {
|
||||||
success = gpio->setValue(Gpio::ValueHigh);
|
success = gpio->setValue(Gpio::ValueHigh);
|
||||||
} else {
|
} else {
|
||||||
success = gpio->setValue(Gpio::ValueLow);
|
success = gpio->setValue(Gpio::ValueLow);
|
||||||
@ -309,14 +309,14 @@ DeviceManager::DeviceError DevicePluginGpio::executeAction(Device *device, const
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Set the current state
|
// Set the current state
|
||||||
device->setStateValue(gpioOutputRpiPowerValueStateTypeId, action.param(gpioOutputRpiPowerValueStateParamTypeId).value());
|
device->setStateValue(gpioOutputRpiPowerValueStateTypeId, action.param(gpioOutputRpiPowerValueActionParamTypeId).value());
|
||||||
|
|
||||||
return DeviceManager::DeviceErrorNoError;
|
return DeviceManager::DeviceErrorNoError;
|
||||||
}
|
}
|
||||||
} else if (deviceClass.vendorId() == beagleboneBlackVendorId) {
|
} else if (deviceClass.vendorId() == beagleboneBlackVendorId) {
|
||||||
if (action.actionTypeId() == gpioOutputBbbPowerValueActionTypeId) {
|
if (action.actionTypeId() == gpioOutputBbbPowerValueActionTypeId) {
|
||||||
bool success = false;
|
bool success = false;
|
||||||
if (action.param(gpioOutputBbbPowerValueStateParamTypeId).value().toBool()) {
|
if (action.param(gpioOutputBbbPowerValueActionParamTypeId).value().toBool()) {
|
||||||
success = gpio->setValue(Gpio::ValueHigh);
|
success = gpio->setValue(Gpio::ValueHigh);
|
||||||
} else {
|
} else {
|
||||||
success = gpio->setValue(Gpio::ValueLow);
|
success = gpio->setValue(Gpio::ValueLow);
|
||||||
@ -328,7 +328,7 @@ DeviceManager::DeviceError DevicePluginGpio::executeAction(Device *device, const
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Set the current state
|
// Set the current state
|
||||||
device->setStateValue(gpioOutputBbbPowerValueStateTypeId, action.param(gpioOutputBbbPowerValueStateParamTypeId).value());
|
device->setStateValue(gpioOutputBbbPowerValueStateTypeId, action.param(gpioOutputBbbPowerValueActionParamTypeId).value());
|
||||||
|
|
||||||
return DeviceManager::DeviceErrorNoError;
|
return DeviceManager::DeviceErrorNoError;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -120,17 +120,17 @@ DeviceManager::DeviceError DevicePluginKeba::executeAction(Device *device, const
|
|||||||
|
|
||||||
if(action.actionTypeId() == wallboxMaxCurrentActionTypeId){
|
if(action.actionTypeId() == wallboxMaxCurrentActionTypeId){
|
||||||
// Print information that we are executing now the update action
|
// Print information that we are executing now the update action
|
||||||
qCDebug(dcKebaKeContact()) << "Update max current to : " << action.param(wallboxMaxCurrentStateParamTypeId).value().toString();
|
qCDebug(dcKebaKeContact()) << "Update max current to : " << action.param(wallboxMaxCurrentActionParamTypeId).value().toString();
|
||||||
QByteArray datagram;
|
QByteArray datagram;
|
||||||
datagram.append("curr " + QVariant(action.param(wallboxMaxCurrentStateParamTypeId).value().toInt()*1000).toString());
|
datagram.append("curr " + QVariant(action.param(wallboxMaxCurrentActionParamTypeId).value().toInt()*1000).toString());
|
||||||
qCDebug(dcKebaKeContact()) << "Datagram : " << datagram;
|
qCDebug(dcKebaKeContact()) << "Datagram : " << datagram;
|
||||||
m_kebaSocket->writeDatagram(datagram.data(),datagram.size(), QHostAddress(device->paramValue(wallboxIpParamTypeId).toString()) , 7090);
|
m_kebaSocket->writeDatagram(datagram.data(),datagram.size(), QHostAddress(device->paramValue(wallboxIpParamTypeId).toString()) , 7090);
|
||||||
}
|
}
|
||||||
else if(action.actionTypeId() == wallboxOutEnableActionTypeId){
|
else if(action.actionTypeId() == wallboxOutEnableActionTypeId){
|
||||||
// Print information that we are executing now the update action
|
// Print information that we are executing now the update action
|
||||||
qCDebug(dcKebaKeContact()) << "output enable : " << action.param(wallboxOutEnableStateParamTypeId).value().toString();
|
qCDebug(dcKebaKeContact()) << "output enable : " << action.param(wallboxOutEnableActionParamTypeId).value().toString();
|
||||||
QByteArray datagram;
|
QByteArray datagram;
|
||||||
if(action.param(wallboxOutEnableStateParamTypeId).value().toBool()){
|
if(action.param(wallboxOutEnableActionParamTypeId).value().toBool()){
|
||||||
datagram.append("ena 1");
|
datagram.append("ena 1");
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
|||||||
@ -148,10 +148,10 @@ DeviceManager::DeviceError DevicePluginKodi::executeAction(Device *device, const
|
|||||||
kodi->showNotification(action.param(kodiMessageParamTypeId).value().toString(), 8000, action.param(kodiTypeParamTypeId).value().toString(), action.id());
|
kodi->showNotification(action.param(kodiMessageParamTypeId).value().toString(), 8000, action.param(kodiTypeParamTypeId).value().toString(), action.id());
|
||||||
return DeviceManager::DeviceErrorAsync;
|
return DeviceManager::DeviceErrorAsync;
|
||||||
} else if (action.actionTypeId() == kodiVolumeActionTypeId) {
|
} else if (action.actionTypeId() == kodiVolumeActionTypeId) {
|
||||||
kodi->setVolume(action.param(kodiVolumeStateParamTypeId).value().toInt(), action.id());
|
kodi->setVolume(action.param(kodiVolumeActionParamTypeId).value().toInt(), action.id());
|
||||||
return DeviceManager::DeviceErrorAsync;
|
return DeviceManager::DeviceErrorAsync;
|
||||||
} else if (action.actionTypeId() == kodiMuteActionTypeId) {
|
} else if (action.actionTypeId() == kodiMuteActionTypeId) {
|
||||||
kodi->setMuted(action.param(kodiMuteStateParamTypeId).value().toBool(), action.id());
|
kodi->setMuted(action.param(kodiMuteActionParamTypeId).value().toBool(), action.id());
|
||||||
return DeviceManager::DeviceErrorAsync;
|
return DeviceManager::DeviceErrorAsync;
|
||||||
} else if (action.actionTypeId() == kodiPressButtonActionTypeId) {
|
} else if (action.actionTypeId() == kodiPressButtonActionTypeId) {
|
||||||
kodi->pressButton(action.param(kodiButtonParamTypeId).value().toString(), action.id());
|
kodi->pressButton(action.param(kodiButtonParamTypeId).value().toString(), action.id());
|
||||||
|
|||||||
@ -12,7 +12,7 @@
|
|||||||
"id": "728d5a67-27a3-400e-b83c-2765f5196f69",
|
"id": "728d5a67-27a3-400e-b83c-2765f5196f69",
|
||||||
"name": "connection",
|
"name": "connection",
|
||||||
"displayName": "Netatmo Connection",
|
"displayName": "Netatmo Connection",
|
||||||
"critcalStateTypeId": "2f79bc1d-27ed-480a-b583-728363c83ea6",
|
"criticalStateTypeId": "2f79bc1d-27ed-480a-b583-728363c83ea6",
|
||||||
"deviceIcon": "Network",
|
"deviceIcon": "Network",
|
||||||
"interfaces": ["gateway"],
|
"interfaces": ["gateway"],
|
||||||
"basicTags": [
|
"basicTags": [
|
||||||
|
|||||||
@ -147,7 +147,7 @@ DeviceManager::DeviceError DevicePluginOrderButton::executeAction(Device *device
|
|||||||
return DeviceManager::DeviceErrorAsync;
|
return DeviceManager::DeviceErrorAsync;
|
||||||
|
|
||||||
} else if(action.actionTypeId() == orderbuttonLedActionTypeId) {
|
} else if(action.actionTypeId() == orderbuttonLedActionTypeId) {
|
||||||
bool led = action.param(orderbuttonLedStateParamTypeId).value().toBool();
|
bool led = action.param(orderbuttonLedActionParamTypeId).value().toBool();
|
||||||
|
|
||||||
QUrl url;
|
QUrl url;
|
||||||
url.setScheme("coap");
|
url.setScheme("coap");
|
||||||
@ -466,7 +466,7 @@ void DevicePluginOrderButton::coapReplyFinished(CoapReply *reply)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Update the state here, so we don't have to wait for the notification
|
// Update the state here, so we don't have to wait for the notification
|
||||||
device->setStateValue(orderbuttonLedStateTypeId, action.param(orderbuttonLedStateParamTypeId).value().toBool());
|
device->setStateValue(orderbuttonLedStateTypeId, action.param(orderbuttonLedActionParamTypeId).value().toBool());
|
||||||
// Tell the user about the action execution result
|
// Tell the user about the action execution result
|
||||||
emit actionExecutionFinished(action.id(), DeviceManager::DeviceErrorNoError);
|
emit actionExecutionFinished(action.id(), DeviceManager::DeviceErrorNoError);
|
||||||
|
|
||||||
|
|||||||
@ -459,25 +459,25 @@ DeviceManager::DeviceError DevicePluginPhilipsHue::executeAction(Device *device,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (action.actionTypeId() == hueLightPowerActionTypeId) {
|
if (action.actionTypeId() == hueLightPowerActionTypeId) {
|
||||||
QPair<QNetworkRequest, QByteArray> request = light->createSetPowerRequest(action.param(hueLightPowerStateParamTypeId).value().toBool());
|
QPair<QNetworkRequest, QByteArray> request = light->createSetPowerRequest(action.param(hueLightPowerActionParamTypeId).value().toBool());
|
||||||
QNetworkReply *reply = hardwareManager()->networkManager()->put(request.first, request.second);
|
QNetworkReply *reply = hardwareManager()->networkManager()->put(request.first, request.second);
|
||||||
connect(reply, &QNetworkReply::finished, this, &DevicePluginPhilipsHue::networkManagerReplyReady);
|
connect(reply, &QNetworkReply::finished, this, &DevicePluginPhilipsHue::networkManagerReplyReady);
|
||||||
m_asyncActions.insert(reply, QPair<Device *, ActionId>(device, action.id()));
|
m_asyncActions.insert(reply, QPair<Device *, ActionId>(device, action.id()));
|
||||||
return DeviceManager::DeviceErrorAsync;
|
return DeviceManager::DeviceErrorAsync;
|
||||||
} else if (action.actionTypeId() == hueLightColorActionTypeId) {
|
} else if (action.actionTypeId() == hueLightColorActionTypeId) {
|
||||||
QPair<QNetworkRequest, QByteArray> request = light->createSetColorRequest(action.param(hueLightColorStateParamTypeId).value().value<QColor>());
|
QPair<QNetworkRequest, QByteArray> request = light->createSetColorRequest(action.param(hueLightColorActionParamTypeId).value().value<QColor>());
|
||||||
QNetworkReply *reply = hardwareManager()->networkManager()->put(request.first, request.second);
|
QNetworkReply *reply = hardwareManager()->networkManager()->put(request.first, request.second);
|
||||||
connect(reply, &QNetworkReply::finished, this, &DevicePluginPhilipsHue::networkManagerReplyReady);
|
connect(reply, &QNetworkReply::finished, this, &DevicePluginPhilipsHue::networkManagerReplyReady);
|
||||||
m_asyncActions.insert(reply,QPair<Device *, ActionId>(device, action.id()));
|
m_asyncActions.insert(reply,QPair<Device *, ActionId>(device, action.id()));
|
||||||
return DeviceManager::DeviceErrorAsync;
|
return DeviceManager::DeviceErrorAsync;
|
||||||
} else if (action.actionTypeId() == hueLightBrightnessActionTypeId) {
|
} else if (action.actionTypeId() == hueLightBrightnessActionTypeId) {
|
||||||
QPair<QNetworkRequest, QByteArray> request = light->createSetBrightnessRequest(percentageToBrightness(action.param(hueLightBrightnessStateParamTypeId).value().toInt()));
|
QPair<QNetworkRequest, QByteArray> request = light->createSetBrightnessRequest(percentageToBrightness(action.param(hueLightBrightnessActionParamTypeId).value().toInt()));
|
||||||
QNetworkReply *reply = hardwareManager()->networkManager()->put(request.first, request.second);
|
QNetworkReply *reply = hardwareManager()->networkManager()->put(request.first, request.second);
|
||||||
connect(reply, &QNetworkReply::finished, this, &DevicePluginPhilipsHue::networkManagerReplyReady);
|
connect(reply, &QNetworkReply::finished, this, &DevicePluginPhilipsHue::networkManagerReplyReady);
|
||||||
m_asyncActions.insert(reply, QPair<Device *, ActionId>(device, action.id()));
|
m_asyncActions.insert(reply, QPair<Device *, ActionId>(device, action.id()));
|
||||||
return DeviceManager::DeviceErrorAsync;
|
return DeviceManager::DeviceErrorAsync;
|
||||||
} else if (action.actionTypeId() == hueLightHueEffectActionTypeId) {
|
} else if (action.actionTypeId() == hueLightHueEffectActionTypeId) {
|
||||||
QPair<QNetworkRequest, QByteArray> request = light->createSetEffectRequest(action.param(hueLightHueEffectStateParamTypeId).value().toString());
|
QPair<QNetworkRequest, QByteArray> request = light->createSetEffectRequest(action.param(hueLightHueEffectActionParamTypeId).value().toString());
|
||||||
QNetworkReply *reply = hardwareManager()->networkManager()->put(request.first, request.second);
|
QNetworkReply *reply = hardwareManager()->networkManager()->put(request.first, request.second);
|
||||||
connect(reply, &QNetworkReply::finished, this, &DevicePluginPhilipsHue::networkManagerReplyReady);
|
connect(reply, &QNetworkReply::finished, this, &DevicePluginPhilipsHue::networkManagerReplyReady);
|
||||||
m_asyncActions.insert(reply, QPair<Device *, ActionId>(device, action.id()));
|
m_asyncActions.insert(reply, QPair<Device *, ActionId>(device, action.id()));
|
||||||
@ -489,7 +489,7 @@ DeviceManager::DeviceError DevicePluginPhilipsHue::executeAction(Device *device,
|
|||||||
m_asyncActions.insert(reply, QPair<Device *, ActionId>(device, action.id()));
|
m_asyncActions.insert(reply, QPair<Device *, ActionId>(device, action.id()));
|
||||||
return DeviceManager::DeviceErrorAsync;
|
return DeviceManager::DeviceErrorAsync;
|
||||||
} else if (action.actionTypeId() == hueLightColorTemperatureActionTypeId) {
|
} else if (action.actionTypeId() == hueLightColorTemperatureActionTypeId) {
|
||||||
QPair<QNetworkRequest, QByteArray> request = light->createSetTemperatureRequest(action.param(hueLightColorTemperatureStateParamTypeId).value().toInt());
|
QPair<QNetworkRequest, QByteArray> request = light->createSetTemperatureRequest(action.param(hueLightColorTemperatureActionParamTypeId).value().toInt());
|
||||||
QNetworkReply *reply = hardwareManager()->networkManager()->put(request.first, request.second);
|
QNetworkReply *reply = hardwareManager()->networkManager()->put(request.first, request.second);
|
||||||
connect(reply, &QNetworkReply::finished, this, &DevicePluginPhilipsHue::networkManagerReplyReady);
|
connect(reply, &QNetworkReply::finished, this, &DevicePluginPhilipsHue::networkManagerReplyReady);
|
||||||
m_asyncActions.insert(reply, QPair<Device *, ActionId>(device, action.id()));
|
m_asyncActions.insert(reply, QPair<Device *, ActionId>(device, action.id()));
|
||||||
@ -508,13 +508,13 @@ DeviceManager::DeviceError DevicePluginPhilipsHue::executeAction(Device *device,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (action.actionTypeId() == hueWhiteLightPowerActionTypeId) {
|
if (action.actionTypeId() == hueWhiteLightPowerActionTypeId) {
|
||||||
QPair<QNetworkRequest, QByteArray> request = light->createSetPowerRequest(action.param(hueWhiteLightPowerStateParamTypeId).value().toBool());
|
QPair<QNetworkRequest, QByteArray> request = light->createSetPowerRequest(action.param(hueWhiteLightPowerActionParamTypeId).value().toBool());
|
||||||
QNetworkReply *reply = hardwareManager()->networkManager()->put(request.first, request.second);
|
QNetworkReply *reply = hardwareManager()->networkManager()->put(request.first, request.second);
|
||||||
connect(reply, &QNetworkReply::finished, this, &DevicePluginPhilipsHue::networkManagerReplyReady);
|
connect(reply, &QNetworkReply::finished, this, &DevicePluginPhilipsHue::networkManagerReplyReady);
|
||||||
m_asyncActions.insert(reply, QPair<Device *, ActionId>(device, action.id()));
|
m_asyncActions.insert(reply, QPair<Device *, ActionId>(device, action.id()));
|
||||||
return DeviceManager::DeviceErrorAsync;
|
return DeviceManager::DeviceErrorAsync;
|
||||||
} else if (action.actionTypeId() == hueWhiteLightBrightnessActionTypeId) {
|
} else if (action.actionTypeId() == hueWhiteLightBrightnessActionTypeId) {
|
||||||
QPair<QNetworkRequest, QByteArray> request = light->createSetBrightnessRequest(percentageToBrightness(action.param(hueWhiteLightBrightnessStateParamTypeId).value().toInt()));
|
QPair<QNetworkRequest, QByteArray> request = light->createSetBrightnessRequest(percentageToBrightness(action.param(hueWhiteLightBrightnessActionParamTypeId).value().toInt()));
|
||||||
QNetworkReply *reply = hardwareManager()->networkManager()->put(request.first, request.second);
|
QNetworkReply *reply = hardwareManager()->networkManager()->put(request.first, request.second);
|
||||||
connect(reply, &QNetworkReply::finished, this, &DevicePluginPhilipsHue::networkManagerReplyReady);
|
connect(reply, &QNetworkReply::finished, this, &DevicePluginPhilipsHue::networkManagerReplyReady);
|
||||||
m_asyncActions.insert(reply, QPair<Device *, ActionId>(device, action.id()));
|
m_asyncActions.insert(reply, QPair<Device *, ActionId>(device, action.id()));
|
||||||
|
|||||||
@ -102,7 +102,7 @@ DeviceManager::DeviceError DevicePluginPlantCare::discoverDevices(const DeviceCl
|
|||||||
Q_UNUSED(params)
|
Q_UNUSED(params)
|
||||||
|
|
||||||
// Perform a HTTP GET on the RPL router address
|
// Perform a HTTP GET on the RPL router address
|
||||||
QHostAddress address(configuration().paramValue(PlantCareRplParamTypeId).toString());
|
QHostAddress address(configuration().paramValue(plantCareRplParamTypeId).toString());
|
||||||
qCDebug(dcPlantCare) << "Scan for new nodes on RPL" << address.toString();
|
qCDebug(dcPlantCare) << "Scan for new nodes on RPL" << address.toString();
|
||||||
|
|
||||||
QUrl url;
|
QUrl url;
|
||||||
@ -148,7 +148,7 @@ DeviceManager::DeviceError DevicePluginPlantCare::executeAction(Device *device,
|
|||||||
return DeviceManager::DeviceErrorAsync;
|
return DeviceManager::DeviceErrorAsync;
|
||||||
|
|
||||||
} else if(action.actionTypeId() == plantCareLedPowerActionTypeId) {
|
} else if(action.actionTypeId() == plantCareLedPowerActionTypeId) {
|
||||||
int power = action.param(plantCareLedPowerStateParamTypeId).value().toInt();
|
int power = action.param(plantCareLedPowerActionParamTypeId).value().toInt();
|
||||||
|
|
||||||
QUrl url;
|
QUrl url;
|
||||||
url.setScheme("coap");
|
url.setScheme("coap");
|
||||||
@ -170,7 +170,7 @@ DeviceManager::DeviceError DevicePluginPlantCare::executeAction(Device *device,
|
|||||||
return DeviceManager::DeviceErrorAsync;
|
return DeviceManager::DeviceErrorAsync;
|
||||||
|
|
||||||
} else if(action.actionTypeId() == plantCareWaterPumpActionTypeId) {
|
} else if(action.actionTypeId() == plantCareWaterPumpActionTypeId) {
|
||||||
bool pump = action.param(plantCareWaterPumpStateParamTypeId).value().toBool();
|
bool pump = action.param(plantCareWaterPumpActionParamTypeId).value().toBool();
|
||||||
|
|
||||||
QUrl url;
|
QUrl url;
|
||||||
url.setScheme("coap");
|
url.setScheme("coap");
|
||||||
@ -517,7 +517,7 @@ void DevicePluginPlantCare::coapReplyFinished(CoapReply *reply)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Update the state here, so we don't have to wait for the notification
|
// Update the state here, so we don't have to wait for the notification
|
||||||
device->setStateValue(plantCareLedPowerStateTypeId, action.param(plantCareLedPowerStateParamTypeId).value().toBool());
|
device->setStateValue(plantCareLedPowerStateTypeId, action.param(plantCareLedPowerActionParamTypeId).value().toBool());
|
||||||
// Tell the user about the action execution result
|
// Tell the user about the action execution result
|
||||||
emit actionExecutionFinished(action.id(), DeviceManager::DeviceErrorNoError);
|
emit actionExecutionFinished(action.id(), DeviceManager::DeviceErrorNoError);
|
||||||
|
|
||||||
@ -543,7 +543,7 @@ void DevicePluginPlantCare::coapReplyFinished(CoapReply *reply)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Update the state here, so we don't have to wait for the notification
|
// Update the state here, so we don't have to wait for the notification
|
||||||
device->setStateValue(plantCareWaterPumpStateTypeId, action.param(plantCareWaterPumpStateParamTypeId).value().toBool());
|
device->setStateValue(plantCareWaterPumpStateTypeId, action.param(plantCareWaterPumpActionParamTypeId).value().toBool());
|
||||||
// Tell the user about the action execution result
|
// Tell the user about the action execution result
|
||||||
emit actionExecutionFinished(action.id(), DeviceManager::DeviceErrorNoError);
|
emit actionExecutionFinished(action.id(), DeviceManager::DeviceErrorNoError);
|
||||||
|
|
||||||
|
|||||||
@ -55,7 +55,7 @@ DeviceManager::DeviceError DevicePluginRemoteSsh::executeAction(Device *device,
|
|||||||
|
|
||||||
if (action.actionTypeId() == reverseSshConnectedActionTypeId) {
|
if (action.actionTypeId() == reverseSshConnectedActionTypeId) {
|
||||||
|
|
||||||
if (action.param(reverseSshConnectedStateParamTypeId).value().toBool() == true) {
|
if (action.param(reverseSshConnectedActionParamTypeId).value().toBool() == true) {
|
||||||
QProcess *process = startReverseSSHProcess(device);
|
QProcess *process = startReverseSSHProcess(device);
|
||||||
m_reverseSSHProcess.insert(process, device);
|
m_reverseSSHProcess.insert(process, device);
|
||||||
m_startingProcess.insert(process, action.id());
|
m_startingProcess.insert(process, action.id());
|
||||||
|
|||||||
@ -81,7 +81,7 @@ DeviceManager::DeviceError DevicePluginSimulation::executeAction(Device *device,
|
|||||||
if (action.actionTypeId() == alternativeButtonPowerActionTypeId) {
|
if (action.actionTypeId() == alternativeButtonPowerActionTypeId) {
|
||||||
|
|
||||||
// get the param value
|
// get the param value
|
||||||
Param powerParam = action.param(alternativeButtonPowerStateParamTypeId);
|
Param powerParam = action.param(alternativeButtonPowerActionParamTypeId);
|
||||||
bool power = powerParam.value().toBool();
|
bool power = powerParam.value().toBool();
|
||||||
|
|
||||||
qCDebug(dcSimulation()) << "Set power" << power << "for button" << device->name();
|
qCDebug(dcSimulation()) << "Set power" << power << "for button" << device->name();
|
||||||
@ -100,7 +100,7 @@ DeviceManager::DeviceError DevicePluginSimulation::executeAction(Device *device,
|
|||||||
if (action.actionTypeId() == heatingPowerActionTypeId) {
|
if (action.actionTypeId() == heatingPowerActionTypeId) {
|
||||||
|
|
||||||
// get the param value
|
// get the param value
|
||||||
Param powerParam = action.param(heatingPowerStateParamTypeId);
|
Param powerParam = action.param(heatingPowerActionParamTypeId);
|
||||||
bool power = powerParam.value().toBool();
|
bool power = powerParam.value().toBool();
|
||||||
qCDebug(dcSimulation()) << "Set power" << power << "for heating device" << device->name();
|
qCDebug(dcSimulation()) << "Set power" << power << "for heating device" << device->name();
|
||||||
device->setStateValue(heatingPowerStateTypeId, power);
|
device->setStateValue(heatingPowerStateTypeId, power);
|
||||||
@ -109,7 +109,7 @@ DeviceManager::DeviceError DevicePluginSimulation::executeAction(Device *device,
|
|||||||
} else if (action.actionTypeId() == heatingTargetTemperatureActionTypeId) {
|
} else if (action.actionTypeId() == heatingTargetTemperatureActionTypeId) {
|
||||||
|
|
||||||
// get the param value
|
// get the param value
|
||||||
Param temperatureParam = action.param(heatingTargetTemperatureStateParamTypeId);
|
Param temperatureParam = action.param(heatingTargetTemperatureActionParamTypeId);
|
||||||
int temperature = temperatureParam.value().toInt();
|
int temperature = temperatureParam.value().toInt();
|
||||||
|
|
||||||
qCDebug(dcSimulation()) << "Set target temperature" << temperature << "for heating device" << device->name();
|
qCDebug(dcSimulation()) << "Set target temperature" << temperature << "for heating device" << device->name();
|
||||||
@ -124,7 +124,7 @@ DeviceManager::DeviceError DevicePluginSimulation::executeAction(Device *device,
|
|||||||
|
|
||||||
if (action.actionTypeId() == evChargerPowerActionTypeId){
|
if (action.actionTypeId() == evChargerPowerActionTypeId){
|
||||||
// get the param value
|
// get the param value
|
||||||
Param powerParam = action.param(evChargerPowerStateParamTypeId);
|
Param powerParam = action.param(evChargerPowerActionParamTypeId);
|
||||||
bool power = powerParam.value().toBool();
|
bool power = powerParam.value().toBool();
|
||||||
|
|
||||||
qCDebug(dcSimulation()) << "Set power" << power << "for heating device" << device->name();
|
qCDebug(dcSimulation()) << "Set power" << power << "for heating device" << device->name();
|
||||||
@ -134,7 +134,7 @@ DeviceManager::DeviceError DevicePluginSimulation::executeAction(Device *device,
|
|||||||
|
|
||||||
} else if(action.actionTypeId() == evChargerCurrentActionTypeId){
|
} else if(action.actionTypeId() == evChargerCurrentActionTypeId){
|
||||||
// get the param value
|
// get the param value
|
||||||
Param currentParam = action.param(evChargerCurrentStateParamTypeId);
|
Param currentParam = action.param(evChargerCurrentActionParamTypeId);
|
||||||
int current = currentParam.value().toInt();
|
int current = currentParam.value().toInt();
|
||||||
qCDebug(dcSimulation()) << "Set current" << current << "for EV Charger device" << device->name();
|
qCDebug(dcSimulation()) << "Set current" << current << "for EV Charger device" << device->name();
|
||||||
device->setStateValue(evChargerCurrentStateTypeId, current);
|
device->setStateValue(evChargerCurrentStateTypeId, current);
|
||||||
@ -147,7 +147,7 @@ DeviceManager::DeviceError DevicePluginSimulation::executeAction(Device *device,
|
|||||||
|
|
||||||
if(action.actionTypeId() == socketPowerActionTypeId){
|
if(action.actionTypeId() == socketPowerActionTypeId){
|
||||||
// get the param value
|
// get the param value
|
||||||
Param powerParam = action.param(socketPowerStateParamTypeId);
|
Param powerParam = action.param(socketPowerActionParamTypeId);
|
||||||
bool power = powerParam.value().toBool();
|
bool power = powerParam.value().toBool();
|
||||||
// Set the "power" state
|
// Set the "power" state
|
||||||
qCDebug(dcSimulation()) << "Set power" << power << "for socket device" << device->name();
|
qCDebug(dcSimulation()) << "Set power" << power << "for socket device" << device->name();
|
||||||
@ -160,25 +160,25 @@ DeviceManager::DeviceError DevicePluginSimulation::executeAction(Device *device,
|
|||||||
if(device->deviceClassId() == colorBulbDeviceClassId){
|
if(device->deviceClassId() == colorBulbDeviceClassId){
|
||||||
|
|
||||||
if(action.actionTypeId() == colorBulbBrightnessActionTypeId){
|
if(action.actionTypeId() == colorBulbBrightnessActionTypeId){
|
||||||
int brightness = action.param(colorBulbBrightnessStateParamTypeId).value().toInt();
|
int brightness = action.param(colorBulbBrightnessActionParamTypeId).value().toInt();
|
||||||
qCDebug(dcSimulation()) << "Set brightness" << brightness << "for color bulb device" << device->name();
|
qCDebug(dcSimulation()) << "Set brightness" << brightness << "for color bulb device" << device->name();
|
||||||
device->setStateValue(colorBulbBrightnessStateTypeId, brightness);
|
device->setStateValue(colorBulbBrightnessStateTypeId, brightness);
|
||||||
return DeviceManager::DeviceErrorNoError;
|
return DeviceManager::DeviceErrorNoError;
|
||||||
|
|
||||||
} else if (action.actionTypeId() == colorBulbColorTemperatureActionTypeId){
|
} else if (action.actionTypeId() == colorBulbColorTemperatureActionTypeId){
|
||||||
int temperature = action.param(colorBulbColorTemperatureStateParamTypeId).value().toInt();
|
int temperature = action.param(colorBulbColorTemperatureActionParamTypeId).value().toInt();
|
||||||
qCDebug(dcSimulation()) << "Set color temperature" << temperature << "for color bulb device" << device->name();
|
qCDebug(dcSimulation()) << "Set color temperature" << temperature << "for color bulb device" << device->name();
|
||||||
device->setStateValue(colorBulbColorTemperatureStateTypeId, temperature);
|
device->setStateValue(colorBulbColorTemperatureStateTypeId, temperature);
|
||||||
return DeviceManager::DeviceErrorNoError;
|
return DeviceManager::DeviceErrorNoError;
|
||||||
|
|
||||||
} else if (action.actionTypeId() == colorBulbColorActionTypeId) {
|
} else if (action.actionTypeId() == colorBulbColorActionTypeId) {
|
||||||
QColor color = action.param(colorBulbColorStateParamTypeId).value().value<QColor>();
|
QColor color = action.param(colorBulbColorActionParamTypeId).value().value<QColor>();
|
||||||
qCDebug(dcSimulation()) << "Set color" << color << "for color bulb device" << device->name();
|
qCDebug(dcSimulation()) << "Set color" << color << "for color bulb device" << device->name();
|
||||||
device->setStateValue(colorBulbColorStateTypeId, color);
|
device->setStateValue(colorBulbColorStateTypeId, color);
|
||||||
return DeviceManager::DeviceErrorNoError;
|
return DeviceManager::DeviceErrorNoError;
|
||||||
|
|
||||||
} else if (action.actionTypeId() == colorBulbPowerActionTypeId) {
|
} else if (action.actionTypeId() == colorBulbPowerActionTypeId) {
|
||||||
bool power = action.param(colorBulbPowerStateParamTypeId).value().toBool();
|
bool power = action.param(colorBulbPowerActionParamTypeId).value().toBool();
|
||||||
qCDebug(dcSimulation()) << "Set power" << power << "for color bulb device" << device->name();
|
qCDebug(dcSimulation()) << "Set power" << power << "for color bulb device" << device->name();
|
||||||
device->setStateValue(colorBulbPowerStateTypeId, power);
|
device->setStateValue(colorBulbPowerStateTypeId, power);
|
||||||
return DeviceManager::DeviceErrorNoError;
|
return DeviceManager::DeviceErrorNoError;
|
||||||
@ -190,17 +190,17 @@ DeviceManager::DeviceError DevicePluginSimulation::executeAction(Device *device,
|
|||||||
if (device->deviceClassId() == heatingRodDeviceClassId) {
|
if (device->deviceClassId() == heatingRodDeviceClassId) {
|
||||||
|
|
||||||
if (action.actionTypeId() == heatingRodPowerActionTypeId) {
|
if (action.actionTypeId() == heatingRodPowerActionTypeId) {
|
||||||
bool power = action.param(heatingRodPowerStateParamTypeId).value().toBool();
|
bool power = action.param(heatingRodPowerActionParamTypeId).value().toBool();
|
||||||
qCDebug(dcSimulation()) << "Set power" << power << "for heating rod device" << device->name();
|
qCDebug(dcSimulation()) << "Set power" << power << "for heating rod device" << device->name();
|
||||||
device->setStateValue(heatingRodPowerStateTypeId, power);
|
device->setStateValue(heatingRodPowerStateTypeId, power);
|
||||||
return DeviceManager::DeviceErrorNoError;
|
return DeviceManager::DeviceErrorNoError;
|
||||||
} else if (action.actionTypeId() == heatingRodWaterTemperatureActionTypeId) {
|
} else if (action.actionTypeId() == heatingRodWaterTemperatureActionTypeId) {
|
||||||
int temperature = action.param(heatingRodWaterTemperatureStateParamTypeId).value().toInt();
|
int temperature = action.param(heatingRodWaterTemperatureActionParamTypeId).value().toInt();
|
||||||
qCDebug(dcSimulation()) << "Set water temperature" << temperature << "for heating rod device" << device->name();
|
qCDebug(dcSimulation()) << "Set water temperature" << temperature << "for heating rod device" << device->name();
|
||||||
device->setStateValue(heatingRodWaterTemperatureStateTypeId, temperature);
|
device->setStateValue(heatingRodWaterTemperatureStateTypeId, temperature);
|
||||||
return DeviceManager::DeviceErrorNoError;
|
return DeviceManager::DeviceErrorNoError;
|
||||||
} else if (action.actionTypeId() == heatingRodMaxPowerActionTypeId) {
|
} else if (action.actionTypeId() == heatingRodMaxPowerActionTypeId) {
|
||||||
double maxPower = action.param(heatingRodMaxPowerStateParamTypeId).value().toDouble();
|
double maxPower = action.param(heatingRodMaxPowerActionParamTypeId).value().toDouble();
|
||||||
qCDebug(dcSimulation()) << "Set max power" << maxPower << "for heating rod device" << device->name();
|
qCDebug(dcSimulation()) << "Set max power" << maxPower << "for heating rod device" << device->name();
|
||||||
device->setStateValue(heatingRodMaxPowerStateTypeId, maxPower);
|
device->setStateValue(heatingRodMaxPowerStateTypeId, maxPower);
|
||||||
return DeviceManager::DeviceErrorNoError;
|
return DeviceManager::DeviceErrorNoError;
|
||||||
@ -211,7 +211,7 @@ DeviceManager::DeviceError DevicePluginSimulation::executeAction(Device *device,
|
|||||||
|
|
||||||
if (device->deviceClassId() == batteryDeviceClassId) {
|
if (device->deviceClassId() == batteryDeviceClassId) {
|
||||||
if (action.actionTypeId() == batteryMaxChargingActionTypeId) {
|
if (action.actionTypeId() == batteryMaxChargingActionTypeId) {
|
||||||
int maxCharging = action.param(batteryMaxChargingStateParamTypeId).value().toInt();
|
int maxCharging = action.param(batteryMaxChargingActionParamTypeId).value().toInt();
|
||||||
device->setStateValue(batteryMaxChargingStateTypeId, maxCharging);
|
device->setStateValue(batteryMaxChargingStateTypeId, maxCharging);
|
||||||
qCDebug(dcSimulation()) << "Set max charging power" << maxCharging << "for battery device" << device->name();
|
qCDebug(dcSimulation()) << "Set max charging power" << maxCharging << "for battery device" << device->name();
|
||||||
device->setStateValue(batteryChargingStateTypeId, maxCharging);
|
device->setStateValue(batteryChargingStateTypeId, maxCharging);
|
||||||
@ -222,7 +222,7 @@ DeviceManager::DeviceError DevicePluginSimulation::executeAction(Device *device,
|
|||||||
|
|
||||||
if (device->deviceClassId() == waterValveDeviceClassId) {
|
if (device->deviceClassId() == waterValveDeviceClassId) {
|
||||||
if (action.actionTypeId() == waterValvePowerActionTypeId) {
|
if (action.actionTypeId() == waterValvePowerActionTypeId) {
|
||||||
bool power = action.param(waterValvePowerStateParamTypeId).value().toBool();
|
bool power = action.param(waterValvePowerActionParamTypeId).value().toBool();
|
||||||
device->setStateValue(waterValvePowerStateTypeId, power);
|
device->setStateValue(waterValvePowerStateTypeId, power);
|
||||||
return DeviceManager::DeviceErrorNoError;
|
return DeviceManager::DeviceErrorNoError;
|
||||||
}
|
}
|
||||||
@ -255,7 +255,6 @@ bool DevicePluginSimulation::generateRandomBoolValue()
|
|||||||
|
|
||||||
void DevicePluginSimulation::onPluginTimer20Seconds()
|
void DevicePluginSimulation::onPluginTimer20Seconds()
|
||||||
{
|
{
|
||||||
qCDebug(dcSimulation()) << "Update values for 20s timer";
|
|
||||||
foreach (Device *device, myDevices()) {
|
foreach (Device *device, myDevices()) {
|
||||||
if (device->deviceClassId() == temperatureSensorDeviceClassId) {
|
if (device->deviceClassId() == temperatureSensorDeviceClassId) {
|
||||||
// Temperature sensor
|
// Temperature sensor
|
||||||
@ -292,7 +291,6 @@ void DevicePluginSimulation::onPluginTimer20Seconds()
|
|||||||
|
|
||||||
void DevicePluginSimulation::onPluginTimer5Minutes()
|
void DevicePluginSimulation::onPluginTimer5Minutes()
|
||||||
{
|
{
|
||||||
qCDebug(dcSimulation()) << "Update values for 5 minutes timer";
|
|
||||||
foreach (Device *device, myDevices()) {
|
foreach (Device *device, myDevices()) {
|
||||||
if(device->deviceClassId() == netatmoIndoorDeviceClassId) {
|
if(device->deviceClassId() == netatmoIndoorDeviceClassId) {
|
||||||
// Note: should change between > 1000 co2 < 1000 for showcase, please do not change this behaviour
|
// Note: should change between > 1000 co2 < 1000 for showcase, please do not change this behaviour
|
||||||
|
|||||||
@ -7,7 +7,6 @@
|
|||||||
"name": "simulation",
|
"name": "simulation",
|
||||||
"displayName": "Simulation",
|
"displayName": "Simulation",
|
||||||
"id": "fd2ae067-2c3d-4332-9c4b-ee0af653bcaf",
|
"id": "fd2ae067-2c3d-4332-9c4b-ee0af653bcaf",
|
||||||
"interfaces": ["simplebutton"],
|
|
||||||
"deviceClasses": [
|
"deviceClasses": [
|
||||||
{
|
{
|
||||||
"id": "73bb670b-e7a3-40da-bd6f-3260f017ec80",
|
"id": "73bb670b-e7a3-40da-bd6f-3260f017ec80",
|
||||||
@ -54,7 +53,6 @@
|
|||||||
"displayNameEvent": "Power changed",
|
"displayNameEvent": "Power changed",
|
||||||
"displayNameAction": "Set power",
|
"displayNameAction": "Set power",
|
||||||
"defaultValue": false,
|
"defaultValue": false,
|
||||||
"index" : 0,
|
|
||||||
"writable": true
|
"writable": true
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@ -284,20 +282,17 @@
|
|||||||
{
|
{
|
||||||
"id": "1786029d-f3a6-4b47-978a-ac1a581aac0f",
|
"id": "1786029d-f3a6-4b47-978a-ac1a581aac0f",
|
||||||
"name": "open",
|
"name": "open",
|
||||||
"displayName": "Open",
|
"displayName": "Open"
|
||||||
"type": "bool"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "2786029d-f3a6-4b47-978a-ac1a581aac0f",
|
"id": "2786029d-f3a6-4b47-978a-ac1a581aac0f",
|
||||||
"name": "stop",
|
"name": "stop",
|
||||||
"displayName": "Stop",
|
"displayName": "Stop"
|
||||||
"type": "bool"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "3786029d-f3a6-4b47-978a-ac1a581aac0f",
|
"id": "3786029d-f3a6-4b47-978a-ac1a581aac0f",
|
||||||
"name": "close",
|
"name": "close",
|
||||||
"displayName": "Close",
|
"displayName": "Close"
|
||||||
"type": "bool"
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -328,20 +323,17 @@
|
|||||||
{
|
{
|
||||||
"id": "17860291-f3a6-4b47-978a-ac1a581aac0f",
|
"id": "17860291-f3a6-4b47-978a-ac1a581aac0f",
|
||||||
"name": "open",
|
"name": "open",
|
||||||
"displayName": "Open",
|
"displayName": "Open"
|
||||||
"type": "bool"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "27860292-f3a6-4b47-978a-ac1a581aac0f",
|
"id": "27860292-f3a6-4b47-978a-ac1a581aac0f",
|
||||||
"name": "stop",
|
"name": "stop",
|
||||||
"displayName": "stop",
|
"displayName": "stop"
|
||||||
"type": "bool"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "37860293-f3a6-4b47-978a-ac1a581aac0f",
|
"id": "37860293-f3a6-4b47-978a-ac1a581aac0f",
|
||||||
"name": "close",
|
"name": "close",
|
||||||
"displayName": "close",
|
"displayName": "close"
|
||||||
"type": "bool"
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|||||||
@ -39,8 +39,8 @@ DevicePluginSnapd::~DevicePluginSnapd()
|
|||||||
void DevicePluginSnapd::init()
|
void DevicePluginSnapd::init()
|
||||||
{
|
{
|
||||||
// Initialize plugin configurations
|
// Initialize plugin configurations
|
||||||
m_advancedMode = configValue(SnapdAdvancedModeParamTypeId).toBool();
|
m_advancedMode = configValue(snapdAdvancedModeParamTypeId).toBool();
|
||||||
m_refreshTime = configValue(SnapdRefreshScheduleParamTypeId).toInt();
|
m_refreshTime = configValue(snapdRefreshScheduleParamTypeId).toInt();
|
||||||
connect(this, &DevicePluginSnapd::configValueChanged, this, &DevicePluginSnapd::onPluginConfigurationChanged);
|
connect(this, &DevicePluginSnapd::configValueChanged, this, &DevicePluginSnapd::onPluginConfigurationChanged);
|
||||||
|
|
||||||
// Refresh timer for snapd checks
|
// Refresh timer for snapd checks
|
||||||
@ -114,7 +114,7 @@ DeviceManager::DeviceSetupStatus DevicePluginSnapd::setupDevice(Device *device)
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_snapdControl = new SnapdControl(device, this);
|
m_snapdControl = new SnapdControl(device, this);
|
||||||
m_snapdControl->setPreferredRefreshTime(configValue(SnapdRefreshScheduleParamTypeId).toInt());
|
m_snapdControl->setPreferredRefreshTime(configValue(snapdRefreshScheduleParamTypeId).toInt());
|
||||||
connect(m_snapdControl, &SnapdControl::snapListUpdated, this, &DevicePluginSnapd::onSnapListUpdated);
|
connect(m_snapdControl, &SnapdControl::snapListUpdated, this, &DevicePluginSnapd::onSnapListUpdated);
|
||||||
|
|
||||||
} else if (device->deviceClassId() == snapDeviceClassId) {
|
} else if (device->deviceClassId() == snapDeviceClassId) {
|
||||||
@ -163,7 +163,7 @@ DeviceManager::DeviceError DevicePluginSnapd::executeAction(Device *device, cons
|
|||||||
|
|
||||||
if (action.actionTypeId() == snapChannelActionTypeId) {
|
if (action.actionTypeId() == snapChannelActionTypeId) {
|
||||||
QString snapName = device->paramValue(snapNameParamTypeId).toString();
|
QString snapName = device->paramValue(snapNameParamTypeId).toString();
|
||||||
m_snapdControl->changeSnapChannel(snapName, action.param(snapChannelStateParamTypeId).value().toString());
|
m_snapdControl->changeSnapChannel(snapName, action.param(snapChannelActionParamTypeId).value().toString());
|
||||||
return DeviceManager::DeviceErrorNoError;
|
return DeviceManager::DeviceErrorNoError;
|
||||||
} else if (action.actionTypeId() == snapRevertActionTypeId) {
|
} else if (action.actionTypeId() == snapRevertActionTypeId) {
|
||||||
QString snapName = device->paramValue(snapNameParamTypeId).toString();
|
QString snapName = device->paramValue(snapNameParamTypeId).toString();
|
||||||
@ -182,7 +182,7 @@ void DevicePluginSnapd::onPluginConfigurationChanged(const ParamTypeId ¶mTyp
|
|||||||
qCDebug(dcSnapd()) << "Plugin configuration changed";
|
qCDebug(dcSnapd()) << "Plugin configuration changed";
|
||||||
|
|
||||||
// Check advanced mode
|
// Check advanced mode
|
||||||
if (paramTypeId == SnapdAdvancedModeParamTypeId) {
|
if (paramTypeId == snapdAdvancedModeParamTypeId) {
|
||||||
qCDebug(dcSnapd()) << "Advanced mode" << (value.toBool() ? "enabled." : "disabled.");
|
qCDebug(dcSnapd()) << "Advanced mode" << (value.toBool() ? "enabled." : "disabled.");
|
||||||
m_advancedMode = value.toBool();
|
m_advancedMode = value.toBool();
|
||||||
|
|
||||||
@ -202,7 +202,7 @@ void DevicePluginSnapd::onPluginConfigurationChanged(const ParamTypeId ¶mTyp
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check refresh schedule
|
// Check refresh schedule
|
||||||
if (paramTypeId == SnapdRefreshScheduleParamTypeId) {
|
if (paramTypeId == snapdRefreshScheduleParamTypeId) {
|
||||||
if (!m_snapdControl)
|
if (!m_snapdControl)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|||||||
@ -81,8 +81,8 @@
|
|||||||
"displayNameEvent": "Last automatic system update time changed",
|
"displayNameEvent": "Last automatic system update time changed",
|
||||||
"unit": "UnixTime",
|
"unit": "UnixTime",
|
||||||
"type": "int",
|
"type": "int",
|
||||||
|
"ruleRelevant": false,
|
||||||
"eventRuleRelevant": false,
|
"eventRuleRelevant": false,
|
||||||
"stateRuleRelevant": false,
|
|
||||||
"defaultValue": 0
|
"defaultValue": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -92,8 +92,8 @@
|
|||||||
"displayNameEvent": "Next automatic system update time changed",
|
"displayNameEvent": "Next automatic system update time changed",
|
||||||
"unit": "UnixTime",
|
"unit": "UnixTime",
|
||||||
"type": "int",
|
"type": "int",
|
||||||
|
"ruleRelevant": false,
|
||||||
"eventRuleRelevant": false,
|
"eventRuleRelevant": false,
|
||||||
"stateRuleRelevant": false,
|
|
||||||
"defaultValue": 0
|
"defaultValue": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -102,8 +102,8 @@
|
|||||||
"displayName": "Status",
|
"displayName": "Status",
|
||||||
"displayNameEvent": "Status changed",
|
"displayNameEvent": "Status changed",
|
||||||
"type": "QString",
|
"type": "QString",
|
||||||
|
"ruleRelevant": false,
|
||||||
"eventRuleRelevant": false,
|
"eventRuleRelevant": false,
|
||||||
"stateRuleRelevant": false,
|
|
||||||
"defaultValue": "-"
|
"defaultValue": "-"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@ -167,8 +167,8 @@
|
|||||||
"displayNameEvent": "Channel changed",
|
"displayNameEvent": "Channel changed",
|
||||||
"displayNameAction": "Set channel",
|
"displayNameAction": "Set channel",
|
||||||
"type": "QString",
|
"type": "QString",
|
||||||
|
"ruleRelevant": false,
|
||||||
"eventRuleRelevant": false,
|
"eventRuleRelevant": false,
|
||||||
"stateRuleRelevant": false,
|
|
||||||
"defaultValue": "stable",
|
"defaultValue": "stable",
|
||||||
"writable": true,
|
"writable": true,
|
||||||
"possibleValues": [
|
"possibleValues": [
|
||||||
@ -184,8 +184,8 @@
|
|||||||
"displayName": "Version",
|
"displayName": "Version",
|
||||||
"displayNameEvent": "Version changed",
|
"displayNameEvent": "Version changed",
|
||||||
"type": "QString",
|
"type": "QString",
|
||||||
|
"ruleRelevant": false,
|
||||||
"eventRuleRelevant": false,
|
"eventRuleRelevant": false,
|
||||||
"stateRuleRelevant": false,
|
|
||||||
"defaultValue": "-"
|
"defaultValue": "-"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -194,8 +194,8 @@
|
|||||||
"displayName": "Revision",
|
"displayName": "Revision",
|
||||||
"displayNameEvent": "Revision changed",
|
"displayNameEvent": "Revision changed",
|
||||||
"type": "QString",
|
"type": "QString",
|
||||||
|
"ruleRelevant": false,
|
||||||
"eventRuleRelevant": false,
|
"eventRuleRelevant": false,
|
||||||
"stateRuleRelevant": false,
|
|
||||||
"defaultValue": "-"
|
"defaultValue": "-"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
@ -26,16 +26,14 @@
|
|||||||
"displayName": "IPv4 Address",
|
"displayName": "IPv4 Address",
|
||||||
"type": "QString",
|
"type": "QString",
|
||||||
"inputType": "IPv4Address",
|
"inputType": "IPv4Address",
|
||||||
"defaultValue": "127.0.0.1",
|
"defaultValue": "127.0.0.1"
|
||||||
"index" : 0
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "bee8b151-815a-4159-9d8a-42b76e99b42c",
|
"id": "bee8b151-815a-4159-9d8a-42b76e99b42c",
|
||||||
"name": "port",
|
"name": "port",
|
||||||
"displayName": "Port",
|
"displayName": "Port",
|
||||||
"type": "int",
|
"type": "int",
|
||||||
"defaultValue": "22",
|
"defaultValue": "22"
|
||||||
"index" : 1
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"stateTypes":[
|
"stateTypes":[
|
||||||
@ -45,8 +43,7 @@
|
|||||||
"displayName": "connected",
|
"displayName": "connected",
|
||||||
"type": "bool",
|
"type": "bool",
|
||||||
"defaultValue": false,
|
"defaultValue": false,
|
||||||
"displayNameEvent": "connection status changed",
|
"displayNameEvent": "connection status changed"
|
||||||
"index" : 0
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"actionTypes": [
|
"actionTypes": [
|
||||||
@ -54,14 +51,12 @@
|
|||||||
"id": "6bc52462-b192-46a4-a6df-92cc5a479c89",
|
"id": "6bc52462-b192-46a4-a6df-92cc5a479c89",
|
||||||
"name": "outputData",
|
"name": "outputData",
|
||||||
"displayName": "Send Data",
|
"displayName": "Send Data",
|
||||||
"index": 0,
|
|
||||||
"paramTypes": [
|
"paramTypes": [
|
||||||
{
|
{
|
||||||
"id": "6604c852-6b24-4707-b8e5-1ddd8032efcc",
|
"id": "6604c852-6b24-4707-b8e5-1ddd8032efcc",
|
||||||
"name": "outputDataArea",
|
"name": "outputDataArea",
|
||||||
"displayName": "Data",
|
"displayName": "Data",
|
||||||
"type": "QString",
|
"type": "QString",
|
||||||
"index": 0,
|
|
||||||
"inputType": "TextArea"
|
"inputType": "TextArea"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@ -84,8 +79,7 @@
|
|||||||
"name": "port",
|
"name": "port",
|
||||||
"displayName": "Port",
|
"displayName": "Port",
|
||||||
"type": "int",
|
"type": "int",
|
||||||
"defaultValue": "22",
|
"defaultValue": "22"
|
||||||
"index" : 0
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "d99f55c7-0e14-45ee-b0f0-33f2d1d2e674",
|
"id": "d99f55c7-0e14-45ee-b0f0-33f2d1d2e674",
|
||||||
@ -99,8 +93,7 @@
|
|||||||
"Starts with",
|
"Starts with",
|
||||||
"Ends with"
|
"Ends with"
|
||||||
],
|
],
|
||||||
"defaultValue": "Exactly",
|
"defaultValue": "Exactly"
|
||||||
"index" : 1
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "23051bdf-3f50-41fa-abde-bc4fe0bcc4fc",
|
"id": "23051bdf-3f50-41fa-abde-bc4fe0bcc4fc",
|
||||||
@ -108,8 +101,7 @@
|
|||||||
"displayName": "Command",
|
"displayName": "Command",
|
||||||
"type": "QString",
|
"type": "QString",
|
||||||
"inputType": "TextArea",
|
"inputType": "TextArea",
|
||||||
"defaultValue": "",
|
"defaultValue": ""
|
||||||
"index" : 2
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"stateTypes": [
|
"stateTypes": [
|
||||||
@ -119,26 +111,22 @@
|
|||||||
"displayName": "connected",
|
"displayName": "connected",
|
||||||
"type": "bool",
|
"type": "bool",
|
||||||
"defaultValue": false,
|
"defaultValue": false,
|
||||||
"displayNameEvent": "connection status changed",
|
"displayNameEvent": "connection status changed"
|
||||||
"index" : 0
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "b98fdacc-59d7-41c4-b790-1fdca50dfb22",
|
"id": "b98fdacc-59d7-41c4-b790-1fdca50dfb22",
|
||||||
"name": "dataReceived",
|
"name": "dataReceived",
|
||||||
"displayName": "Data Received",
|
"displayName": "Data Received",
|
||||||
"type": "QString",
|
"type": "QString",
|
||||||
"inputType": "TextArea",
|
|
||||||
"defaultValue": "",
|
"defaultValue": "",
|
||||||
"displayNameEvent": "Data received",
|
"displayNameEvent": "Data received"
|
||||||
"index" : 1
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"eventTypes": [
|
"eventTypes": [
|
||||||
{
|
{
|
||||||
"id": "6d7c6df6-cb61-4d9e-b0d7-37c43911ca4b",
|
"id": "6d7c6df6-cb61-4d9e-b0d7-37c43911ca4b",
|
||||||
"name": "commandReceived",
|
"name": "commandReceived",
|
||||||
"displayName": "Command Received",
|
"displayName": "Command Received"
|
||||||
"index": 0
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@ -106,7 +106,7 @@ DeviceManager::DeviceError DevicePluginWemo::executeAction(Device *device, const
|
|||||||
// Check if wemo device is reachable
|
// Check if wemo device is reachable
|
||||||
if (device->stateValue(wemoSwitchReachableStateTypeId).toBool()) {
|
if (device->stateValue(wemoSwitchReachableStateTypeId).toBool()) {
|
||||||
// setPower returns false, if the curent powerState is already the new powerState
|
// setPower returns false, if the curent powerState is already the new powerState
|
||||||
if (setPower(device, action.param(wemoSwitchPowerStateParamTypeId).value().toBool(), action.id())) {
|
if (setPower(device, action.param(wemoSwitchPowerActionParamTypeId).value().toBool(), action.id())) {
|
||||||
return DeviceManager::DeviceErrorAsync;
|
return DeviceManager::DeviceErrorAsync;
|
||||||
} else {
|
} else {
|
||||||
return DeviceManager::DeviceErrorNoError;
|
return DeviceManager::DeviceErrorNoError;
|
||||||
|
|||||||
@ -101,7 +101,7 @@ DeviceManager::DeviceError DevicePluginWs2812::discoverDevices(const DeviceClass
|
|||||||
Q_UNUSED(params)
|
Q_UNUSED(params)
|
||||||
|
|
||||||
// Perform a HTTP GET on the RPL router address
|
// Perform a HTTP GET on the RPL router address
|
||||||
QHostAddress address(configuration().paramValue(Ws2812RplParamTypeId).toString());
|
QHostAddress address(configuration().paramValue(ws2812RplParamTypeId).toString());
|
||||||
qCDebug(dcWs2812) << "Scan for new nodes on RPL" << address.toString();
|
qCDebug(dcWs2812) << "Scan for new nodes on RPL" << address.toString();
|
||||||
|
|
||||||
QUrl url;
|
QUrl url;
|
||||||
@ -140,7 +140,7 @@ DeviceManager::DeviceError DevicePluginWs2812::executeAction(Device *device, con
|
|||||||
url.setHost(device->paramValue(ws2812HostParamTypeId).toString());
|
url.setHost(device->paramValue(ws2812HostParamTypeId).toString());
|
||||||
url.setPath("/a/color");
|
url.setPath("/a/color");
|
||||||
|
|
||||||
QColor newColor = action.param(ws2812EffectModeStateParamTypeId).value().value<QColor>().toRgb();
|
QColor newColor = action.param(ws2812EffectModeActionParamTypeId).value().value<QColor>().toRgb();
|
||||||
QByteArray message = "color=" + newColor.name().remove("#").toUtf8();
|
QByteArray message = "color=" + newColor.name().remove("#").toUtf8();
|
||||||
|
|
||||||
qCDebug(dcWs2812) << "Sending" << url.toString() << message;
|
qCDebug(dcWs2812) << "Sending" << url.toString() << message;
|
||||||
@ -164,7 +164,7 @@ DeviceManager::DeviceError DevicePluginWs2812::executeAction(Device *device, con
|
|||||||
url.setHost(device->paramValue(ws2812HostParamTypeId).toString());
|
url.setHost(device->paramValue(ws2812HostParamTypeId).toString());
|
||||||
url.setPath("/a/speed");
|
url.setPath("/a/speed");
|
||||||
|
|
||||||
int speed = action.param(ws2812SpeedStateParamTypeId).value().toInt();
|
int speed = action.param(ws2812SpeedActionParamTypeId).value().toInt();
|
||||||
|
|
||||||
qCDebug(dcWs2812) << "Set Speed:" << speed;
|
qCDebug(dcWs2812) << "Set Speed:" << speed;
|
||||||
|
|
||||||
@ -190,7 +190,7 @@ DeviceManager::DeviceError DevicePluginWs2812::executeAction(Device *device, con
|
|||||||
url.setPath("/a/brightness");
|
url.setPath("/a/brightness");
|
||||||
|
|
||||||
|
|
||||||
int brightness = action.param(ws2812BrightnessStateParamTypeId).value().toInt();
|
int brightness = action.param(ws2812BrightnessActionParamTypeId).value().toInt();
|
||||||
|
|
||||||
qCDebug(dcWs2812) << "Set brightness:" << brightness;
|
qCDebug(dcWs2812) << "Set brightness:" << brightness;
|
||||||
|
|
||||||
@ -220,7 +220,7 @@ DeviceManager::DeviceError DevicePluginWs2812::executeAction(Device *device, con
|
|||||||
//QColor newColor = QColor::fromHsv(color.hue(), color.saturation(), 100 * light->brightness() / 255.0);
|
//QColor newColor = QColor::fromHsv(color.hue(), color.saturation(), 100 * light->brightness() / 255.0);
|
||||||
//QByteArray message = "color=" + newColor.toRgb().name().remove("#").toUtf8();
|
//QByteArray message = "color=" + newColor.toRgb().name().remove("#").toUtf8();
|
||||||
|
|
||||||
int max = action.param(ws2812MaxPixStateParamTypeId).value().toInt();
|
int max = action.param(ws2812MaxPixActionParamTypeId).value().toInt();
|
||||||
|
|
||||||
qCDebug(dcWs2812) << "Max Pix" << max;
|
qCDebug(dcWs2812) << "Max Pix" << max;
|
||||||
|
|
||||||
@ -246,7 +246,7 @@ DeviceManager::DeviceError DevicePluginWs2812::executeAction(Device *device, con
|
|||||||
|
|
||||||
int effectmode = 0;
|
int effectmode = 0;
|
||||||
|
|
||||||
QString effectModeString = action.param(ws2812EffectModeStateParamTypeId).value().toString();
|
QString effectModeString = action.param(ws2812EffectModeActionParamTypeId).value().toString();
|
||||||
|
|
||||||
|
|
||||||
QUrl url;
|
QUrl url;
|
||||||
@ -311,11 +311,11 @@ DeviceManager::DeviceError DevicePluginWs2812::executeAction(Device *device, con
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
if(action.actionTypeId() == ws2812Tcolor1ActionTypeId) {
|
if(action.actionTypeId() == ws2812Tcolor1ActionTypeId) {
|
||||||
tColor1 = action.param(ws2812Tcolor1StateParamTypeId).value().value<QColor>().toRgb();
|
tColor1 = action.param(ws2812Tcolor1ActionParamTypeId).value().value<QColor>().toRgb();
|
||||||
} else if(action.actionTypeId() == ws2812Tcolor2ActionTypeId){
|
} else if(action.actionTypeId() == ws2812Tcolor2ActionTypeId){
|
||||||
tColor2 = action.param(ws2812Tcolor2StateParamTypeId).value().value<QColor>().toRgb();
|
tColor2 = action.param(ws2812Tcolor2ActionParamTypeId).value().value<QColor>().toRgb();
|
||||||
} else if(action.actionTypeId() == ws2812Tcolor3ActionTypeId){
|
} else if(action.actionTypeId() == ws2812Tcolor3ActionTypeId){
|
||||||
tColor3 = action.param(ws2812Tcolor3StateParamTypeId).value().value<QColor>().toRgb();
|
tColor3 = action.param(ws2812Tcolor3ActionParamTypeId).value().value<QColor>().toRgb();
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray message = "color=" + tColor1.name().remove("#").toUtf8() + tColor2.name().remove("#").toUtf8() + tColor3.name().remove("#").toUtf8();
|
QByteArray message = "color=" + tColor1.name().remove("#").toUtf8() + tColor2.name().remove("#").toUtf8() + tColor3.name().remove("#").toUtf8();
|
||||||
@ -704,7 +704,7 @@ void DevicePluginWs2812::coapReplyFinished(CoapReply *reply)
|
|||||||
emit actionExecutionFinished(action.id(), DeviceManager::DeviceErrorHardwareFailure);
|
emit actionExecutionFinished(action.id(), DeviceManager::DeviceErrorHardwareFailure);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
QString tcolor = action.param(ws2812EffectColorStateParamTypeId).value().toByteArray();
|
QString tcolor = action.param(ws2812EffectColorActionParamTypeId).value().toByteArray();
|
||||||
|
|
||||||
// Update the state here, so we don't have to wait for the notification
|
// Update the state here, so we don't have to wait for the notification
|
||||||
device->setStateValue(ws2812Tcolor1StateTypeId, tcolor.left(6));
|
device->setStateValue(ws2812Tcolor1StateTypeId, tcolor.left(6));
|
||||||
@ -736,7 +736,7 @@ void DevicePluginWs2812::coapReplyFinished(CoapReply *reply)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Update the state here, so we don't have to wait for the notification
|
// Update the state here, so we don't have to wait for the notification
|
||||||
device->setStateValue(ws2812EffectColorStateTypeId, action.param(ws2812EffectColorStateParamTypeId).value().toInt());
|
device->setStateValue(ws2812EffectColorStateTypeId, action.param(ws2812EffectColorActionParamTypeId).value().toInt());
|
||||||
// Tell the user about the action execution result
|
// Tell the user about the action execution result
|
||||||
emit actionExecutionFinished(action.id(), DeviceManager::DeviceErrorNoError);
|
emit actionExecutionFinished(action.id(), DeviceManager::DeviceErrorNoError);
|
||||||
|
|
||||||
@ -762,7 +762,7 @@ void DevicePluginWs2812::coapReplyFinished(CoapReply *reply)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Update the state here, so we don't have to wait for the notification
|
// Update the state here, so we don't have to wait for the notification
|
||||||
device->setStateValue(ws2812BrightnessStateTypeId, action.param(ws2812BrightnessStateParamTypeId).value().toInt());
|
device->setStateValue(ws2812BrightnessStateTypeId, action.param(ws2812BrightnessActionParamTypeId).value().toInt());
|
||||||
// Tell the user about the action execution result
|
// Tell the user about the action execution result
|
||||||
emit actionExecutionFinished(action.id(), DeviceManager::DeviceErrorNoError);
|
emit actionExecutionFinished(action.id(), DeviceManager::DeviceErrorNoError);
|
||||||
|
|
||||||
@ -788,7 +788,7 @@ void DevicePluginWs2812::coapReplyFinished(CoapReply *reply)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Update the state here, so we don't have to wait for the notification
|
// Update the state here, so we don't have to wait for the notification
|
||||||
device->setStateValue(ws2812SpeedStateTypeId, action.param(ws2812SpeedStateParamTypeId).value().toInt());
|
device->setStateValue(ws2812SpeedStateTypeId, action.param(ws2812SpeedActionParamTypeId).value().toInt());
|
||||||
// Tell the user about the action execution result
|
// Tell the user about the action execution result
|
||||||
emit actionExecutionFinished(action.id(), DeviceManager::DeviceErrorNoError);
|
emit actionExecutionFinished(action.id(), DeviceManager::DeviceErrorNoError);
|
||||||
|
|
||||||
@ -814,7 +814,7 @@ void DevicePluginWs2812::coapReplyFinished(CoapReply *reply)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Update the state here, so we don't have to wait for the notification
|
// Update the state here, so we don't have to wait for the notification
|
||||||
device->setStateValue(ws2812MaxPixStateTypeId, action.param(ws2812MaxPixStateParamTypeId).value().toInt());
|
device->setStateValue(ws2812MaxPixStateTypeId, action.param(ws2812MaxPixActionParamTypeId).value().toInt());
|
||||||
// Tell the user about the action execution result
|
// Tell the user about the action execution result
|
||||||
emit actionExecutionFinished(action.id(), DeviceManager::DeviceErrorNoError);
|
emit actionExecutionFinished(action.id(), DeviceManager::DeviceErrorNoError);
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user