From d1e4aaaaa28586dfe9ee0b7a09e80ae1c5a4b9de Mon Sep 17 00:00:00 2001 From: Michael Zanetti Date: Wed, 16 Jun 2021 00:52:16 +0200 Subject: [PATCH] Allow [u]ints to be used with analog IO connections --- libnymea/integrations/pluginmetadata.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libnymea/integrations/pluginmetadata.cpp b/libnymea/integrations/pluginmetadata.cpp index 0f1ea3cb..a4c55893 100644 --- a/libnymea/integrations/pluginmetadata.cpp +++ b/libnymea/integrations/pluginmetadata.cpp @@ -440,8 +440,8 @@ void PluginMetadata::parse(const QJsonObject &jsonObject) } ioType = Types::IOTypeDigitalOutput; } else if (ioTypeString == "analogInput") { - if (stateType.type() != QVariant::Double) { - m_validationErrors.append("Thing class \"" + thingClass.name() + "\" state type \"" + stateTypeName + "\" is marked as analog input but type is not \"double\""); + if (stateType.type() != QVariant::Double && stateType.type() != QVariant::Int && stateType.type() != QVariant::UInt) { + m_validationErrors.append("Thing class \"" + thingClass.name() + "\" state type \"" + stateTypeName + "\" is marked as analog input but type is not \"double\", \"int\" or \"uint\""); hasError = true; break; } @@ -452,8 +452,8 @@ void PluginMetadata::parse(const QJsonObject &jsonObject) } ioType = Types::IOTypeAnalogInput; } else if (ioTypeString == "analogOutput") { - if (stateType.type() != QVariant::Double) { - m_validationErrors.append("Thing class \"" + thingClass.name() + "\" state type \"" + stateTypeName + "\" is marked as analog output but type is not \"double\""); + if (stateType.type() != QVariant::Double && stateType.type() != QVariant::Int && stateType.type() != QVariant::UInt) { + m_validationErrors.append("Thing class \"" + thingClass.name() + "\" state type \"" + stateTypeName + "\" is marked as analog output but type is not \"double\", \"int\" or \"uint\""); hasError = true; break; }