Fix broken hue plugin

pull/135/head
Simon Stürz 2016-09-29 11:26:34 +02:00 committed by Michael Zanetti
parent c9da9ff369
commit 661e0a5116
2 changed files with 14 additions and 8 deletions

View File

@ -310,7 +310,7 @@ void UpnpDiscovery::replyFinished(QNetworkReply *reply)
break;
}
default:
qCWarning(dcHardware) << "HTTP request error " << status;
qCWarning(dcHardware) << "HTTP request error" << reply->request().url().toString() << status;
m_informationRequestList.remove(reply);
}

View File

@ -70,7 +70,7 @@ DevicePluginPhilipsHue::DevicePluginPhilipsHue()
{
m_timer = new QTimer(this);
m_timer->setSingleShot(false);
m_timer->setInterval(1500);
m_timer->setInterval(2000);
connect(m_timer, SIGNAL(timeout()), this, SLOT(onTimeout()));
}
@ -163,6 +163,8 @@ DeviceManager::DeviceSetupStatus DevicePluginPhilipsHue::setupDevice(Device *dev
connect(hueLight, &HueLight::stateChanged, this, &DevicePluginPhilipsHue::lightStateChanged);
m_lights.insert(hueLight, device);
device->setName(hueLight->name());
refreshLight(device);
setLightName(device, device->paramValue(nameParamTypeId).toString());
@ -186,6 +188,8 @@ DeviceManager::DeviceSetupStatus DevicePluginPhilipsHue::setupDevice(Device *dev
connect(hueLight, &HueLight::stateChanged, this, &DevicePluginPhilipsHue::lightStateChanged);
device->setName(hueLight->name());
m_lights.insert(hueLight, device);
refreshLight(device);
@ -208,6 +212,8 @@ DeviceManager::DeviceSetupStatus DevicePluginPhilipsHue::setupDevice(Device *dev
hueRemote->setBridgeId(DeviceId(device->paramValue(bridgeParamTypeId).toString()));
device->setParentId(hueRemote->bridgeId());
device->setName(hueRemote->name());
connect(hueRemote, &HueRemote::stateChanged, this, &DevicePluginPhilipsHue::remoteStateChanged);
connect(hueRemote, &HueRemote::buttonPressed, this, &DevicePluginPhilipsHue::onRemoteButtonEvent);
@ -784,9 +790,9 @@ void DevicePluginPhilipsHue::processBridgeLightDiscoveryResponse(Device *device,
DeviceDescriptor descriptor(hueWhiteLightDeviceClassId, "Philips Hue White Light", lightMap.value("name").toString());
ParamList params;
params.append(Param(nameParamTypeId, lightMap.value("name").toString()));
params.append(Param(apiKeyParamTypeId, device->paramValue(apiKeyParamTypeId).toString()));
params.append(Param(apiKeyParamTypeId, device->paramValue(bridgeApiParamTypeId).toString()));
params.append(Param(bridgeParamTypeId, device->id().toString()));
params.append(Param(hostParamTypeId, device->paramValue(hostParamTypeId).toString()));
params.append(Param(hostParamTypeId, device->paramValue(bridgeHostParamTypeId).toString()));
params.append(Param(modelIdParamTypeId, model));
params.append(Param(typeParamTypeId, lightMap.value("type").toString()));
params.append(Param(uuidParamTypeId, uuid));
@ -800,9 +806,9 @@ void DevicePluginPhilipsHue::processBridgeLightDiscoveryResponse(Device *device,
DeviceDescriptor descriptor(hueLightDeviceClassId, "Philips Hue Light", lightMap.value("name").toString());
ParamList params;
params.append(Param(nameParamTypeId, lightMap.value("name").toString()));
params.append(Param(apiKeyParamTypeId, device->paramValue(apiKeyParamTypeId).toString()));
params.append(Param(apiKeyParamTypeId, device->paramValue(bridgeApiParamTypeId).toString()));
params.append(Param(bridgeParamTypeId, device->id().toString()));
params.append(Param(hostParamTypeId, device->paramValue(hostParamTypeId).toString()));
params.append(Param(hostParamTypeId, device->paramValue(bridgeHostParamTypeId).toString()));
params.append(Param(modelIdParamTypeId, model));
params.append(Param(typeParamTypeId, lightMap.value("type").toString()));
params.append(Param(uuidParamTypeId, uuid));
@ -858,9 +864,9 @@ void DevicePluginPhilipsHue::processBridgeSensorDiscoveryResponse(Device *device
DeviceDescriptor descriptor(hueRemoteDeviceClassId, "Philips Hue Remote", sensorMap.value("name").toString());
ParamList params;
params.append(Param(nameParamTypeId, sensorMap.value("name").toString()));
params.append(Param(apiKeyParamTypeId, device->paramValue(apiKeyParamTypeId).toString()));
params.append(Param(apiKeyParamTypeId, device->paramValue(bridgeApiParamTypeId).toString()));
params.append(Param(bridgeParamTypeId, device->id().toString()));
params.append(Param(hostParamTypeId, device->paramValue(hostParamTypeId).toString()));
params.append(Param(hostParamTypeId, device->paramValue(bridgeHostParamTypeId).toString()));
params.append(Param(modelIdParamTypeId, model));
params.append(Param(typeParamTypeId, sensorMap.value("type").toString()));
params.append(Param(uuidParamTypeId, uuid));