Qolsys IQ Panel 2 and 3rd party integration

Did anyone ever figure out how to utilize the IQ2 motion sensor / camera via the integration?

Hi guys, new to this integration. I tried to get this set up last night, and ran into some problems. I wanted to see if anyone here has encountered something like this.

My AppDaemon apps.yaml:

qolsys_panel:
  module: qolsys_client
  class: QolsysClient
  mqtt_namespace: mqtt
  qolsys_host: REDACTED
  qolsys_token: REDACTED
  request_topic: qolsys/requests # Optional
  qolsys_info_topic: qolsys/panel/info # Optional
  qolsys_zone_update_topic: qolsys/panel/zone_update # Optional
  qolsys_zone_event_topic: qolsys/panel/zone_event # Optional
  qolsys_alarming_event_topic: qolsys/panel/alarming # Optional
  qolsys_disarming_event_topic: qolsys/panel/disarm # Optional
  qolsys_confirm_arm_code: False # Optional
  qolsys_confirm_disarm_code: False # Optional
  qolsys_arm_away_always_instant: False # Optional
  homeassistant_mqtt_discovery_topic: homeassistant/

And my appdaemon.yaml:

secrets: /config/secrets.yaml
appdaemon:
  latitude: REDACTED
  longitude: REDACTED
  elevation: REDACTED
  time_zone: REDACTED
  plugins:
    HASS:
      type: hass
    MQTT:
      type: mqtt
      namespace: mqtt #you will need this namespace name in your apps.yaml
      # The IP Address or hostname of your MQTT broker.
      client_host: REDACTED
      client_port: 1883
      client_user: homeassistant
      client_password: REDACTED
http:
  url: http://127.0.0.1:5050
admin:
api:
hadashboard:

When I start AppDaemon, I see the following in the log:

-----------------------------------------------------------
 Add-on: AppDaemon 4
 Python Apps and Dashboard using AppDaemon 4.x for Home Assistant
-----------------------------------------------------------
 Add-on version: 0.7.0
 You are running the latest version of this add-on.
 System: Debian GNU/Linux 11 (bullseye)  (amd64 / qemux86-64)
 Home Assistant Core: 2021.8.7
 Home Assistant Supervisor: 2021.09.6
-----------------------------------------------------------
 Please, share the above information when looking for help
 or support in, e.g., GitHub, forums or the Discord chat.
