-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Receiving input node #4
Comments
Hi insolite, |
Of course the callback is better rather than polling interval, but seems like that's how rcswitch receiving intended to work. However in most cases there are no data and the only function called repeatedly is module.exports = function (RED) {
function RCSwitchNodeReceive(config) {
RED.nodes.createNode(this, config);
var node = this;
var pin = parseInt(config.pin);
var interval = parseInt(config.interval);
var rcswitch = require('rcswitch');
rcswitch.enableReceive(pin);
node.interval = setInterval(function () {
if (rcswitch.available()) {
var code = rcswitch.getReceivedValue();
node.send({payload: code});
rcswitch.resetAvailable();
}
}, interval);
this.on('close', function() {
clearInterval(node.interval);
rcswitch.disableReceive();
});
}
RED.nodes.registerType("rcswitch-receive", RCSwitchNodeReceive);
}; |
FYI, since I didn't get any response for such node-rcswitch feature request I've forked and implemented it on my own here (node-rcswitch2) and did another fork from original |
Hi! Are there any plans for adding of code receiving input node? I've made a request for integrating of receiving features of
rcswitch
tonode-rcswitch
bindings recently. If/when it will be released would you mind to add corresponding node? I'd be glad to help with PR, but I'm mostly operating raw codes, so I'm kinda beyond that devices/groups logic. I only have some working prototype based on this simplest fork:The text was updated successfully, but these errors were encountered: