Qolsys IQ Panel 2 and 3rd party integration

Is there a way to schedule an Appdaemon restart every day, or every few hours?

Restarting AppDaemon on a schedule is a band-aid, and band-aids are rarely a good idea. If you pay attention to the issue at hand, youā€™d realize that will only continue their problem because the panel triggers iptables throttling after too many reconnects. Restarting AppDaemon on a schedule will guarantee this problem stays around forever!

superpaul, you should post your logs here, and get help that way. We canā€™t assist without some concrete information to look at. I think you may need to activate a higher logging level. Then, check the HA Core logs and post that too.

I also suggest you donā€™t try to go BACKWARDS in time and re-question territory thatā€™s already been dealt with by much more knowledgeable people. The panel throttles connections after a while. Fact. They looked at the driver code. I think you need to re-read my previous post again, because you are experiencing TWO failures: one of them is then AppDaemon itself craps the bed, which can be solves by a restart. HOWEVER - from a totally separate angle, after too many of these, the panel will start to throttle. From your end-user perspective, it might be hard to tell the difference between these two events because they both result in ā€œUnavailableā€ entities as far as youā€™re concerned. But if you want to solve this problem you will need to stop handwaving things like that away.

For me, restarting HA can trigger the AppDaemon freeze. Restarting AppDaemon usually fixes it. HOWEVER - after some time, those AppDaemon restarts stop working. THIS is when the panel is throttling, and when I have to reboot the panel. After a panel reboot, and one more AppDaemon reboot, Iā€™m all good (because now the throttling has been reset).

And just to re-iterate, if it were the addon, I wouldnā€™t have had it working for so long :slight_smile:

Thereā€™s got to be some way around this - unless you think Control4 users are having these issues too with their native Qolsys integration

@amirite: With all due respect, Iā€™m not handwaving things away. Iā€™m working in order of things I know to be problematic. I donā€™t know (to your point) that Iā€™m being rate limited, but I think itā€™s irrelevant because restarting AppDaemon fixes my problem. Logically, it doesnā€™t make sense that if the panel is rate limiting the Qolsys AppDaemon app, restarting AppDaemon would magically bypass/reset that rate limit. Iā€™m happy to be corrected if somebody can explain that how such a thing would occur.

I respect that I could post logs and possibly get help that way. However, the main crux of my question: ā€œis anybody running this reliably without issueā€, seems to be a resounding ā€œnoā€. Multiple people are more or less saying they leave it running, and it stops working. What are they going to help me with, that they couldnā€™t help themselves with?

Itā€™s not my intent to be combative here; we all want the same goal, ultimately. I think there are a lot of potential variations with respect to how each person has their environment setup, which is going to make any support challenging. Iā€™m not trying to re-litigate this entire thread. Iā€™m merely asking if those issues are still present, and I have my answer. I appreciate your help and feedback.

Thatā€™s fair, but I donā€™t really think itā€™s the case that most people are having the hangs. Iā€™m running this reliably without issue. Others are as well. You should still post your logs. There are always root causes to these problems and that would really help to find whatever you guys are experiencing. More heads are better than one, and thereā€™s simply no way to help you without seeing what youā€™re seeing. Basic system specs would help as well.

I can only suggest that the best place to look would be with the differences between HassOS and a regular Docker install. If you know what youā€™re doing it theoretically shouldnā€™t be very different, but Iā€™m guessing this difference is producing some kind of difference in your setup thatā€™s causing the AppDaemon hang.

BTW I donā€™t think auto-restarting AppDaemon is the answer. I donā€™t assume Qolsys is the only thing running on AppDaemon and restarting the whole server can bonker other apps running.

1 Like

Looks like there is a pretty serious bug in the socket implementation. You canā€™t just use recv(8192) (or whatever number of bytes) and expect to get a complete and parsable JSON. recv() just returns the max number of bytes that you specify.

Iā€™ve seen this issue in at least some of the logs that are posted in this thread (e.g @painkiller). It usually manifests itself when you see the ā€œnon json dataā€ log message. This will prevent auto discovery from happened when the first INFO request is published. So when zone events come from the panel they will also fail and youā€™ll see that in the stack trace because there is an expectation that the Zone exists.

You need to continuously loop until you have the complete message. In this case there is a new line that can be used as a delimiter.

