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

Commit

Permalink
implement touchlinkFactoryReset
Browse files Browse the repository at this point in the history
  • Loading branch information
hobbyquaker committed Dec 26, 2019
1 parent bb12b31 commit 379ffc3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
5 changes: 5 additions & 0 deletions nodes/shepherd.html
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,10 @@
$.getJSON('zigbee-shepherd/soft-reset?id=' + id, () => {});
});

$('#touchlink-reset').click(() => {
$.getJSON('zigbee-shepherd/touchlink-reset?id=' + id, () => {});
});

$('#join-permit').click(() => {
$.getJSON('zigbee-shepherd/join?id=' + id + '&permit=true', () => {});
clearInterval(this.refreshInterval);
Expand Down Expand Up @@ -1437,6 +1441,7 @@
<div class="form-row">
<button id="join-permit">PermitJoin</button>
<button id="join-stop">StopJoin</button>
<button id="touchlink-reset">TouchlinkFactoryReset</button>
<button id="show-network-map">NetworkMap</button>

</div>
Expand Down
9 changes: 9 additions & 0 deletions nodes/shepherd.js
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,15 @@ module.exports = function (RED) {
}
});

RED.httpAdmin.get('/zigbee-shepherd/touchlink-reset', RED.auth.needsPermission('zigbee.write'), (req, res) => {
if (shepherdNodes[req.query.id]) {
shepherdNodes[req.query.id].touchlinkFactoryReset();
res.status(200).send('');
} else {
res.status(500).send(`500 Internal Server Error: Unknown Herdsman ID ${req.query.id}`);
}
});

RED.httpAdmin.post('/zigbee-shepherd/cmd', RED.auth.needsPermission('zigbee.write'), (req, res) => {
if (shepherdNodes[req.query.id]) {
const cmd = JSON.parse(req.body.cmd);
Expand Down

0 comments on commit 379ffc3

Please sign in to comment.