DSC Alarm integration

My config looks slightly different than yours, but not much:

envisalink:
host: dscserver
panel_type: DSC
user_name: user
password: user
code: ‘XXXX’
port: 4025
evl_version: 3
keepalive_interval: 60
zonedump_interval: 0
panic_type: Police
zones:
1:
name: ‘Kitchen Door’
type: ‘door’

I noticed your firmware version is quite a bit behind. I’m at 01.12.193, but I’m on an EVL3. Is your EVL connected to the internet to get firmware updates? You should see on the TPI page for the EVL, what IP is connected to it. Is that IP the IP of your HA server? Also I assume you have the right username and password for the EVL configured in HA. Can you ping from the HA machine to the EVL?

Hi thank you for the reply. The firmware version that I have is the latest … The EVL3 has been around longer and so it has more revision releases … (I checked around and it’s pretty consistently higher numbers). I believe it automatically updates, but I could be wrong. I can ping and get a reply. User name and password are indeed correct. As I mentioned before, I connected my Vera controller to it and have no issues (and yes I did disable the Vera and reboot the EVL-4 before trying with HA). Thanks … If you or anyone else has any more suggestions or diagnostics I can run, I would appreciate it.

So I decided to try this multiple times on a dedicated virtual machine running Hassio on a Mac experiment. I made the following observations:

envisalink:
host: 192.168.0.XXX
panel_type: DSC
code: ‘1234’
user_name: user
password: user
evl_version: 4
zones:
1:
name: ‘Zone 1’
type: ‘opening’

partitions:
1:
name: ‘Home Alarm’

is broken. When it is broken, the server just hangs and Home Assistant does not come up at all. There is no time out. I tried varying the timeout variable but it just hangs there.

envisalink:
__host: 192.168.0.XXX
__panel_type: DSC
__code: ‘1234’
__user_name: user
__password: user
__evl_version: 4
__partitions:
___1:
____name: ‘Home Alarm’
__zones:
___1:
____name: ‘Zone 1’
____type: ‘opening’

appears to work. I had to move the partitions above and delete any empty lines. I am not sure why, but this seemed to work. I added “_” to represent spaces, since this the editor here doesn’t allow for spaces.

  1. I had been also experimenting with trying to connect to a DSC server that connects to the Envisalink card. It basically Relays the command back and forth between the Envisalink and devices that want to connect by TPI. The Envisalink does not allow multiple TPI connections unfortunately. The Vera controller I have seems to be able to connect just fine and works with the DSC Server, but Home Assistant doesn’t want to connect. I get connection failures.

  2. When I connect directly to the Envisalink and not through the server, it seems to work. I get the arm/disarm buttons and a couple of sensors for each zone. However, It does not connect consistently.
    I often get this:

2019-05-29 11:57:20 ERROR (MainThread) [homeassistant.components.envisalink] Could not establish a connection with the Envisalink

2019-05-29 11:57:20 ERROR (MainThread) [homeassistant.setup] Setup failed for envisalink: Component failed to initialize.

2019-05-29 11:57:20 ERROR (MainThread) [pyenvisalink.envisalink_base_client] The server closed the connection. Reconnecting…

The reconnection appears successful on the Envisalink side showing my client is connected. The Home Assistant side, the alarm panel doesn’t show up again. I have tried a couple of times now and can’t seem to get it to connect again after the first few tries. Not sure what is going on. Is there a verbose mode somewhere that I can do more debug on this? Not sure why HA is not connecting now. Hope someone can offer some help here.

Well, I messed around with it some more … The only way I can get HA to connect successfully to Envisalink is to restart HA from the Configuration->General-Server Management menu and Click Restart. If I restart using sudo reboot, it does not want to connect for some reason. It’s not a very good workaround and makes me wonder how I can make it better … for example, if I have a power outage this most likely would not work. One thing I might try is to migrate everything to virtual machine on an always on Mac Mini that I have. The reboot time is super fast compared to my Raspberry Pi.

I’m actually using a dscserver to proxy my envisalink also. Obviously the dscserver is the only TPI connection to the envisalink and everything else goes through it. I run hass.io on a rpi 3. I’ve had a few stability issues with the dsc integration but a restart like you described always clears it. I’ve never been able to pinpoint the cause and it might be self inflicted. I’ve honestly considered setting up a nightly reboot as I suspect I’d have no issues after that but that just goes against everything I believe in.

