redloro / smartthings

SmartThings home automation services, apps and devices
Apache License 2.0
116 stars 194 forks source link

Envisalink Connection Error: Undefined #36

Closed GaryMilne closed 5 years ago

GaryMilne commented 5 years ago

Hi Redloro, I'm trying to integrate a newly purchased EVL-4EZ to Smartthings. I liked the elegance of your solution vs AlarmServer so I thought I'd give it a go. Anyway, everything was going smoothly until I fire up the Node Proxy as shown in the attached graphic.

Seems like its a parameter problem with the config.json but I assure you it isn't. I've checked the following: 1) I can logon to the Envisalink on the local LAN 2) I can ARM\DISARM via Envisalink 3) I can point a browser to the SmartThings proxy port and get a response. 4) An IP Scanner reports port 4025 to be open on the Envisalink. 5) Windows Firewall does not block any ports or hosts for the Node software. 6) Config.json has been Beautified and is clean.

I'm testing this on Windows 10 but will move it to a Pi once I know it works.

So my questions are: 1) Is there anyway to do a verbose logging that might yield a clue. 2) Any suggestions on what I might have overlooked?

It's probably irrelevant but the The Honeywell system is a Vista 15 and Smartthings Hub is V3 using WiFi.

Cheers.

image

redloro commented 5 years ago

@GaryMilne have you tested following this video: https://www.youtube.com/watch?v=e2Xs0WWKl1Q

Are you able to login and see the status messages from Envisalink?

GaryMilne commented 5 years ago

Thanks for the video, that was helpful. With Putty if I use it configured as a Telnet client I get "Connection closed by remote host" right away. image

Now if I change Putty to using a Raw connection (no other changes) then I get the logon prompt, can enter the "user" password and start receiving the status messages. image

Perhaps there is some change in the type of connection accepted in my version of the board?

redloro commented 5 years ago

@GaryMilne can you share your config.json?

GaryMilne commented 5 years ago

Here it is with a .TXT extension so I can upload it. config.json.txt

GaryMilne commented 5 years ago

Ooops, accidentally closed and now reopened.

redloro commented 5 years ago

Thanks... why is the EVL address set to 192.168.1.20 in the config.json but you used 192.168.0.20 in putty??

GaryMilne commented 5 years ago

There can be only one reason for the discrepancy, I'm a dumbass that has looked at it too long. Thanks for catching that. Seems to be running now, says "Completed Panel Discovery" but has not created any devices yet. I'll work on it some more tomorrow. Many thanks for your help. Sorry to have wasted your time.

redloro commented 5 years ago

Lol no worries... happy to help.

GaryMilne commented 5 years ago

I got it all working after a fashion but I have one issue to report. Everything works fine and Smartthings picks up the changes in state within a few seconds, but it's just not pretty to look at. image Thanks again for your help yesterday.

redloro commented 5 years ago

Ooohh that does not look pretty at all... what files do you have in your plugins folder? It checks for connection errors and tries to recover every 4 secs... maybe there's an issue Windows??

GaryMilne commented 5 years ago

I only have the envisalink.js in Plugins. Could be a Windows issue but I get the same result even with Windows Firewall off which would have been the most likely culprit.

When I first do an NPM RUN START I get a number of ECONNRESET error message as shown below. image

I don't think the file "smartthings-nodeproxy.service" had any bearing on my Windows install as I'm running it in an Admin command prompt not a service, so I renamed it. But I mention it just in case.

redloro commented 5 years ago

Yeah you definitely have some weird network issue going on... does the [stnp] Notify error... eventually go away??

GaryMilne commented 5 years ago

Not so far. I plan on moving it to a Pi Zero W (I think that should work) and hopefully that will resolve the issue.

On Wed, Sep 4, 2019 at 11:37 AM redloro notifications@github.com wrote:

Yeah you definitely have some weird network issue going on... does the [stnp] Notify error... eventually go away??

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/redloro/smartthings/issues/36?email_source=notifications&email_token=AD4ZMVMGNFQCMKIM4FU3TXLQH7P6FA5CNFSM4ITK75BKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD54GIEQ#issuecomment-527983634, or mute the thread https://github.com/notifications/unsubscribe-auth/AD4ZMVOZHLIXASXN4B6XDBTQH7P6FANCNFSM4ITK75BA .

-- Gary Milne E-Mail: GaryJMilne@gmail.com

GaryMilne commented 5 years ago

Hey Redloro, I got my Pi configured and Node.js installed etc. Unfortunately I still get the same issue as I did from windows. image

