node-red-contrib-deconz
Advanced tools
Comparing version 2.0.2 to 2.0.3
@@ -10,2 +10,14 @@ # Changelog | ||
## [2.0.3] - 2021-10-11 ![Relative date](https://img.shields.io/date/1633985783?label=) | ||
### Added | ||
- Magic 'All' group is not displayed in the groups list with the id 0. | ||
- Display an error message if a device is not found on output nodes and continue processing. | ||
### Fixed | ||
- The msg that go through HomeKit and back to an output node are now discarded with a warning message. | ||
- Attribute requests was not updating if there was no config. | ||
## [2.0.2] - 2021-10-10 ![Relative date](https://img.shields.io/date/1633881662?label=) | ||
@@ -12,0 +24,0 @@ |
@@ -203,3 +203,8 @@ const NODE_PATH = '/node-red-contrib-deconz/'; | ||
for (let path of config.device_list) { | ||
devices.push({data: controller.device_list.getDeviceByPath(path)}); | ||
let device = controller.device_list.getDeviceByPath(path); | ||
if (device) { | ||
devices.push({data: device}); | ||
} else { | ||
console.warn(`Error : Device not found : '${path}'`); | ||
} | ||
} | ||
@@ -206,0 +211,0 @@ let requests = cp.getRequests(fakeNode, devices); |
@@ -128,3 +128,8 @@ const CommandParser = require("../src/runtime/CommandParser"); | ||
for (let path of node.config.device_list) { | ||
devices.push({data: node.server.device_list.getDeviceByPath(path)}); | ||
let device = node.server.device_list.getDeviceByPath(path); | ||
if (device) { | ||
devices.push({data: device}); | ||
} else { | ||
done(`Error : Device not found : '${path}'`); | ||
} | ||
} | ||
@@ -131,0 +136,0 @@ break; |
@@ -184,4 +184,10 @@ const got = require('got'); | ||
try { | ||
const response = await got(node.api.url.main(), {retry: 1, timeout: 2000}).json(); | ||
node.device_list.parse(response); | ||
let responses = await Promise.all([ | ||
got(node.api.url.main(), {retry: 1, timeout: 2000}).json(), | ||
got(node.api.url.main() + node.api.url.groups.main(0), {retry: 1, timeout: 2000}).json() | ||
]); | ||
node.device_list.all_group_real_id = responses[1].id; | ||
responses[1].id = '0'; | ||
responses[0].groups['0'] = responses[1]; | ||
node.device_list.parse(responses[0]); | ||
//node.log(`discoverDevices: Updated ${node.device_list.count}`); | ||
@@ -561,2 +567,5 @@ node.state.pooling.discoverProcessRunning = false; | ||
// There is an issue with the id of all lights magic group. The valid ID is 0. | ||
if (dataParsed.r === 'groups' && dataParsed.id === node.device_list.all_group_real_id) dataParsed.id = '0'; | ||
node.emit('onSocketMessage', dataParsed); //Used by event node, TODO Really used ? | ||
@@ -563,0 +572,0 @@ |
@@ -51,3 +51,3 @@ { | ||
}, | ||
"version": "2.0.2", | ||
"version": "2.0.3", | ||
"devDependencies": { | ||
@@ -54,0 +54,0 @@ "grunt": "^1.3.0", |
@@ -20,3 +20,3 @@ # Node-Red deCONZ | ||
Some new features ([Changelog](https://github.com/deconz-community/node-red-contrib-deconz/blob/develop/CHANGELOG.md)): | ||
Some new features ([Changelog](https://github.com/deconz-community/node-red-contrib-deconz/blob/master/CHANGELOG.md)): | ||
@@ -23,0 +23,0 @@ * Multiple device selection. |
@@ -38,2 +38,8 @@ const Utils = require("./Utils"); | ||
case 'homekit': | ||
if (this.message_in.hap !== undefined && this.message_in.hap.session !== undefined) { | ||
this.node.error("Deconz outptut node received a message that was not initiated by a HomeKit node. " + | ||
"Make sure you disable the 'Allow Message Passthrough' in homekit-bridge node or ensure " + | ||
"appropriate filtering of the messages."); | ||
return null; | ||
} | ||
this.valid_domain.push('lights'); | ||
@@ -239,3 +245,7 @@ this.valid_domain.push('group'); | ||
} else { | ||
if (this.valid_domain.length === 0) return requests; | ||
for (let device of devices) { | ||
// Skip if device is invalid, should never happen. | ||
if (device === undefined || device.data === undefined) continue; | ||
// If the device type do not match the command type skip the device | ||
@@ -253,3 +263,3 @@ if (!this.valid_domain.includes('any') && | ||
// Attribute request | ||
if (Object.keys(this.result.config).length > 0) { | ||
if (Object.keys(this.result).length > 0) { | ||
let request = {}; | ||
@@ -297,5 +307,8 @@ request.endpoint = deviceTypeEndpoint.main(device.data.device_id); | ||
// Remove undefined params in requests | ||
for (const request of requests) | ||
for (const [k, v] of Object.entries(request.params)) | ||
requests = requests.map((request) => { | ||
for (const [k, v] of Object.entries(request.params)) { | ||
if (v === undefined) delete request.params[k]; | ||
} | ||
return request; | ||
}).filter((request) => Object.keys(request.params).length > 0); | ||
@@ -302,0 +315,0 @@ return requests; |
@@ -9,2 +9,3 @@ const Query = require('./Query'); | ||
this.devices = {}; | ||
this.all_group_real_id = undefined; | ||
for (const resource of this.domains) this.devices[resource] = { | ||
@@ -11,0 +12,0 @@ ById: {}, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
461288
50
6063
1