-----------------------------------------------------------
[cont-init.d] 00-banner.sh: exited 0.
[cont-init.d] 01-log-level.sh: executing... 
[cont-init.d] 01-log-level.sh: exited 0.
[cont-init.d] appdaemon.sh: executing... 
[cont-init.d] appdaemon.sh: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
[22:29:08] INFO: Starting AppDaemon...
2021-09-29 22:29:09.149087 INFO AppDaemon: AppDaemon Version 4.1.0 starting
2021-09-29 22:29:09.149235 INFO AppDaemon: Python version is 3.9.5
2021-09-29 22:29:09.149332 INFO AppDaemon: Configuration read from: /config/appdaemon/appdaemon.yaml
2021-09-29 22:29:09.149441 INFO AppDaemon: Added log: AppDaemon
2021-09-29 22:29:09.149575 INFO AppDaemon: Added log: Error
2021-09-29 22:29:09.149667 INFO AppDaemon: Added log: Access
2021-09-29 22:29:09.149759 INFO AppDaemon: Added log: Diag
2021-09-29 22:29:09.161093 INFO AppDaemon: Loading Plugin HASS using class HassPlugin from module hassplugin
2021-09-29 22:29:09.180719 INFO HASS: HASS Plugin Initializing
2021-09-29 22:29:09.180871 INFO HASS: HASS Plugin initialization complete
2021-09-29 22:29:09.181078 INFO AppDaemon: Loading Plugin MQTT using class MqttPlugin from module mqttplugin
2021-09-29 22:29:09.185219 INFO MQTT: MQTT Plugin Initializing
2021-09-29 22:29:09.185345 INFO MQTT: Using 'mqtt-client/status' as Will Topic
2021-09-29 22:29:09.185462 INFO MQTT: Using 'mqtt-client/status' as Birth Topic
2021-09-29 22:29:09.185588 INFO MQTT: Using appdaemon_mqtt_client as Client ID
2021-09-29 22:29:09.186034 INFO AppDaemon: Initializing HTTP
2021-09-29 22:29:09.186246 INFO AppDaemon: Using 'ws' for event stream
2021-09-29 22:29:09.188255 INFO AppDaemon: Starting API
2021-09-29 22:29:09.190447 INFO AppDaemon: Starting Old Admin Interface
2021-09-29 22:29:09.190703 INFO AppDaemon: Starting Dashboards
2021-09-29 22:29:09.202985 INFO HASS: Connected to Home Assistant 2021.8.7
2021-09-29 22:29:09.206767 INFO MQTT: Connected to Broker at URL REDACTED:1883
2021-09-29 22:29:09.213701 INFO AppDaemon: Got initial state from namespace mqtt
2021-09-29 22:29:09.213899 INFO MQTT: MQTT Plugin initialization complete
2021-09-29 22:29:09.215313 INFO AppDaemon: App 'qolsys_panel' added
2021-09-29 22:29:09.215777 INFO AppDaemon: Found 1 total apps
2021-09-29 22:29:09.216016 INFO AppDaemon: Starting Apps with 1 workers and 1 pins
2021-09-29 22:29:09.216519 INFO AppDaemon: Running on port 5050
2021-09-29 22:29:09.246896 INFO HASS: Evaluating startup conditions
2021-09-29 22:29:09.254619 INFO HASS: Startup condition met: hass state=RUNNING
2021-09-29 22:29:09.254826 INFO HASS: All startup conditions met
2021-09-29 22:29:09.266776 INFO AppDaemon: Got initial state from namespace default
2021-09-29 22:29:11.221233 INFO AppDaemon: Scheduler running in realtime
2021-09-29 22:29:11.224727 INFO AppDaemon: Adding /config/appdaemon/apps to module import path
2021-09-29 22:29:11.225184 INFO AppDaemon: Adding /config/appdaemon/apps/ad-qolsys to module import path
2021-09-29 22:29:11.232683 WARNING AppDaemon: No app description found for: /config/appdaemon/apps/hello.py - ignoring
2021-09-29 22:29:11.233824 WARNING AppDaemon: No app description found for: /config/appdaemon/apps/ad-qolsys/door_window.py - ignoring
2021-09-29 22:29:11.234942 WARNING AppDaemon: No app description found for: /config/appdaemon/apps/ad-qolsys/qolsys_socket.py - ignoring
2021-09-29 22:29:11.235989 WARNING AppDaemon: No app description found for: /config/appdaemon/apps/ad-qolsys/qolsys_requests.py - ignoring
2021-09-29 22:29:11.237054 INFO AppDaemon: Loading App Module: /config/appdaemon/apps/ad-qolsys/qolsys_client.py
2021-09-29 22:29:11.247390 WARNING AppDaemon: No app description found for: /config/appdaemon/apps/ad-qolsys/partition.py - ignoring
2021-09-29 22:29:11.248318 INFO AppDaemon: Initializing app qolsys_panel using class QolsysClient from module qolsys_client
2021-09-29 22:29:11.338711 INFO qolsys_panel: Creating qolsys_socket
2021-09-29 22:29:11.339595 INFO qolsys_panel: wrapping socket
2021-09-29 22:29:11.341740 INFO qolsys_panel: connecting to socket
2021-09-30 08:30:47.256521 INFO AppDaemon: New client Admin Client connected

When I look in my MQTT broker (I’m using Mosquitto broker), I see the following:

