fixed hue brightness (0-100 and not 0-255)
This commit is contained in:
parent
5de104ec3d
commit
4e09d25296
@ -106,7 +106,7 @@ DeviceManager::DeviceError DevicePluginPhilipsHue::discoverDevices(const DeviceC
|
|||||||
|
|
||||||
DeviceManager::DeviceSetupStatus DevicePluginPhilipsHue::setupDevice(Device *device)
|
DeviceManager::DeviceSetupStatus DevicePluginPhilipsHue::setupDevice(Device *device)
|
||||||
{
|
{
|
||||||
//qDebug() << "setupDevice" << device->params();
|
qDebug() << "setupDevice" << device->params();
|
||||||
|
|
||||||
Light *light = nullptr;
|
Light *light = nullptr;
|
||||||
|
|
||||||
@ -165,21 +165,21 @@ void DevicePluginPhilipsHue::deviceRemoved(Device *device)
|
|||||||
|
|
||||||
void DevicePluginPhilipsHue::upnpDiscoveryFinished(const QList<UpnpDeviceDescriptor> &upnpDeviceDescriptorList)
|
void DevicePluginPhilipsHue::upnpDiscoveryFinished(const QList<UpnpDeviceDescriptor> &upnpDeviceDescriptorList)
|
||||||
{
|
{
|
||||||
qDebug() << "discovered bridges" << upnpDeviceDescriptorList.count();
|
|
||||||
|
|
||||||
foreach (const UpnpDeviceDescriptor &descriptor, upnpDeviceDescriptorList) {
|
foreach (const UpnpDeviceDescriptor &descriptor, upnpDeviceDescriptorList) {
|
||||||
qDebug() << descriptor;
|
qDebug() << descriptor;
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<DeviceDescriptor> deviceDescriptors;
|
QList<DeviceDescriptor> deviceDescriptors;
|
||||||
foreach (const UpnpDeviceDescriptor &upnpDevice, upnpDeviceDescriptorList) {
|
foreach (const UpnpDeviceDescriptor &upnpDevice, upnpDeviceDescriptorList) {
|
||||||
DeviceDescriptor descriptor(hueDeviceClassId, "Philips Hue bridge", upnpDevice.hostAddress().toString());
|
if (upnpDevice.modelDescription().contains("Philips")) {
|
||||||
ParamList params;
|
DeviceDescriptor descriptor(hueDeviceClassId, "Philips hue bridge", upnpDevice.hostAddress().toString());
|
||||||
params.append(Param("ip", upnpDevice.hostAddress().toString()));
|
ParamList params;
|
||||||
params.append(Param("username", "guh-" + QUuid::createUuid().toString().remove(QRegExp("[\\{\\}]*")).remove(QRegExp("\\-[0-9a-f\\-]*"))));
|
params.append(Param("ip", upnpDevice.hostAddress().toString()));
|
||||||
params.append(Param("number", -1));
|
params.append(Param("username", "guh-" + QUuid::createUuid().toString().remove(QRegExp("[\\{\\}]*")).remove(QRegExp("\\-[0-9a-f\\-]*"))));
|
||||||
descriptor.setParams(params);
|
params.append(Param("number", -1));
|
||||||
deviceDescriptors.append(descriptor);
|
descriptor.setParams(params);
|
||||||
|
deviceDescriptors.append(descriptor);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
emit devicesDiscovered(hueDeviceClassId, deviceDescriptors);
|
emit devicesDiscovered(hueDeviceClassId, deviceDescriptors);
|
||||||
@ -260,7 +260,6 @@ void DevicePluginPhilipsHue::createUserFinished(int id, const QVariant &response
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Paired successfully, check how many lightbulbs there are
|
// Paired successfully, check how many lightbulbs there are
|
||||||
|
|
||||||
int getLightsId = m_bridge->get(QHostAddress(pairingInfo.ipParam.value().toString()), pairingInfo.usernameParam.value().toString(), "lights", this, "getLightsFinished");
|
int getLightsId = m_bridge->get(QHostAddress(pairingInfo.ipParam.value().toString()), pairingInfo.usernameParam.value().toString(), "lights", this, "getLightsFinished");
|
||||||
m_pairings.insert(getLightsId, pairingInfo);
|
m_pairings.insert(getLightsId, pairingInfo);
|
||||||
|
|
||||||
|
|||||||
@ -76,7 +76,7 @@ int HueBridgeConnection::put(const QHostAddress &address, const QString &usernam
|
|||||||
|
|
||||||
QJsonDocument jsonDoc = QJsonDocument::fromVariant(data);
|
QJsonDocument jsonDoc = QJsonDocument::fromVariant(data);
|
||||||
QByteArray jsonData = jsonDoc.toJson();
|
QByteArray jsonData = jsonDoc.toJson();
|
||||||
qDebug() << "putting" << url << jsonData;
|
//qDebug() << "putting" << url << jsonData;
|
||||||
|
|
||||||
QNetworkReply *reply = m_nam->put(request, jsonData);
|
QNetworkReply *reply = m_nam->put(request, jsonData);
|
||||||
connect(reply, &QNetworkReply::finished, this, &HueBridgeConnection::slotGetFinished);
|
connect(reply, &QNetworkReply::finished, this, &HueBridgeConnection::slotGetFinished);
|
||||||
|
|||||||
@ -313,7 +313,7 @@ void Light::responseReceived(int id, const QVariant &response)
|
|||||||
m_reachable = stateMap.value("reachable").toBool();
|
m_reachable = stateMap.value("reachable").toBool();
|
||||||
emit stateChanged();
|
emit stateChanged();
|
||||||
|
|
||||||
qDebug() << "got light response" << m_modelId << m_type << m_swversion << m_on << m_bri << m_reachable;
|
//qDebug() << "got light response" << m_modelId << m_type << m_swversion << m_on << m_bri << m_reachable;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Light::setDescriptionFinished(int id, const QVariant &response)
|
void Light::setDescriptionFinished(int id, const QVariant &response)
|
||||||
|
|||||||
Reference in New Issue
Block a user