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

Commit

Permalink
fix getEndPointFromDevice
Browse files Browse the repository at this point in the history
  • Loading branch information
hobbyquaker committed Nov 13, 2021
1 parent 7303d1b commit c1118eb
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions nodes/converter.js
Expand Up @@ -329,17 +329,19 @@ module.exports = function (RED) {
}

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

const endpoints = model.endpoint(device);
const endpoint = endpoints[isSet ? 'set' : 'get'];
if ((endpoint === null || typeof endpoint === 'undefined') && eps.default !== 'undefined') {
return eps.default;
if ((endpoint === null || typeof endpoint === 'undefined') && endpoints.default !== 'undefined') {
return endpoints.default;
}

return device.endpoints[0];
return endpoint || device.endpoints[0];
}

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

0 comments on commit c1118eb

Please sign in to comment.