1632957197: Saving in-memory database to /data/mosquitto.db.
1632957335: Socket error on client 68mLtv5ZuFjrKToJgf6gTt, disconnecting.
1632957342: New connection from REDACTED  on port 1883.
1632957342: New client connected from REDACTED  as 4XVnPnFoiqsD0nmzQGQLS7 (p2, c1, k60, u'homeassistant').
1632957528: Socket error on client 4XVnPnFoiqsD0nmzQGQLS7, disconnecting.
1632957535: New connection from REDACTED  on port 1883.
1632957535: New client connected from REDACTED  as 667wnOxBd8A8IgpQzbXvM0 (p2, c1, k60, u'homeassistant').
1632958221: Socket error on client 667wnOxBd8A8IgpQzbXvM0, disconnecting.
1632958228: New connection from REDACTED  on port 1883.
1632958228: New client connected from REDACTED  as 1OnlKZexFAfg3tZfOg1Mcu (p2, c1, k60, u'homeassistant').
1632958998: Saving in-memory database to /data/mosquitto.db.
1632960799: Saving in-memory database to /data/mosquitto.db.
1632962600: Saving in-memory database to /data/mosquitto.db.
1632964401: Saving in-memory database to /data/mosquitto.db.
1632965444: New connection from REDACTED  on port 1883.
1632965444: New client connected from REDACTED  as appdaemon_mqtt_client (p2, c1, k60).
1632965717: Client appdaemon_mqtt_client disconnected.
1632965730: New connection from REDACTED on port 1883.
1632965730: New client connected from REDACTED  as appdaemon_mqtt_client (p2, c1, k60).
1632966202: Saving in-memory database to /data/mosquitto.db.
1632966554: New connection from REDACTED  on port 1883.
1632966554: Client <unknown> disconnected due to protocol error.
1632966554: New connection from REDACTED  on port 1883.
1632966554: Client <unknown> disconnected due to protocol error.
1632966554: New connection from REDACTED  on port 1883.
1632966554: Client <unknown> disconnected due to protocol error.
1632966554: New connection from REDACTED on port 1883.
1632966554: Client <unknown> disconnected due to protocol error.
1632966554: New connection from REDACTED  on port 1883.
1632966554: Client <unknown> disconnected due to protocol error.
1632966554: New connection from REDACTED on port 1883.
1632966554: Client <unknown> disconnected due to protocol error.
1632966554: New connection from REDACTED  on port 1883.
1632966554: Client <unknown> disconnected due to protocol error.
1632966554: New connection from REDACTED  on port 1883.
1632966554: Client <unknown> disconnected due to protocol error.
1632966554: New connection from REDACTED  on port 1883.
1632966554: Client <unknown> disconnected due to protocol error.
1632966554: New connection from REDACTED  on port 1883.
1632966554: Client <unknown> disconnected due to protocol error.
1632966961: Client appdaemon_mqtt_client disconnected.
1632966973: New connection from REDACTED  on port 1883.
1632966973: New client connected from REDACTED  as appdaemon_mqtt_client (p2, c1, k60).
1632968003: Saving in-memory database to /data/mosquitto.db.
1632968045: Client appdaemon_mqtt_client disconnected.
1632968211: New connection from REDACTED on port 1883.
1632968211: New client connected from REDACTED  as appdaemon_mqtt_client (p2, c1, k60).
1632968936: Client appdaemon_mqtt_client disconnected.
1632968949: New connection from REDACTED  on port 1883.
1632968949: New client connected from REDACTED  as appdaemon_mqtt_client (p2, c1, k60, u'homeassistant').
1632969804: Saving in-memory database to /data/mosquitto.db.

I don’t see any of the devices connected to the panel in HA, nor do I see the panel in HA. I’m not sure what’s going wrong here, and any advice would be appreciated.

It’s not connecting to your panel. Are you sure you enabled 3rd party integration on the panel? Try rebooting the panel then restarting AppDaemon. Also make sure the qolsys_host and qolsys_token are correct.

I just got set up and also had problems with it connecting to my panel – even with 3rd party integration enabled and a reboot. For some reason, after disabling, re-enabling, & rebooting it connected.

Just set this up, but AppDaemon seems to run into a bug and reloads all the time. I’m using AppD only for this integration; removing apps.yaml stops it from crashing. I get the following tracebacks:

