-
-
Notifications
You must be signed in to change notification settings - Fork 288
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ZwaveJS UI - Multi-level switch support (Dimmer and Curtains) (#2061)
Co-authored-by: Stéphane Escandell <[email protected]>
- Loading branch information
1 parent
88e10e2
commit 69f6d03
Showing
16 changed files
with
10,604 additions
and
1,680 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/** | ||
* @description This will return the Gladys device. | ||
* @param {string} nodeId - The gladys device id. | ||
* @returns {object} The Gladys Device. | ||
* @example zwaveJSUI.getDevice('zwavejs-ui:5'); | ||
*/ | ||
function getDevice(nodeId) { | ||
return this.devices.find((n) => n.external_id === nodeId); | ||
} | ||
|
||
module.exports = { | ||
getDevice, | ||
}; |
15 changes: 15 additions & 0 deletions
15
server/services/zwavejs-ui/lib/zwaveJSUI.getZwaveJsDevice.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/** | ||
* @description This will return the zwaveJs device. | ||
* @param {string} gladysDeviceId - The gladys device id. | ||
* @returns {object} The zwaveJsDevice. | ||
* @example zwaveJSUI.getZwaveJsDevice("zwavejs-ui:5"); | ||
*/ | ||
function getZwaveJsDevice(gladysDeviceId) { | ||
const deviceId = parseInt(gladysDeviceId.split(':')[1], 10); | ||
|
||
return this.zwaveJSDevices.find((n) => n.id === deviceId); | ||
} | ||
|
||
module.exports = { | ||
getZwaveJsDevice, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 38 additions & 23 deletions
61
server/services/zwavejs-ui/lib/zwaveJSUI.onNodeValueUpdated.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,7 @@ | |
"arm64" | ||
], | ||
"dependencies": { | ||
"bluebird": "^3.7.2", | ||
"get-value": "^3.0.1", | ||
"mqtt": "^4.0.0" | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
const cleanNames = (text) => { | ||
if (!text || typeof text !== 'string') { | ||
return ''; | ||
} | ||
return text | ||
.replaceAll(' ', '_') | ||
.replaceAll('(', '') | ||
.replaceAll(')', '') | ||
.toLowerCase(); | ||
}; | ||
|
||
module.exports = cleanNames; |
Oops, something went wrong.