Skip to content

Commit 3475c98

Browse files
author
vzakharchenko
committed
updated
1 parent ac9a8db commit 3475c98

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

lib/gpioService.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,21 @@ function initGPIO(config) {
1616
}
1717

1818
shutdown = new Gpio(parseInt(config.gpio.shutdown.gpio, 10), 'in', edge);
19-
shutdown.watch(async (err) => {
19+
shutdown.read().then(async (value) => {
20+
if (value === parseInt(config.gpio.shutdown.level, 10)) {
21+
console.info('Shutdown server');
22+
await halt();
23+
}
24+
});
25+
26+
shutdown.watch(async (err, value) => {
2027
if (err) {
2128
throw err;
2229
}
23-
console.info('Shutdown server');
24-
await halt();
30+
if (parseInt(config.gpio.shutdown.level, 10) === value) {
31+
console.info('Shutdown server');
32+
await halt();
33+
}
2534
});
2635

2736
process.on('SIGINT', () => {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "smartthings-phevctl",
3-
"version": "1.8.10",
3+
"version": "1.8.11",
44
"description": "smartthings remote ctrl",
55
"main": "smartthings-phevctl.js",
66
"scripts": {

0 commit comments

Comments
 (0)