Calling getPumpStatus() is timing out.
tjblevins opened this issue · 4 comments
Hi Parnic, I have created a REST webservice using your Library and I love it!
Recently, I have been asked to expand to capture more Pump info and I noticed you added Pump Functions to the library.
I created a copy of example.js and added the get getPumpStatus(). It seems to be timing out on that one function.
Any ideas?
}).on('saltCellConfig', function(saltCellConfig) { this.getControllerConfig(); console.log(' salt cell installed=' + saltCellConfig.installed); //Adding Pump }).on('pumpStatus', function(pumpStatus) { this.getPumpStatus(0); console.log(' Pump Status =' + pumpStatus.isRunning); //Pump End }).on('controllerConfig', function(config) { console.log(' controller is in celsius=' + config.degC); client.close();
Several things jump out at me, but it's hard to say what exactly your problem is based on the partial code you've provided.
The main, most likely, issue is that the event is named getPumpStatus
, not pumpStatus
. However, the code you provided doesn't ever appear to be calling getPumpStatus()
anywhere except in response to a pumpStatus
event, which won't ever get hit. If you'd like to provide a full gist of or link to your code, I'd be happy to help further, but right now it looks like you've just got the wrong event name.
By the way, if you set the environment variable DEBUG
to sl:*
, you can see behind-the-scenes of what the library is doing. It's likely that it's emitting logs of some kind about the event that's firing, but since you never capture the event, your calling code seems to hang, waiting for an event that will never come.
Does that error happen immediately or after some delay? You're still not hooking the correct event name (getPumpStatus
), so an ECONNRESET would indicate that the connection is resetting due to, perhaps, a timeout.