We have upgraded the community system as part of the upgrade a password reset is required for all users before login in.

onion cloud force crashes node.js & gpio_helper



  • Hi Everyone,

    I am attempting to run a node.js script that uses gpio_helper. I am using the following code (it also uses pushbullet).

    //on Garage state change send notification
    helper.onPinChange(6, function(value) {
    	
    	if (startingvar != 0){
    		if(value == 1) {
    			
    			console.log("The garage is open - " + value + " as of " + getDateNow());
    
    			pusher.note(null, "GarageFi", "The garage was opened.", function(error, response) {
    			  //process.exit();      // kill the script once push is sent
    			});
    			
    		} else if(value == 0){
    			
    			console.log("The garage is closed - " + value + " as of " + getDateNow());
    
    			pusher.note(null, "GarageFi", "The garage was closed.", function(error, response) {
    			  //process.exit();      // kill the script once push is sent
    			});
    			
    		}
    	}
    	
    });
    

    Now the problem comes when I poll this same GPIO pin via the Onion Cloud API. If I poll the same GPIO pin it either hangs (using the web UI), or it crashes as follows:

    fs.js:603
      var r = binding.read(fd, buffer, offset, length, position);
                      ^
    
    Error: ENODEV: no such device, read
        at Error (native)
        at Object.fs.readSync (fs.js:603:19)
        at Object.fs.readFileSync (fs.js:433:24)
        at GPIOHelper.getPinSync (/root/gpiohelper.js:77:15)
        at GPIOHelper._poll (/root/gpiohelper.js:110:20)
        at null._repeat (/root/gpiohelper.js:100:8)
        at wrapper [as _onTimeout] (timers.js:275:11)
        at Timer.listOnTimeout (timers.js:92:15)
    
    

    Is it not possible to watch for the GPIO state with the JS code and at the same time have the API read the state as well?



  • Same for me with a different node.js.



  • @Costas-Costas said in onion cloud force crashes node.js & gpio_helper:

    Same for me with a different node.js.

    Glad I am not the only one. I am surprised it isnt a more common issue, and that there isn't a resolution yet! 😢



Looks like your connection to Community was lost, please wait while we try to reconnect.