Iā€™m not a python developer and I no longer code day to day so rather than submit a pull request hereā€™s the re-written listen function from the qolsys_socket.py that solves this problem for me. With that being said, all my binary sensors are showing up as ā€œUnavailableā€ but not sure if itā€™s related to this fix or not. Restarting everything seems to have solved that Unavailable problem.

    def listen(self, cb: callable):
        #listening = True
        self.app.log("starting listen", level="INFO")
        data = ""
        #err = ""
        buffer = b''
        while not (self._wrappedSocket._connected):
            self.app.log("not connected yet", level="WARNING")
            self.app.log(self._wrappedSocket._connected, level="INFO")
            time.sleep(1)
        try:
            while self._wrappedSocket._connected and self.__listening__:
                while b'\n' not in buffer:
                    self.app.log("Buffer: %s", buffer, level="DEBUG")
                    received = self._wrappedSocket.recv(4096)
                    self.app.log("Received: %s", received, level="DEBUG")
                    buffer += received
                line,sep,buffer = buffer.partition(b'\n')
                self.app.log("Line: %s", line, level="DEBUG")
                data = line.decode()
                if len(data) > 0:
                    self.app.log("data received from qolsys panel: %s len(data): %s", data, len(data), level="DEBUG")
                    if is_json(data):
                        try:
                            cb(data)
                        except:
                            self.app.log("Error calling callback: %s", cb, sys.exc_info(), level="ERROR")
                    else:
                        if data != 'ACK\n':
                            pass
                        self.app.log("non json data: %s", data, level="DEBUG")
                else:
                    self.app.log("No data received.  Bad token?  Detatching.", level="ERROR")
                    self._wrappedSocket.detach()
                    raise NoDataError
            self.app.log("stopped listening on qolsys socket", level="INFO")
        except socket.timeout:
            self.app.log("socket timeout", level="WARNING")
        except NoDataError:
            self._reset_socket()
            # raise NoDataError
        except TimeoutError:
            self.app.log("qolsys socket TimeoutError: %s", sys.exc_info(), level="ERROR")
            self._reset_socket
            # raise NoDataError
        except:
            self.app.log("listen failed/stopped: %s", sys.exc_info()[2].extract_stack(), level="ERROR")
5 Likes

Hi,

I have an alarm system setup through Telus(Canadian provider) that uses QolSys hardware. For some reason the panel that Iā€™m using does not have that "3rd Party Connectionsā€™ menu that would provide that token. I guess itā€™s been removed by Telus.

Is there anyway to still connect to the Qolsys panel without the token?

Are you using the dealer code ? What do you see when you go to the wifi devices menu ?

I stayed away from TELUS ā€œSmartā€ Security for this reason. They lock the panel down and you have no access. I went with a local company out of Edmonton and was given the dealer code for full access to the panel and settings.

Iā€™m using the master code. Iā€™m not sure what the dealer code is. I supposed I could call Telus and see if they would be willing to give that to me.

There isnt any Wifi Devices option either. I see bluetooth devices, z wave devices, and iq remote devices.

You could try 1111, 1234, 0000. The dealer code (installer code) will be different from the master.

The default dealer code is 2222. So you could give that a try.

Ah 1111 ended up working. Thanks guys!

1 Like

Sorry if this has been asked before but is there anyway to also lock/unlock doors that are connected to the panel?

I have them showing up as binary sensors but it only lets me know if the door is open or closed.

No, youā€™ll have to pair those directly to Home Assistant with a Z-Wave stick or hub, or try your luck pairing a z-wave stick as a secondary hub to your panel once S2 support rolls into HASS from ZWaveJS (no idea if secondary hubs actually work properly in HASS)

My security company is replacing an HAI system (which is integrated with HA) with a qolsys 4. Is it going to be possible to replicate functionality (real-time status and control of devices) using HA? The panel will be talking to alarm.com but I also need a way to monitor and control locally. I have looked at this integration: https://github.com/roopesh/ad-qolsys but I am still not clear what is or is not doable.

@ihf1 I canā€™t speak to a Qolsys 4. This was written for a Qolsys IQ 2 Panel. It might work for a Qolsys 4 - youā€™d have to experiment it.

And please see above threads regarding concerns around stability. Itā€™s working for most people but does have some occasional glitches and hang-ups. If youā€™re counting on it for your businessā€¦ donā€™t blame me if you run into issues :slight_smile: .

Thanks. Yes the qolsys 4 is new and I havenā€™t even seen it yet. With regard to the Qolsys 2, will this code permit reall-time (local) monitoring and control of whatever the qolsys connects to?

Since you donā€™t want to submit a pull request, maybe it would be helpful to submit an issue? That way your fix doesnā€™t get buried in this long thread

1 Like