As I mentioned it still runs but is rather hideous to look at. I don't know if its related but after it had been running (with all the errors) for about 12 hours my panel gave me the error for the Long Range Radio Output. So perhaps the Envisalink got into an error condition after being hammered all day long with unsuccessful connection attempts. I have the LRRO set to 0 now so it doesn't wake me in the night. So that all means that even though it still runs with all the errors, it might make the envisalink too unstable for this solution to be usable.

Now that I have it on a Pi are there any additional troubleshooting options that I didn't have on Windows, such as a step debugger?

I did a network capture between Node and Envisalink but without the proper parser it just came across as binary data blobs. What is the data transfer protocol that is being used? Perhaps I can find a parser for it.

FYI This is the envisalink version that I have. image

It's such a nice solution I hope the issue can be resolved.

redloro commented 5 years ago

I'll run a clean install on my Pi next week and see if I can reproduce; it may be an issue with a newer library, maybe your EVL or your EVL setup? If you run the steps in the video and leave it connected for 15 mins do you continue to see the updates or does it disconnect too? I think the EVL can only support one connection, so if you have something else connecting, it may be causing the drop with STNP.

GaryMilne commented 5 years ago

I don't think it's a simultaneous connection issue. I had previously tested that theory on Windows by doing a reboot of the envisalink prior to starting the STNP. Just repeated in on Pi with the same result consistent with the prior screenshots.

STNP has been running on Pi now for 30 minutes and the errors continue.

My EVL is brand new. The NET light looks off but is actually flashing because I have a static IP. IMG_20190906_103220810

Lastly, it was probably immediately obvious to you, but not to me, that the ECONNRESET shown in an earlier post came from communication between STNP and Smartthings HUB. Perhaps these are cause by the Envisalink error, or perhaps there are two separate error conditions. You will probably have a good handle on that.

Windows Node version: v10.16.3 Pi Node version: v10.16.3

Smartthings Hub V3 image

If there is any other information I can provide just let me know and I will be happy to do so.

GaryMilne commented 5 years ago

FYI I should also mention that although the STNP is picking up all the Open\Close activity accurately, I am not able to successfully Arm\Disarm etc from SHM.

I did try and remove the app from Smartthings Classic to do a reinstall but it gives me the error "An unexpected error occured."

GaryMilne commented 5 years ago

Hey Redloro, I wanted to pass along that after some period of time the errors do seem to pause\stop and the process runs and reports open/close events..
image

If I do a Ctrl-C and restart STNP then I get the errors all over again but twice now it has done this. Both times right after the message "Error: ignoring invalid message code from Envisalink: df97.....", the rest you can see in the screen shot.

GaryMilne commented 5 years ago

I'm still trying to get this going properly and I have a few things to pass along.

1 The issue with the commands not going through are directly related to the connection errors as shown below.

image

2 I've tried multiple versions of Node on Pi and Windows up to and including 12.10.0

3 This is the problem area in the envisalink.js.

device = new net.Socket(); device.on('error', function(err) { logger("Envisalink connection error: "+err.description); device.destroy(); setTimeout(function() { self.init() }, 4000); }); If you think of something and want me to try it out I can do that without you having to duplicated the whole alarm setup.

4 I tried a python based version of alarmserver https://github.com/MattTW/HoneyAlarmServer and it was able to maintain a stable connection with the envisalink.

Please, let me know if you think of anything.

GaryMilne commented 4 years ago

I see this issue has been closed. I don't know if you closed it believing it was resolved or closed it for some other reason, but to be clear the issue still exists.

DACSys commented 4 years ago

I realize this issue is closed but since it seemed unresolved I wanted to give some feed back. I initially had the same Envisalink Connection error:undefined with a similar vintage Envisalink connected to a Honeywell Vista 15p running the node proxy in a Docker Container on a QNAP NAS. I had exactly the same error and could not access with Putty. I had been accessing the Envisalink successfully using a Hubitat native app and had disabled that app (Hubitat tick box) to try this node proxy. I considered a couple of potential issues - a) the Hubitat app was still accessing the port or b) the Envisalink was hung up (not disconnecting or perhaps needed a reboot following an update). I physically disconnected the Hubitat and initiated a software reboot of the Envisalink (through browser interface). I started this node proxy program and it just started working and showing state changes of devices. Tried Putty (Raw) and it also connected. Further testing showed that I could switch between the Hubitat native app or the node proxy accessing the Envisalink by disabling the native app. So it appears in my case that the issue was not in the redloro smartthings node proxy program and the reboot of the Envisalink for my case solved the issue.

DACSys commented 4 years ago

Updating my previous comment. I was able to recreate the error. I then deleted the app in question from the Hubitat and the node proxy server began to work so it appears the Envisalink TPI port was still engaged with this other program. (rebooting the Envisalink did not hurt).