This might be an idea instead of a scheduled restart.

I have used an envisalink for 4 years with HA and early on had connection problems. I resolved it by moving HA from a mac to a pi for the envisalink component. Not sure why that helped but it did. Also, I made sure only one connection is to the envisalink. If the connection is broken from HA unexpectedly, envisalink still doesn’t accept new connection for a time, I had to sometime log into envisalink website and caused it to reboot and HA then can log in ok.

Thanks for the reply. Could you tell me how you set up your dscserver? Do you have it on a separate machine from the HA server?
My DSCServer is setup on the same Raspberry Pi as my primary HA. My Vera Z-Wave controller can communicate with the DSCServer with no issues. However, I get connection errors and HA hangs and the Web UI does not come up when I try to connect to the DSC server either from my Raspberry Pi instance or my Virtual machine instance so I cannot even do a soft reboot from the web interface. Perhaps I am missing a setup step?

Thank you … actually I had forgotten the step that I had to reboot the Envisalink from the WebUI also and soft start HA to finally get the HA to connect directly. I have not repeated all these steps with my DSCServer setup. Perhaps I should try that. Good suggestion on the monitoring home-assistant.log file. I will have to figure out how to do that as a work around for now.

I’ve never had ANY stability problems with the dscserver or it’s connection to envisalink. My dscserver runs on an old Android phone though. Quite a few years ago I bought an old net10 prepaid phone refurb online for $5 and it’s been running fine ever since. I never reboot the dscserver phone other than occasionally if my WiFi is down for some reason the older version of Android on the phone doesn’t reconnect to wifi when it comes back up but that’s an issue with Android and not the phone. I don’t have any experience with the Java version of dscserver although my understanding is that is runs from the same code base as the Android version. It might be worth purchasing a cheap phone or pulling one from a drawer if you have one and running dscserver on it. I know mikep (dscserver developer) runs his on a phone so I assume that is the more tested code base.

Thanks … I don’t think I have a single android device in the house except my car head unit. So perhaps I will try to make or download an android virtual machine first on one of my macs and get the android app. If it works, then I may buy a dedicated device. But I think one of my primary issues is connection with the Envisalink itself from HA. Even when I connect directly, it only sometimes connects.

Hi Cinntax, I noticed again today that my Hass.io has lost connection to my envisalink again. I noticed because one of my motion sensors was constantly reporting motion when there was none. The logs are below from the past couple of days. This seems to be a similar issue to the one I experienced previously. Did the code for automatic reconnections make it into production? Could this be caused if my dscserver phone was temporarily off wifi and the pyenvisalink module just gave up and stopped trying to reconnect?

2019-06-17 20:04:37 ERROR (MainThread) [pyenvisalink.dsc_client] The envisalink asked for a code, but we have no code in our cache.
2019-06-17 21:31:35 ERROR (MainThread) [pyenvisalink.envisalink_base_client] The server closed the connection. Reconnecting…
2019-06-17 21:32:05 ERROR (MainThread) [homeassistant.components.envisalink] Could not establish a connection with the Envisalink
2019-06-18 14:03:40 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection.1819846256] unable to perform operation on <TCPTransport closed=True reading=False 0x707ff030>; the handler is closed
Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py”, line 121, in handle_call_service
connection.context(msg))
File “/usr/src/homeassistant/homeassistant/core.py”, line 1150, in async_call
self._execute_service(handler, service_call))
File “/usr/src/homeassistant/homeassistant/core.py”, line 1172, in _execute_service
await handler.func(service_call)
File “/usr/src/homeassistant/homeassistant/helpers/entity_component.py”, line 194, in handle_service
required_features
File “/usr/src/homeassistant/homeassistant/helpers/service.py”, line 316, in entity_service_call
future.result() # pop exception if have
File “/usr/src/homeassistant/homeassistant/helpers/service.py”, line 337, in _handle_service_platform_call
await getattr(entity, func)(**data)
File “/usr/src/homeassistant/homeassistant/components/envisalink/alarm_control_panel.py”, line 143, in async_alarm_arm_away
str(self._code), self._partition_number)
File “/usr/local/lib/python3.7/site-packages/pyenvisalink/alarm_panel.py”, line 238, in arm_away_partition
self._client.arm_away_partition(code, partitionNumber)
File “/usr/local/lib/python3.7/site-packages/pyenvisalink/dsc_client.py”, line 58, in arm_away_partition
self.send_command(evl_Commands[‘ArmAway’], str(partitionNumber))
File “/usr/local/lib/python3.7/site-packages/pyenvisalink/dsc_client.py”, line 26, in send_command
self.send_data(to_send)
File “/usr/local/lib/python3.7/site-packages/pyenvisalink/envisalink_base_client.py”, line 102, in send_data
self._transport.write((data + ‘\r\n’).encode(‘ascii’))
File “uvloop/handles/stream.pyx”, line 671, in uvloop.loop.UVStream.write
File “uvloop/handles/handle.pyx”, line 159, in uvloop.loop.UVHandle._ensure_alive
RuntimeError: unable to perform operation on <TCPTransport closed=True reading=False 0x707ff030>; the handler is closed

