door opening locked
authorebelcrom <ebelcrom@gmail.com>
Fri, 6 Mar 2020 19:34:23 +0000 (20:34 +0100)
committerebelcrom <ebelcrom@gmail.com>
Fri, 6 Mar 2020 19:34:23 +0000 (20:34 +0100)
routes/v1/control.js

index 8b5285db9b6cfda686b1b26461c83c214165603e..5d2028a44983a3691fc2d36b6b092c09faf52533 100644 (file)
@@ -33,6 +33,11 @@ router.post('/', nocache, function(req, res, next) {
     if (typeof req.query.command == 'string') {
       switch (req.query.command) {
         case 'move':
+          if (gpio.read() == 'closed') {
+            log.warn('Open the door isn\'t allowed');
+            res.status(400).send();
+            return;
+          }
           break;
         default:
           log.info('Value of command query parameter unknown');