0

node-opcua を使用してブール値を書き込み、リセット タグを設定しています。これが私のコードです:

    var nodesToWrite = new Array();
    nodesToWrite.push({
        nodeId: 'ns=2;s=Paint.PLC.Reset_Auto_Blocked_Time',
        attributeId: opcua.AttributeIds.Value,
        indexRange: null,
        value: {
            value: {
                dataType: opcua.DataType.Boolean,
                value: true
            }
        }
    });
    self.uaSession.write(nodesToWrite, function (err, statusCode, diagnosticInfo) {
        if (!err) {
            console.log(" write ok");
            console.log(statusCode);
            console.log(diagnosticInfo);
        } else {
            console.log(" write err = ", err);
        }
   })

コンソールがこれをログに記録するため、実際には「err」を呼び出しません。

[{ [Number: 2155085824
   value: 2155085824,
   description: 'The value supplied for the attribute is not of the same type as the attribute\'s value.',
name: 'BadTypeMidmatch' }]
[]

ただし、これは明らかにエラーであり、書き込みは決して完了しません。タグは KEPServer でブール値として設定され、正常に機能します。なぜミスマッチと言われているのかわからない。何か助けはありますか?

4

3 に答える 3