2021-10-07 18:36:08.901638 WARNING AppDaemon: apps.yaml in the Config directory is deprecated. Please move apps.yaml to the apps directory.
2021-10-07 18:36:08.902520 WARNING AppDaemon: ------------------------------------------------------------
2021-10-07 18:36:08.904493 WARNING AppDaemon: Unexpected error:
2021-10-07 18:36:08.905347 WARNING AppDaemon: ------------------------------------------------------------
2021-10-07 18:36:08.912448 INFO MQTT: Connected to Broker at URL x.x.x.x:1883
2021-10-07 18:36:08.917139 WARNING AppDaemon: Traceback (most recent call last):
  File "/usr/lib/python3.9/site-packages/appdaemon/app_management.py", line 585, in check_config
    new_config = await self.read_config()
  File "/usr/lib/python3.9/site-packages/appdaemon/app_management.py", line 463, in read_config
    await self.check_sequence_update(new_config.get("sequence", {}))
AttributeError: 'coroutine' object has no attribute 'get'

2021-10-07 18:36:08.919132 WARNING AppDaemon: ------------------------------------------------------------
/usr/lib/python3.9/site-packages/appdaemon/app_management.py:713: RuntimeWarning: coroutine 'run_in_executor' was never awaited
  self.logger.warning("-" * 60)
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
2021-10-07 18:36:08.932287 WARNING AppDaemon: ------------------------------------------------------------
2021-10-07 18:36:08.933208 WARNING AppDaemon: Unexpected error during run()
2021-10-07 18:36:08.934011 WARNING AppDaemon: ------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python3.9/site-packages/appdaemon/__main__.py", line 154, in run
    loop.run_until_complete(asyncio.gather(*pending))
  File "/usr/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
    return future.result()
  File "/usr/lib/python3.9/site-packages/appdaemon/utility_loop.py", line 53, in loop
    await self.AD.threading.create_initial_threads()
  File "/usr/lib/python3.9/site-packages/appdaemon/threading.py", line 121, in create_initial_threads
    self.total_threads = int(apps["active"])
TypeError: 'NoneType' object is not subscriptable
2021-10-07 18:36:08.944398 INFO AppDaemon: Previous message repeated 1 times
2021-10-07 18:36:08.945214 INFO AppDaemon: AppDaemon Exited

And it keeps restarting.

appdaemon.yaml:

secrets: /config/secrets.yaml
appdaemon:
  latitude: ...
  longitude: ...
  elevation: ...
  time_zone: ...
  plugins:
    HASS:
      type: hass
    MQTT:
      type: mqtt
      namespace: mqtt
      client_host: x.x.x.x
      client_port: 1883
      client_id: appdaemon
      client_user: appdaemon
      client_password: !secret mqtt_password
      birth_topic: appdaemon/status
      will_topic: appdaemon/status

http:
  url: https://127.0.0.1:5050
  password: !secret ad_password
  dash_ssl_certifiacate: /ssl/fullchain.pem
  dash_ssl_key: /ssl/privkey.pem

admin:

api:

hadashboard:

apps.yaml:

qolsys_panel:
  module: qolsys_client
  class: QolsysClient
  mqtt_namespace: mqtt
  qolsys_host: x.x.x.x
  qolsys_token: xxxxxx
  request_topic: qolsys/requests # Optional
  qolsys_info_topic: qolsys/panel/info # Optional
  qolsys_zone_update_topic: qolsys/panel/zone_update # Optional
  qolsys_zone_event_topic: qolsys/panel/zone_event # Optional
  qolsys_alarming_event_topic: qolsys/panel/alarming # Optional
  qolsys_disarming_event_topic: qolsys/panel/disarm # Optional
  qolsys_confirm_arm_code: False # Optional
  qolsys_confirm_disarm_code: False # Optional
  qolsys_arm_away_always_instant: False # Optional
  homeassistant_mqtt_discovery_topic: homeassistant/

Any ideas?

I’ve noticed that there is quite a bit of dead or unused code in the integration and that not using the defaults and overriding them in the appdaemon.yaml file seems to have unexpected results. So my suggestion is to just override the bare minimum config values and leave the others alone. For example, the following don’t seem to be necessary:

  • client_id
  • birth_topic
  • will_topic

I also suggest not using https until you have everything working so that you are not debugging multiple issues at once. Only url seems to be necessary in http:

In apps.yaml I suggest leaving the hello world app in there (for now). So for example, my apps.yaml looks like this:

