Fix hue motion sensor timeout settings
parent
ac6dcf0765
commit
3c3f1b26cf
|
|
@ -49,7 +49,7 @@ HueMotionSensor::HueMotionSensor(QObject *parent) :
|
||||||
void HueMotionSensor::setTimeout(int timeout)
|
void HueMotionSensor::setTimeout(int timeout)
|
||||||
{
|
{
|
||||||
// The sensor keeps emitting presence = true for 10 secs, let's subtract that time from the timeout to compensate
|
// The sensor keeps emitting presence = true for 10 secs, let's subtract that time from the timeout to compensate
|
||||||
m_timeout.setInterval((timeout - 9)* 1000);
|
m_timeout.setInterval(qMax(timeout - 9, 1)* 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
int HueMotionSensor::temperatureSensorId() const
|
int HueMotionSensor::temperatureSensorId() const
|
||||||
|
|
|
||||||
|
|
@ -421,7 +421,7 @@ void IntegrationPluginPhilipsHue::setupThing(ThingSetupInfo *info)
|
||||||
qCDebug(dcPhilipsHue) << "Setup Hue motion sensor" << thing->params();
|
qCDebug(dcPhilipsHue) << "Setup Hue motion sensor" << thing->params();
|
||||||
|
|
||||||
HueIndoorSensor *motionSensor = new HueIndoorSensor(this);
|
HueIndoorSensor *motionSensor = new HueIndoorSensor(this);
|
||||||
motionSensor->setTimeout(thing->setting(motionSensorSettingsTimeoutParamTypeId).toUInt() * 1000);
|
motionSensor->setTimeout(thing->setting(motionSensorSettingsTimeoutParamTypeId).toUInt());
|
||||||
motionSensor->setUuid(thing->paramValue(motionSensorThingUuidParamTypeId).toString());
|
motionSensor->setUuid(thing->paramValue(motionSensorThingUuidParamTypeId).toString());
|
||||||
motionSensor->setModelId(thing->paramValue(motionSensorThingModelIdParamTypeId).toString());
|
motionSensor->setModelId(thing->paramValue(motionSensorThingModelIdParamTypeId).toString());
|
||||||
motionSensor->setTemperatureSensorId(thing->paramValue(motionSensorThingSensorIdTemperatureParamTypeId).toInt());
|
motionSensor->setTemperatureSensorId(thing->paramValue(motionSensorThingSensorIdTemperatureParamTypeId).toInt());
|
||||||
|
|
@ -439,7 +439,7 @@ void IntegrationPluginPhilipsHue::setupThing(ThingSetupInfo *info)
|
||||||
|
|
||||||
connect(thing, &Thing::settingChanged, motionSensor, [motionSensor](const ParamTypeId ¶mTypeId, const QVariant &value){
|
connect(thing, &Thing::settingChanged, motionSensor, [motionSensor](const ParamTypeId ¶mTypeId, const QVariant &value){
|
||||||
if (paramTypeId == motionSensorSettingsTimeoutParamTypeId) {
|
if (paramTypeId == motionSensorSettingsTimeoutParamTypeId) {
|
||||||
motionSensor->setTimeout(value.toUInt() * 1000);
|
motionSensor->setTimeout(value.toUInt());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -453,7 +453,7 @@ void IntegrationPluginPhilipsHue::setupThing(ThingSetupInfo *info)
|
||||||
qCDebug(dcPhilipsHue) << "Setup Hue Outdoor sensor" << thing->params();
|
qCDebug(dcPhilipsHue) << "Setup Hue Outdoor sensor" << thing->params();
|
||||||
|
|
||||||
HueMotionSensor *outdoorSensor = new HueOutdoorSensor(this);
|
HueMotionSensor *outdoorSensor = new HueOutdoorSensor(this);
|
||||||
outdoorSensor->setTimeout(thing->setting(outdoorSensorSettingsTimeoutParamTypeId).toUInt() * 1000);
|
outdoorSensor->setTimeout(thing->setting(outdoorSensorSettingsTimeoutParamTypeId).toUInt());
|
||||||
outdoorSensor->setUuid(thing->paramValue(outdoorSensorThingUuidParamTypeId).toString());
|
outdoorSensor->setUuid(thing->paramValue(outdoorSensorThingUuidParamTypeId).toString());
|
||||||
outdoorSensor->setModelId(thing->paramValue(outdoorSensorThingModelIdParamTypeId).toString());
|
outdoorSensor->setModelId(thing->paramValue(outdoorSensorThingModelIdParamTypeId).toString());
|
||||||
outdoorSensor->setTemperatureSensorId(thing->paramValue(outdoorSensorThingSensorIdTemperatureParamTypeId).toInt());
|
outdoorSensor->setTemperatureSensorId(thing->paramValue(outdoorSensorThingSensorIdTemperatureParamTypeId).toInt());
|
||||||
|
|
@ -471,7 +471,7 @@ void IntegrationPluginPhilipsHue::setupThing(ThingSetupInfo *info)
|
||||||
|
|
||||||
connect(thing, &Thing::settingChanged, outdoorSensor, [outdoorSensor](const ParamTypeId ¶mTypeId, const QVariant &value){
|
connect(thing, &Thing::settingChanged, outdoorSensor, [outdoorSensor](const ParamTypeId ¶mTypeId, const QVariant &value){
|
||||||
if (paramTypeId == outdoorSensorSettingsTimeoutParamTypeId) {
|
if (paramTypeId == outdoorSensorSettingsTimeoutParamTypeId) {
|
||||||
outdoorSensor->setTimeout(value.toUInt() * 1000);
|
outdoorSensor->setTimeout(value.toUInt());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -714,7 +714,8 @@
|
||||||
"displayName": "Person is present",
|
"displayName": "Person is present",
|
||||||
"displayNameEvent": "Person is present changed",
|
"displayNameEvent": "Person is present changed",
|
||||||
"type": "bool",
|
"type": "bool",
|
||||||
"defaultValue": false
|
"defaultValue": false,
|
||||||
|
"cached": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "6fa16fb2-053c-4c3c-a39b-9548c1b15089",
|
"id": "6fa16fb2-053c-4c3c-a39b-9548c1b15089",
|
||||||
|
|
@ -856,7 +857,8 @@
|
||||||
"displayName": "Person is present",
|
"displayName": "Person is present",
|
||||||
"displayNameEvent": "Person is present changed",
|
"displayNameEvent": "Person is present changed",
|
||||||
"type": "bool",
|
"type": "bool",
|
||||||
"defaultValue": false
|
"defaultValue": false,
|
||||||
|
"cached": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "ef2e564e-2443-448f-bcd9-f85a1126ee6a",
|
"id": "ef2e564e-2443-448f-bcd9-f85a1126ee6a",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue