Skip to content
This repository was archived by the owner on Dec 28, 2022. It is now read-only.

Commit c1118eb

Browse files
committed
fix getEndPointFromDevice
1 parent 7303d1b commit c1118eb

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

nodes/converter.js

+5-3
Original file line numberDiff line numberDiff line change
@@ -329,17 +329,19 @@ module.exports = function (RED) {
329329
}
330330

331331
getEndPointFromDevice(model, device, isSet) {
332+
// TBC: does this work like it should? :)
333+
console.log('getEndPointFromDevice', model, device, isSet);
332334
if (typeof model.endpoint === 'undefined') {
333335
return device.endpoints[0];
334336
}
335337

336338
const endpoints = model.endpoint(device);
337339
const endpoint = endpoints[isSet ? 'set' : 'get'];
338-
if ((endpoint === null || typeof endpoint === 'undefined') && eps.default !== 'undefined') {
339-
return eps.default;
340+
if ((endpoint === null || typeof endpoint === 'undefined') && endpoints.default !== 'undefined') {
341+
return endpoints.default;
340342
}
341343

342-
return device.endpoints[0];
344+
return endpoint || device.endpoints[0];
343345
}
344346

345347
getFromDevice(converter, device, payload, endpoint, key, meta, done) {

0 commit comments

Comments
 (0)