Fix occationally lost button events
This commit is contained in:
parent
686a595d8f
commit
f4b0badfd8
@ -66,10 +66,12 @@ void HueRemote::updateStates(const QVariantMap &statesMap, const QVariantMap &co
|
|||||||
m_lastUpdate = lastUpdate;
|
m_lastUpdate = lastUpdate;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_lastUpdate != lastUpdate) {
|
int buttonCode = statesMap.value("buttonevent").toInt();
|
||||||
m_lastUpdate = lastUpdate;
|
|
||||||
|
if (m_lastUpdate != lastUpdate || m_lastButtonCode != buttonCode) {
|
||||||
|
m_lastUpdate = lastUpdate;
|
||||||
|
m_lastButtonCode = buttonCode;
|
||||||
|
|
||||||
int buttonCode = statesMap.value("buttonevent").toInt();
|
|
||||||
qCDebug(dcPhilipsHue) << "button pressed" << buttonCode;
|
qCDebug(dcPhilipsHue) << "button pressed" << buttonCode;
|
||||||
|
|
||||||
emit buttonPressed(buttonCode);
|
emit buttonPressed(buttonCode);
|
||||||
|
|||||||
@ -54,6 +54,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
int m_battery;
|
int m_battery;
|
||||||
QString m_lastUpdate;
|
QString m_lastUpdate;
|
||||||
|
int m_lastButtonCode = -1;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void stateChanged();
|
void stateChanged();
|
||||||
|
|||||||
@ -1371,9 +1371,9 @@ void IntegrationPluginPhilipsHue::processBridgeSensorDiscoveryResponse(Thing *th
|
|||||||
QString uuid = sensorMap.value("uniqueid").toString();
|
QString uuid = sensorMap.value("uniqueid").toString();
|
||||||
QString model = sensorMap.value("modelid").toString();
|
QString model = sensorMap.value("modelid").toString();
|
||||||
|
|
||||||
qCDebug(dcPhilipsHue()) << "Found sensor on bridge:" << model << uuid;
|
// qCDebug(dcPhilipsHue()) << "Found sensor on bridge:" << model << uuid;
|
||||||
foreach (HueRemote* remote, remotesToRemove) {
|
foreach (HueRemote* remote, remotesToRemove) {
|
||||||
qCDebug(dcPhilipsHue()) << " - Checking remote to remove" << remote->modelId() << remote->uuid();
|
// qCDebug(dcPhilipsHue()) << " - Checking remote to remove" << remote->modelId() << remote->uuid();
|
||||||
if (remote->uuid() == uuid) {
|
if (remote->uuid() == uuid) {
|
||||||
remotesToRemove.removeAll(remote);
|
remotesToRemove.removeAll(remote);
|
||||||
break;
|
break;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user