Hi, same problem here after upgrading HA from 0.92 to 0.95.4 (RuntimeError: unable to perform operation on <TCPTransport closed=True reading=False 0x707ff030>; the handler is closed)

Double checked config, several restarts, problem persists. No connection to envisalink.

Today I noticed i was running old Hassio (not sure about version) on RPi3, so I click UPDATE button in Hass.io / System.

Host OS updated to HassOS 2.12 and everything back to normal, envisalink stable :grinning::+1::+1::+1:

So I recently played around with OpenHAB2 and, it can connect to my DSCServer without any issues and turn my alarm on and off. My Vera controller can also connect to the DSC Server without an issue. When I try to connect Home Assistant to the DSCServer, the system just hangs and never comes back. If I set HA to point to a different IP address (setting the HA to point to incorrect Envisalink IP on purpose), HA gives up and continues to load HA UI. So there is definitely something up with the HA implementation for the communication, it is like it initiates communication and just waits constantly to hear back. I am probably going to use OpenHAB2 for just the Alarm system and bridge it to Siri (that was my original goal in the first place) until something changes with the DSC implementation for HA. I wish I knew how to code properly to help fix this or get more debug logs.

Sorry to hear that tubo97se. I’m not sure what else to try as I’ve mentioned that I use HA with a dscserver and it always connects. Now, HA does randomly loose connection to the dscserver and I have to restart HA to get it to reconnect, but it is always able to reconnect. I believe you mentioned that you were running the java dscserver. That is really the only difference I can see between your setup and mine as my dscserver is running on an old android which is connected to an EVL3 and a DSC 1832 panel. Maybe try connecting HA directly to the EVL temporarily to troubleshoot. At least that would eliminate one of the variables in your setup even if thats not the way you want it running long term.

Thank you for the regular feedback on what to try. I did recently change some things in my setup:

  1. Migrated HA from Raspberry Pi 3b+ to Mac Mini in Virtualbox
  2. Migrated DSC Server to Docker running on Mac Mini

Here is what I observed:

  1. I did bypass the DSC Server and connect directly to the Envisalink. Raspberry Pi connected very infrequently … not reliable at all, even using a quick command line stop and start.
  2. After moving to Mac Mini running HA in Virtualbox, HA does not connect to Envisalink on a fresh boot. If I restart via HA UI, then it connects almost every time. If I try to connect to the DSC Server, it hangs and I never get the UI. If I point HA to a random, IP address, it just gives up and I can still get to the UI. So there is definitely something with the initial handshaking between the DSC Server and HA that is causing a hang. I wish I could narrow it down more. I am running DSC Link server 1.3.4. I have run it with both Vera and OpenHab2 with no issues. I want to continue with HA if possible … OpenHab2 is decent …I like many aspects of OpenHab2, but the implementation is quite a steep learning curve.

Cheers

For anyone having envisalink troubles since 0.98.x, there is an open issue on it - https://github.com/home-assistant/home-assistant/issues/26438

For what it’s worth, I’m running 98.3 and am not having any problems with the Envisalink component starting. Best of luck tracking it down.

Good to know. A couple of people on the 0.98 release notes discussion have reported issues as well. Are you running an EVL3 or 4? And are you running hassio on a Pi? Just wondering what might be different about a working setup.

I’m on 98.2 and Yesterday I had to restart Home Assistant a second time to get the Envisalink component working.

I have an EVL-4. HASSIO .98.3 installed on RasPi3B+. Both connected by Ethernet directly to router. The update to .98.3 was about 48 hours ago. No errors related to Envisalink or DSC in log, and all security/communications are working fine.

BTW -I see a 98.4 update was just released, but not seeing release notes for it yet.