hello_world:
  module: hello
  class: HelloWorld

qolsys_panel:
  module: qolsys_client
  class: QolsysClient
  mqtt_namespace: mqtt
  qolsys_host: x.x.x.x
  qolsys_token: xxxxxx
  request_topic: qolsys/requests # Optional
  qolsys_info_topic: qolsys/info # Optional
  qolsys_zone_event_topic: qolsys/zone_event # Optional
  qolsys_alarming_event_topic: qolsys/alarming # Optional
  qolsys_disarming_event_topic: qolsys/disarm # Optional
  qolsys_confirm_disarm_code: True
  qolsys_confirm_arm_code: True
  log_level: DEBUG

Also, apps.yaml should be in the apps directory (/config/appdaemon/apps/apps.yaml)

Make sure that you have mqtt working correctly. You can test it by going into the Configuration for the MQTT Broker Integration and listening to # while publish whatever message you want. Be sure to re-configure the broker so that you can enter the right username, password, etc

Also important to make sure that the panel is communicating. It’s very sensitive about new connections and will lock you out if you are not careful(for example - if you are constantly restarting AppDaemon). Here’s the easiest way to test:

openssl s_client -host xxx.xxx.xxx.xxx -port 12345

Finally, there are some changes you need to make to mqtt configuration to get password authentication to work. Assuming that you are using the mosquito broker add-on, you should have

customize:
  active: false

true will create ACL issues. Also be sure that you have a login section populated in the mqtt configuration like:

logins:
  - username: xxxxx
    password: xxxx

There are a couple of key points about setting up MQTT on this post: Qolsys IQ Panel 2 and 3rd party integration - #285 by DDragon and this link on that post: https://github.com/home-assistant/addons/blob/e933cba5a457a492fec458dcb2629e9dbadeb569/mosquitto/DOCS.md#access-control-lists-acls

I’ve been busting my head for months trying to get this to work…and adding the code you provided finally got discovery to work for me. I think your point about max number of bytes set is dead on…in my case I have a Hardware translator which I think increases the amount of information that get’s sent in that initial payload request…thank you so much for posting! @crazeeeyez you should really consider adding this implementation of the listen socket…it solved my problem right away.

As @big.server mentioned devices were offline at first, but restart brought them back online. I will watch this for the next couple of days and report back if there are any issues. Thanks to all of you for posting your experiences and challenges these last couple of months…I finally had some extra time to jump back on this and glad that it appears to be working.

@amirite, can you elaborate on the setup with the Fire HD 8? Are you mirroring the qolsys panel like that they currently do with the optional secondary screen or something else entirely? Thanks for sharing.

I’m happy to accept tested pull requests :slight_smile: . Unfortunately I’ve got a day (and feels like night) job too. Maybe if I got Hacktoberfest fake internet credits for this I would be more motivated :upside_down_face: .

I will look into that implementation. TBH I am not even close to familiar to the socket implementation. @mzac that original python script you wrote is still at the core of the socket connection. What do you think of @big.server 's rewrite? Qolsys IQ Panel 2 and 3rd party integration - #340 by big.server

I’ve got some time in the next week or so and I’ll put together a pull request. I have been testing my changes since my post and I haven’t run into any issues at all related to it. If there are unit or other tests I’ll also make sure to add my own. I appreciate the work others have put into the integration and I’m happy to contribute.

2 Likes

No, I’m just using the FireHD 8 to display a lovelace dashboard like everyone else does. Through this plugin I have the Alarm card on this dashboard and I control the alarm system and view the contact sensors exclusively through HA.

I’ve moved the Qolsys panel down to my basement now where the siren can still be heard, but it’s otherwise never seen.

@crazeeeyez I looked quickly but it is unfortunately beyond my comprehension of how this all works. I’ll leave it up to the others in this thread who understand better than me.

I can’t find the Ad-qolsys in Hacs and I tried to add repo but I get an error repo to add I get an error about repo structure not compliant for 1.8.1.

Make sure you’re looking under Automation and choosing AppDaemon.

Thanks I’m new to appdaemon and didn’t know I had to turn a new section of HACS got it now thanks.

