node-red-contrib-deconz
Advanced tools
Comparing version 2.0.0-rc.3 to 2.0.0-rc.4
@@ -16,6 +16,6 @@ # Changelog | ||
Everything should be seamless, all your configuration will be migrated with the new save format. It's will save the | ||
updated configuration only when you open the node configuration and click Deploy. If you don't do it the node will | ||
migrate the configuration on each start of Node-Red. Check the Node-Red log if you have any errors that showes up. If | ||
you have any issues you can come on the [Deconz-Community Discord](https://discord.gg/3XGEYY9) server or open | ||
Everything should be seamless, all your configurations will be migrated to the new save format. It will save the | ||
updated configuration only when you open the node configuration and click Deploy. If you are not performing it, the node will | ||
migrate the configuration on each start of Node-Red. Check the Node-Red log if you have any errors that shows up. If | ||
you have any issues you may visit the [Deconz-Community Discord](https://discord.gg/3XGEYY9) server or open | ||
an [issue on Github](https://github.com/deconz-community/node-red-contrib-deconz/issues). | ||
@@ -28,4 +28,4 @@ | ||
a device list. | ||
- Each outputs of nodes is now customizable. If you don't need the homekit output just remove it ! | ||
- Rework the Auto configuration of server. It's now look for Home-Assistant installations too. | ||
- Each outputs of the nodes are now customizable. If you don't need the HomeKit output, just remove it. | ||
- Reworked the Auto configuration of server. It looks for Home-Assistant installations as well. | ||
@@ -35,4 +35,4 @@ #### Input and Battey nodes | ||
- New output types | ||
- Attribute - Contain all information about device, include State and Config. | ||
- Config - Contain configuration data. | ||
- Attribute - Contains all information about the device, include State and Config. | ||
- Config - Contains configuration data. | ||
- Scene Call - Called when a scene is called. | ||
@@ -43,3 +43,3 @@ - New properties on messages | ||
- meta_changed - List of param path that changed since last message. Exemple : "state.lastupdated". | ||
- Connexion preview, you can press the top right button of each output rule to see what nodes are connected. | ||
- Connection preview, you can press the top right button of each output rule to see what nodes are connected. | ||
- Start output is now configurable for each type. To avoid fake button events you should disable it for switch devices. | ||
@@ -53,12 +53,12 @@ | ||
- New output formats | ||
- Single - The node will send a message per device that send data. | ||
- Single - The node will send a message per device that sends data. | ||
- Array - The node will send a message with all payload inside an array. The message will contain a payload that is | ||
an array of single message. Ex msg.payload[0].payload is the payload of the first device. Each element will | ||
an array of single message. E.g. msg.payload[0].payload is the payload of the first device. Each element will | ||
contain only the properties payload, meta, meta_changed. The properties topic, payload_format, payload_raw will be | ||
on the msg directly. | ||
- Sum - All properties of the devices will be added individually. | ||
- Average - All properties of the devices will be added recursively and then divided by the amount of device that | ||
- Average - All properties of the devices will be added recursively and then divided by the number of devices that | ||
have that property. | ||
- Min - The result will be a set of minimal value of each property. | ||
- Max - The result will be a set of maximal value of each property. | ||
- Min - The result will be a set with the minimal value of each property. | ||
- Max - The result will be a set with the maximal value of each property. | ||
@@ -75,3 +75,3 @@ #### Output node | ||
- Added output to see the result of the api request. | ||
- All options can be set in one command. You can now set brightness and color in one command. | ||
- All options can be set in one command. You can now set brightness and color in a single step. | ||
- Multiple commands can be added and executed one by one. | ||
@@ -82,4 +82,4 @@ - Command preview, you can press the top right button of each command to run it instantly. | ||
- New message property meta associated to the event with the device configuration. | ||
- Now display the event count since last deploy. | ||
- New message property meta is associated to the event with the device configuration. | ||
- Now displays the event count since the last deploy. | ||
@@ -86,0 +86,0 @@ ## [1.3.4] - 2021-09-28 ![Relative date](https://img.shields.io/date/1632782604?label=) |
@@ -10,2 +10,3 @@ const got = require('got'); | ||
const Utils = require("../src/runtime/Utils"); | ||
const {setIntervalAsync, clearIntervalAsync} = require('set-interval-async/fixed'); | ||
@@ -67,59 +68,59 @@ module.exports = function (RED) { | ||
(async () => { | ||
try { | ||
//TODO make the delay configurable | ||
await Utils.sleep(1500); | ||
//TODO make the delay configurable | ||
await Utils.sleep(1500); | ||
let pooling = async () => { | ||
let result = await node.discoverDevices({forceRefresh: true}); | ||
if (result === true) { | ||
if (node.state.pooling.isValid === false) { | ||
node.state.pooling.isValid = true; | ||
node.state.ready = true; | ||
this.setupDeconzSocket(node); | ||
node.emit('onStart'); | ||
} | ||
node.state.pooling.reachable = true; | ||
node.state.pooling.lastPooling = Date.now(); | ||
node.state.pooling.failCount = 0; | ||
if (node.state.pooling.errorTriggered === true) { | ||
node.log(`discoverDevices: Connected to deconz API.`); | ||
} | ||
node.state.pooling.errorTriggered = false; | ||
} else if (node.state.pooling.isValid === false) { | ||
if (node.state.startFailed) return; | ||
node.state.pooling.failCount++; | ||
let code = RED._('node-red-contrib-deconz/server:status.deconz_not_reachable'); | ||
let reason = "discoverDevices: Can't connect to deconz API since starting. " + | ||
"Please check server configuration."; | ||
if (node.state.pooling.errorTriggered === false) { | ||
node.state.pooling.errorTriggered = true; | ||
node.propagateErrorNews(code, reason, true); | ||
} | ||
if (node.state.pooling.failCount % 4 === 2) { | ||
node.error(reason); | ||
} | ||
} else { | ||
node.state.pooling.failCount++; | ||
let code = RED._('node-red-contrib-deconz/server:status.deconz_not_reachable'); | ||
let reason = "discoverDevices: Can't connect to deconz API."; | ||
let pooling = async () => { | ||
let result = await node.discoverDevices({forceRefresh: true}); | ||
if (result === true) { | ||
if (node.state.pooling.isValid === false) { | ||
node.state.pooling.isValid = true; | ||
node.state.ready = true; | ||
this.setupDeconzSocket(node); | ||
node.emit('onStart'); | ||
} | ||
node.state.pooling.reachable = true; | ||
node.state.pooling.lastPooling = Date.now(); | ||
node.state.pooling.failCount = 0; | ||
if (node.state.pooling.errorTriggered === true) { | ||
node.log(`discoverDevices: Connected to deconz API.`); | ||
} | ||
node.state.pooling.errorTriggered = false; | ||
} else if (node.state.pooling.isValid === false) { | ||
if (node.state.startFailed) return; | ||
node.state.pooling.failCount++; | ||
let code = RED._('node-red-contrib-deconz/server:status.deconz_not_reachable'); | ||
let reason = "discoverDevices: Can't connect to deconz API since starting. " + | ||
"Please check server configuration."; | ||
if (node.state.pooling.errorTriggered === false) { | ||
node.state.pooling.errorTriggered = true; | ||
node.propagateErrorNews(code, reason, true); | ||
} | ||
if (node.state.pooling.failCount % 4 === 2) { | ||
node.error(reason); | ||
} | ||
} else { | ||
node.state.pooling.failCount++; | ||
let code = RED._('node-red-contrib-deconz/server:status.deconz_not_reachable'); | ||
let reason = "discoverDevices: Can't connect to deconz API."; | ||
if (node.state.pooling.errorTriggered === false) { | ||
node.state.pooling.errorTriggered = true; | ||
node.propagateErrorNews(code, reason, true); | ||
} | ||
if (node.state.pooling.failCount % 4 === 2) { | ||
node.error(reason); | ||
} | ||
if (node.state.pooling.errorTriggered === false) { | ||
node.state.pooling.errorTriggered = true; | ||
node.propagateErrorNews(code, reason, true); | ||
} | ||
}; | ||
if (node.state.pooling.failCount % 4 === 2) { | ||
node.error(reason); | ||
} | ||
} | ||
}; | ||
await pooling(); | ||
if (node.state.startFailed !== true) | ||
this.refreshDiscoverTimer = setInterval(pooling, node.refreshDiscoverInterval); | ||
await pooling(); | ||
if (node.state.startFailed !== true) { | ||
this.refreshDiscoverTimer = setIntervalAsync(pooling, node.refreshDiscoverInterval); | ||
} | ||
} catch (e) { | ||
node.state.ready = false; | ||
node.error("Deconz Server node error " + e.toString()); | ||
} | ||
})(); | ||
})().catch((error) => { | ||
node.state.ready = false; | ||
node.error("Deconz Server node error " + error.toString()); | ||
console.log("Error from server node #1", error); | ||
}); | ||
} | ||
@@ -522,9 +523,13 @@ | ||
node.log('Shutting down deconz server node.'); | ||
clearInterval(node.refreshDiscoverTimer); | ||
node.state.ready = false; | ||
if (node.socket !== undefined) { | ||
node.socket.close(); | ||
node.socket = undefined; | ||
} | ||
node.emit('onClose'); | ||
(async () => { | ||
await clearIntervalAsync(node.refreshDiscoverTimer); | ||
})().then(() => { | ||
node.state.ready = false; | ||
if (node.socket !== undefined) { | ||
node.socket.close(); | ||
node.socket = undefined; | ||
} | ||
console.log('Deconz server stopped!'); | ||
node.emit('onClose'); | ||
}); | ||
} | ||
@@ -531,0 +536,0 @@ |
@@ -21,5 +21,5 @@ { | ||
"dot-prop": "^6.0.1", | ||
"events": "latest", | ||
"got": "^11.8.2", | ||
"multiple-select": "^1.5.2", | ||
"set-interval-async": "^2.0.3", | ||
"ws": "latest" | ||
@@ -52,3 +52,3 @@ }, | ||
}, | ||
"version": "2.0.0-rc.3", | ||
"version": "2.0.0-rc.4", | ||
"devDependencies": { | ||
@@ -55,0 +55,0 @@ "grunt": "^1.3.0", |
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
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
484319
6722
+ Addedset-interval-async@^2.0.3
+ Added@babel/runtime@7.5.0(transitive)
+ Addedregenerator-runtime@0.13.11(transitive)
+ Addedset-interval-async@2.0.3(transitive)
- Removedevents@latest
- Removedevents@3.3.0(transitive)