diff --git a/src/knx/group_object.cpp b/src/knx/group_object.cpp index 21dce733..e1e069b5 100644 --- a/src/knx/group_object.cpp +++ b/src/knx/group_object.cpp @@ -282,10 +282,11 @@ void GroupObject::valueNoSend(const KNXValue& value) void GroupObject::valueNoSend(const KNXValue& value, const Dpt& type) { - if (_commFlagEx.uninitialized) - commFlag(Ok); + const bool encodingDone = KNX_Encode_Value(value, _data, _dataLength, type); - KNX_Encode_Value(value, _data, _dataLength, type); + // initialize on succesful conversion only + if (encodingDone && _commFlagEx.uninitialized) + commFlag(Ok); } bool GroupObject::valueNoSendCompare(const KNXValue& value, const Dpt& type)