Merge PR #317: Hue: Don't falsely emit button presses at startup

master
Jenkins nymea 2020-09-14 12:40:48 +02:00
commit 072fb81472
1 changed files with 6 additions and 6 deletions

View File

@ -60,14 +60,14 @@ void HueRemote::updateStates(const QVariantMap &statesMap, const QVariantMap &co
emit stateChanged();
QString lastUpdate = statesMap.value("lastupdated").toString();
// If we never polled, just store the lastUpdate time and not emit a falsely button pressed event
if (m_lastUpdate.isEmpty()) {
m_lastUpdate = lastUpdate;
}
int buttonCode = statesMap.value("buttonevent").toInt();
// If we never polled, just store lastUpdate/buttonCode and not emit a falsely button pressed event
if (m_lastUpdate.isEmpty() || m_lastButtonCode == -1) {
m_lastUpdate = lastUpdate;
m_lastButtonCode = buttonCode;
}
if (m_lastUpdate != lastUpdate || m_lastButtonCode != buttonCode) {
m_lastUpdate = lastUpdate;
m_lastButtonCode = buttonCode;