This is the forum archive of Homey. For more information about Homey, visit the Official Homey website.
The Homey Community has been moved to https://community.athom.com.
This forum is now read-only for archive purposes.
The Homey Community has been moved to https://community.athom.com.
This forum is now read-only for archive purposes.
Closed
failed http-requests hanging apps (or Homey)
I get the feeling quite some errors with hanging apps (and perhaps Homey) are caused by failed and/or refused http-requests. Like this error (not on my Homey):
A connection refused or socket hang up shouldn't crash the app or is this an error in the app not providing some fallback for functions returning an error?Error: connect ECONNREFUSED 192.168.1.61:80
at Object.exports._errnoException (util.js:870:11)
at exports._exceptionWithHostPort (util.js:893:20)
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1061:14)
Error: socket hang up
at createHangUpError (_http_client.js:200:15)
at Socket.socketCloseListener (_http_client.js:232:23)
at emitOne (events.js:82:20)
at Socket.emit (events.js:169:7)
at TCP._onclose (net.js:477:12)
--- INFO: com.sony.androidtv has been killed ---
Disconnected from Homey, automatically reconnecting...
Trying to reconnect...
Debug session expired, exiting...
This discussion has been closed.
Comments
Error came from me and error I posted.
It's looks like a homey issue.
I moved exact the same code to a separate nodejs file and it's runs over and over and over.... Again without a hitch....
Running the code on homey results (almost) every time in a error and killed a app.
Tried a timeout of 2secs and that doesn't help.
I also got some work to do in this case with my apps
I did some testing;
15:05:20; external nodeJS sends ON signal with OK result
15:05:25; external nodeJS sends OFF signal with OK result
15:05:30; run Homey flow sends OFF signal and App killed and TV not reacting
15:05:35; external nodeJS sends ON signal with OK result
This is the code of the external nodeJS file;
Here the "failing" app code:
The above code results in:
So at all time;
Homey and the TV are reachable.
Homey app get killed and TV doesn't respond
External nodeJS file works and TV does respond
I have no idea whats going wrong and/or how to solve it.
Next, could it be possible that the TV somehow links the 5555 pincode to the device that requests it? Meaning that you cannot send the wakeup command to the TV from Homey because the pincode you requested was generated based on your browsers REST client.
(Just guessing here!)
I had a callback for error "handling", but removed it while testing.
Added your suggestion and this is the result;
Also changed the PSK key for testing, so if it was device was linked to it, the fresh key would accept Homey, but that also didn't help.
Would surprise me though.
By the way, I also noticed yesterday that my TV didn't respond to WOL when it was off for a few hours. I couldn't ping the device either.
I'm no programmer so forgive me for dumb questions: There is a difference in body:xml and body:envelope isn't there? Also, did you enter the 5555 in your app instead of using a variable for it?