Skip to content

Commit

Permalink
write null to an attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
sammachin committed Jan 16, 2025
1 parent 0c95182 commit 2ccc3a7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion write_attribute.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
},
oneditprepare: function() {
$('#node-input-data').typedInput({
types: ['str', 'num', 'msg', 'flow', 'global', 'jsonata', 'env'],
types: ['str', 'num', 'msg', 'flow', 'global', 'jsonata', 'env', {value: 'null', label: 'null', hasValue: false}],
typeField: $('#node-input-dataType')
});

Expand Down
7 changes: 6 additions & 1 deletion write_attribute.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@ module.exports = function(RED) {
node.cluster = Number(config.cluster)
node.attr = cap(config.attr)
this.on('input', function(msg) {
_data = RED.util.evaluateNodeProperty(config.data, config.dataType, node, msg);
if (config.dataType == 'null'){
_data = null
} else {
_data = RED.util.evaluateNodeProperty(config.data, config.dataType, node, msg);
}

node.controller.commissioningController.connectNode(node._id).then((conn) => {
const ep = conn.getDeviceById(Number(node._ep))
const clc = ep.getClusterClientById(Number(node.cluster))
Expand Down

0 comments on commit 2ccc3a7

Please sign in to comment.