So I got everything install, got everything added to appdaemon and restarted. I can see alarm panel app in appdaemon what else do I need to do to get it to show up in Home assistant

@andrewblack Add an alarm card to a dashboard Alarm Panel Card - Home Assistant

I suggest checking that the binary sensors have been created and that you are getting INFO and DEBUG messages in the AppDaemon log about sensor state. For example:

2021-10-14 15:21:17.922793 INFO qolsys_panel: Publishing to: mqtt-states/binary_sensor/test/state, Payload: Open

I’m getting closer lol but still have something wrong. I"m taking notes and want to write up a some more detailed instructions for other people. Here is my error log

2021-10-15 05:26:07.080609 INFO AppDaemon: App initialization complete
2021-10-15 05:26:07.063778 INFO qolsys_panel: listner for triggered (ALARM) topic: qolsys/alarm/triggered
2021-10-15 05:26:07.044907 INFO qolsys_panel: listener for arming topic: qolsys/panel/alarming
2021-10-15 05:26:07.008974 INFO qolsys_panel: listener for zone update topic: qolsys/panel/zone_update
2021-10-15 05:26:07.000247 INFO qolsys_panel: listener for zone event topic: qolsys/panel/zone_event
2021-10-15 05:26:06.992027 INFO qolsys_panel: listener for info topic: qolsys/panel/info
2021-10-15 05:26:06.978636 WARNING AppDaemon: Unknown namespace (mqtt) in call_service from qolsys_panel
2021-10-15 05:26:06.975107 INFO qolsys_panel: listener for requests topic: qolsys/requests
2021-10-15 05:26:06.971863 INFO qolsys_panel: QolSys Socket Created
2021-10-15 05:26:06.968824 INFO qolsys_panel: started listener
2021-10-15 05:26:06.965551 INFO qolsys_panel: started listener thread
2021-10-15 05:26:06.963083 INFO qolsys_panel: starting listen
2021-10-15 05:26:06.962359 INFO qolsys_panel: Previous message repeated 1 times
2021-10-15 05:26:06.955628 INFO qolsys_panel: Starting listener thread
2021-10-15 05:26:06.952201 INFO qolsys_panel: Connected wrappedSocket: 
2021-10-15 05:26:01.593798 INFO qolsys_panel: connecting to socket
2021-10-15 05:26:01.586043 INFO qolsys_panel: wrapping socket
2021-10-15 05:26:01.582226 INFO qolsys_panel: Creating qolsys_socket
2021-10-15 05:26:01.568578 INFO hello_world: You are now ready to run Apps!
2021-10-15 05:26:01.565683 INFO hello_world: Hello from AppDaemon
2021-10-15 05:26:01.296943 INFO AppDaemon: Initializing app qolsys_panel using class QolsysClient from module qolsys_client
2021-10-15 05:26:01.275588 INFO AppDaemon: Initializing app hello_world using class HelloWorld from module hello
2021-10-15 05:26:01.245076 INFO AppDaemon: Loading App Module: /config/appdaemon/apps/ad-qolsys/qolsys_client.py
2021-10-15 05:26:01.236219 WARNING AppDaemon: No app description found for: /config/appdaemon/apps/ad-qolsys/qolsys_requests.py - ignoring
2021-10-15 05:26:01.230553 WARNING AppDaemon: No app description found for: /config/appdaemon/apps/ad-qolsys/door_window.py - ignoring
2021-10-15 05:26:01.225314 WARNING AppDaemon: No app description found for: /config/appdaemon/apps/ad-qolsys/partition.py - ignoring
2021-10-15 05:26:01.213511 WARNING AppDaemon: No app description found for: /config/appdaemon/apps/ad-qolsys/qolsys_socket.py - ignoring
2021-10-15 05:26:01.175321 INFO AppDaemon: Loading App Module: /config/appdaemon/apps/hello.py
2021-10-15 05:26:01.132515 INFO AppDaemon: Adding /config/appdaemon/apps/ad-qolsys to module import path
2021-10-15 05:26:01.131062 INFO AppDaemon: Adding /config/appdaemon/apps to module import path
2021-10-15 05:26:01.091439 INFO AppDaemon: Scheduler running in realtime