Hue: Fix motionsensor flickering with low intervals

master
Michael Zanetti 2020-10-29 23:01:16 +01:00
parent df59d45e83
commit 179a3ea3ac
1 changed files with 6 additions and 2 deletions

View File

@ -48,8 +48,12 @@ HueMotionSensor::HueMotionSensor(QObject *parent) :
void HueMotionSensor::setTimeout(int timeout)
{
// The sensor keeps emitting presence = true for 10 secs, let's subtract that time from the timeout to compensate
m_timeout.setInterval(qMax(timeout - 9, 1)* 1000);
// Once the sensor detects a motion it will keep emitting presence = true once a second for 10 secs.
// Let's subtract 9 seconds from the timeout to compensate for that but keep it greater than 2 secs
// to be sure to wait long enough even if the notification from the sensor takes little longer than
// 1 second due to network latency.
qCDebug(dcPhilipsHue()) << "Motion sensor timeout changed to:" << timeout;
m_timeout.setInterval(qMax(timeout - 9, 2)* 1000);
}
int HueMotionSensor::temperatureSensorId() const