Skip to content

Commit

Permalink
8.2.0 (#278)
Browse files Browse the repository at this point in the history
* Migrate methods / args

* Fix Firmware method arg

* Small fix (use array in FWU)
  • Loading branch information
marcus-j-davies authored Jul 25, 2023
1 parent 1f40cfb commit ed87d36
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 26 deletions.
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
{
"name": "node-red-contrib-zwave-js",
"version": "8.1.0",
"version": "8.2.0",
"license": "MIT",
"description": "The most powerful, high performing and highly polished Z-Wave node for Node-RED based on Z-Wave JS. If you want a fully featured Z-Wave framework in your Node-RED instance, you have found it.",
"dependencies": {
"limiter": "^2.1.0",
"lodash": "^4.17.21",
"winston": "^3.8.2",
"winston": "^3.10.0",
"winston-transport": "^4.5.0",
"zwave-js": "^10.16.0"
"zwave-js": "^11.6.0"
},
"devDependencies": {
"eslint": "^8.39.0",
"prettier": "^2.8.8"
"eslint": "^8.45.0",
"prettier": "^3.0.0"
},
"scripts": {
"validate": "node-red-dev validate -o validation_result.json"
Expand Down Expand Up @@ -61,4 +61,4 @@
"url": "https://github.com/zwave-js/node-red-contrib-zwave-js/issues"
},
"homepage": "https://github.com/zwave-js/node-red-contrib-zwave-js#readme"
}
}
15 changes: 7 additions & 8 deletions resources/UITab/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -217,9 +217,9 @@ const DCs = {
name: 'getAvailableFirmwareUpdates',
noWait: false
},
beginOTAFirmwareUpdate: {
firmwareUpdateOTA: {
API: 'ControllerAPI',
name: 'beginOTAFirmwareUpdate',
name: 'firmwareUpdateOTA',
noWait: false
}
};
Expand Down Expand Up @@ -522,11 +522,11 @@ const ZwaveJsUI = (function () {
}

ControllerCMD(
DCs.beginOTAFirmwareUpdate.API,
DCs.beginOTAFirmwareUpdate.name,
DCs.firmwareUpdateOTA.API,
DCs.firmwareUpdateOTA.name,
undefined,
[Node, File],
DCs.beginOTAFirmwareUpdate.noWait
DCs.firmwareUpdateOTA.noWait
)
.then(() => {
FWRunning = true;
Expand Down Expand Up @@ -1126,7 +1126,7 @@ const ZwaveJsUI = (function () {
const RestrictedModes = ['IEAPI'];
const RestrictedMethods = [
'setPowerlevel',
'beginFirmwareUpdate',
'updateFirmware',
'abortFirmwareUpdate',
'setRFRegion',
'hardReset',
Expand Down Expand Up @@ -3570,8 +3570,7 @@ const ZwaveJsUI = (function () {

const Child = renderPropertyElement(Prop);
propertyList
.treeList('data')
[Index].treeList.addChild({ element: Child });
.treeList('data')[Index].treeList.addChild({ element: Child });

if (Writeable && Type !== 'any') {
const icon = Child.prev();
Expand Down
15 changes: 10 additions & 5 deletions zwave-js/ui/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ class UIServer {

const PL = {
mode: 'ControllerAPI',
method: 'beginFirmwareUpdate',
method: 'updateFirmware',
params: [NodeID, Target, FileName, _Buffer]
};

Expand Down Expand Up @@ -525,11 +525,16 @@ class UIServer {
node.on('notification', (node, value) => {
this._SendNodeEvent('node-value', node, value);
});
node.on('firmware update progress', (node, S, R) => {
this._SendNodeEvent('node-fwu-progress', node, { sent: S, remain: R });
node.on('firmware update progress', (node, Progress) => {
this._SendNodeEvent('node-fwu-progress', node, {
sent: Progress.sentFragments,
remain: Progress.totalFragments - Progress.sentFragments
});
});
node.on('firmware update finished', (node, Status) => {
this._SendNodeEvent('node-fwu-completed', node, { status: Status });
node.on('firmware update finished', (node, Result) => {
this._SendNodeEvent('node-fwu-completed', node, {
status: Result.status
});
});

// Meta
Expand Down
19 changes: 12 additions & 7 deletions zwave-js/zwave-js.js
Original file line number Diff line number Diff line change
Expand Up @@ -915,10 +915,10 @@ module.exports = function (RED) {
Send(ReturnNode, 'FIRMWARE_UPDATE_CHECK_RESULT', FWU, send);
break;

case 'beginOTAFirmwareUpdate':
case 'firmwareUpdateOTA':
NodeCheck(Params[0]);
ReturnNode.id = Params[0];
await Driver.controller.beginOTAFirmwareUpdate(Params[0], Params[1]);
await Driver.controller.firmwareUpdateOTA(Params[0], Params[1]);
Send(ReturnNode, 'FIRMWARE_UPDATE_STARTED', Params[1], send);
break;

Expand All @@ -943,14 +943,19 @@ module.exports = function (RED) {
Send(ReturnNode, 'FIRMWARE_UPDATE_ABORTED', undefined, send);
break;

case 'beginFirmwareUpdate':
case 'updateFirmware':
NodeCheck(Params[0]);
ReturnNode.id = Params[0];
const Format = ZWaveJS.guessFirmwareFileFormat(Params[2], Params[3]);
const Firmware = ZWaveJS.extractFirmware(Params[3], Format);
const Package = {
data: Firmware.data,
firmwareTarget: Params[1]
};

await Driver.controller.nodes
.get(Params[0])
.beginFirmwareUpdate(Firmware.data, Params[1]);
.updateFirmware([Package]);
Send(ReturnNode, 'FIRMWARE_UPDATE_STARTED', Params[1], send);
break;

Expand Down Expand Up @@ -1406,7 +1411,7 @@ module.exports = function (RED) {
case 'getLastEvents':
const PL = [];
Driver.controller.nodes.forEach((N) => {
if(N.isControllerNode){
if (N.isControllerNode) {
return;
}
const I = {
Expand Down Expand Up @@ -2136,8 +2141,8 @@ module.exports = function (RED) {
}

Node.once(event_Ready.zwaveName, () => {
Node.on(event_FirmwareUpdateFinished.zwaveName, (N, S) => {
Send(N, event_FirmwareUpdateFinished.redName, S);
Node.on(event_FirmwareUpdateFinished.zwaveName, (N, R) => {
Send(N, event_FirmwareUpdateFinished.redName, R);
});

Node.on(event_ValueNotification.zwaveName, (N, VL) => {
Expand Down

0 comments on commit ed87d36

Please sign in to comment.