From bbc585e92e3ceecec67becd57369760a50b17eea Mon Sep 17 00:00:00 2001 From: Michael Zanetti Date: Wed, 13 Apr 2022 00:42:55 +0200 Subject: [PATCH] Fix filters genering wrong data types When enabling a jitter filter on integer states (e.g. a signal strength that repeatedly jumps up and down by 1), old code may cause integer state to be populated with floating point values as the filtering happens after the intial validation for the new value being valid. --- libnymea/integrations/thing.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/libnymea/integrations/thing.cpp b/libnymea/integrations/thing.cpp index 36450d9b..4ecabe9f 100644 --- a/libnymea/integrations/thing.cpp +++ b/libnymea/integrations/thing.cpp @@ -401,6 +401,7 @@ void Thing::setStateValue(const StateTypeId &stateTypeId, const QVariant &value) if (filter) { filter->addValue(newValue); newValue = filter->filteredValue(); + newValue.convert(stateType.type()); } QVariant oldValue = m_states.at(i).value();