-
Notifications
You must be signed in to change notification settings - Fork 4
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
problem getting device id in callback #34
Comments
Hi, You say "this will not work" - does it not work? I think it should work - in JavaScript It probably doesn't help, because it is a bit complex but this is the code I wrote that uses the owfs.js library: https://github.com/njh/node-red-contrib-owfs/blob/master/owfs.js nick. |
I havn't tested it but something like this should work: function lookupTemp(hostname, path) {
var Client = require('owfs').Client
var client = new Client(hostname, 4304)
client.read(path, function (err, result) {
if (err) {
console.log(err)
} else {
console.log("path: " + path)
console.log("result: " + result)
}
})
} |
No it does not work!. It works for one device, but when issuing read for several devices, the path in the callback will be the last used path - for all events. The path must be delivered as an argument in the callback to identify the path. |
Would it help you if I created a working example?
|
See this example:
The result is (correct!);
Then changing the code like this:
The result is (I expected a duplication of the old result):
|
When I want to issue a serie of reads to several devices, the callback gives no way of telling which device is delivering result.
What to do?
The text was updated successfully, but these errors were encountered: