I’ve noticed that too. If I restart HA, it does require me to frequently restart appdaemon. And it does seem like when restarting appdaemon it doesn’t close the connection to the panel, and after so many restarts of appdaemon, the panel stops responding to connections until it’s restarted.
I have noticed that restarting Home Assistant still messes with the AppDaemon side of things, but I’m not having as much trouble with the panel like I used to. It seems a simple restart of AppDaemon now is all that is needed.
Chasing down a new issue with the benefit of cleaned up logging. Today I left the house and the INFO event was polling the panel for awhile. Then it stopped about an hour before I returned home and nothing new showed up until I returned and the disarm event was sent, generating an error:
2021-06-07 20:42:30.143083 ERROR qolsys_panel: listen failed/stopped: (, OSError(22, 'Invalid argument'), )
2021-06-07 20:42:30.119557 INFO qolsys_panel: armString: {'partition_id': '0', 'action': 'ARMING', 'arming_type': 'DISARM', 'version': 0, 'nonce': 'qolsys', 'source': 'C4', 'version_key': 1, 'source_key': 'C4', 'token': '******', 'usercode': '****'}
2021-06-07 20:42:30.118146 INFO qolsys_panel: event: DISARM, usercode: ****, partition_id: 0, arm_type: None, instant: False
2021-06-07 20:42:30.116771 INFO qolsys_panel: event: DISARM
2021-06-07 19:37:41.195624 INFO qolsys_panel: Publishing to: mqtt-states/binary_sensor/door_window_8/state, Payload: Closed
2021-06-07 19:37:41.177210 INFO qolsys_panel: publishing ZONE_EVENT event to: qolsys/panel/zone_event
2021-06-07 19:37:21.519306 INFO qolsys_panel: Publishing to: mqtt-states/binary_sensor/door_window_8/state, Payload: Closed
2021-06-07 19:37:21.466742 INFO qolsys_panel: publishing ZONE_EVENT event to: qolsys/panel/zone_event
2021-06-07 19:35:37.068274 INFO qolsys_panel: Publishing to: mqtt-states/binary_sensor/rear_door/state, Payload: Closed
2021-06-07 19:35:37.048058 INFO qolsys_panel: publishing ZONE_EVENT event to: qolsys/panel/zone_event
2021-06-07 19:35:17.450713 INFO qolsys_panel: Publishing to: mqtt-states/binary_sensor/rear_door/state, Payload: Closed
2021-06-07 19:35:17.418301 INFO qolsys_panel: publishing ZONE_EVENT event to: qolsys/panel/zone_event
2021-06-07 19:29:53.642583 INFO qolsys_panel: Publishing to: mqtt-states/binary_sensor/door_window_21/state, Payload: Closed
2021-06-07 19:29:53.591962 INFO qolsys_panel: publishing ZONE_EVENT event to: qolsys/panel/zone_event
2021-06-07 19:29:33.915866 INFO qolsys_panel: Publishing to: mqtt-states/binary_sensor/door_window_21/state, Payload: Closed
2021-06-07 19:29:33.897798 INFO qolsys_panel: publishing ZONE_EVENT event to: qolsys/panel/zone_event
Shortly after, another DISARM event was sent which generated a different error:
2021-06-07 20:45:10.542539 WARNING AppDaemon: Logged an error to /logs/error.log
2021-06-07 20:45:10.514752 INFO qolsys_panel: armString: {'partition_id': '0', 'action': 'ARMING', 'arming_type': 'DISARM', 'version': 0, 'nonce': 'qolsys', 'source': 'C4', 'version_key': 1, 'source_key': 'C4', 'token': '******', 'usercode': '****'}
2021-06-07 20:45:10.513346 INFO qolsys_panel: event: DISARM, usercode: ****, partition_id: 0, arm_type: None, instant: False
2021-06-07 20:45:10.511981 INFO qolsys_panel: event: DISARM
Jumping over to error.log we see:
2021-06-07 20:45:10.542148 WARNING qolsys_panel: ------------------------------------------------------------
NameError: name 'socket' is not defined
except socket.error:
File "/conf/apps/ad-qolsys/qolsys_requests.py", line 272, in __qolsys_arm__
self.__qolsys_arm__(qolsys=self.qolsys, token=token, arming_type="disarm", partition_id=partition_id, usercode=usercode)
File "/conf/apps/ad-qolsys/qolsys_requests.py", line 230, in mqtt_request_received
funcref(args["event"], data, self.AD.events.sanitize_event_kwargs(app, args["kwargs"]))
File "/usr/local/lib/python3.8/site-packages/appdaemon/threading.py", line 936, in worker
Traceback (most recent call last):
During handling of the above exception, another exception occurred:
BrokenPipeError: [Errno 32] Broken pipe
return self._sslobj.write(data)
File "/usr/local/lib/python3.8/ssl.py", line 1173, in send
self._wrappedSocket.send(b'\n')
File "/conf/apps/ad-qolsys/qolsys_socket.py", line 92, in send_to_socket
qolsys.send_to_socket(armString)
File "/conf/apps/ad-qolsys/qolsys_requests.py", line 271, in __qolsys_arm__
2021-06-07 20:45:10.541723 WARNING qolsys_panel: Traceback (most recent call last):
2021-06-07 20:45:10.516507 WARNING qolsys_panel: ------------------------------------------------------------
2021-06-07 20:45:10.516136 WARNING qolsys_panel: Worker Ags: {'id': '16150d44ac7b41f8bdf15ec581865811', 'name': 'qolsys_panel', 'objectid': 'd4658d34d4ae449499334aae060a4de5', 'type': 'event', 'event': 'MQTT_MESSAGE', 'function': >, 'data': {'topic': 'qolsys/requests', 'wildcard': '#', 'payload': '{"event":"DISARM", "usercode":"****", "token":"******", "partition_id":"0"}'}, 'pin_app': True, 'pin_thread': 0, 'kwargs': {'topic': 'qolsys/requests', '__thread_id': 'thread-0'}}
2021-06-07 20:45:10.515726 WARNING qolsys_panel: Unexpected error in worker for App qolsys_panel:
2021-06-07 20:45:10.515321 WARNING qolsys_panel: ------------------------------------------------------------
I’ll continue to look into this as I have time, but just posting it here in case anyone has any ideas. It seems like the socket is getting randomly dropped maybe for some reason?
@SuperMega So it was polling successfully until the DISARM
event was published? Was the usercode and token valid? I know when there’s an invalid message sent, the socket goes wonky.
No, it stopped polling about an hour before the disarm event was sent. Yes the code was correct, since everything worked fine again after relaunching AppDaemon.
Even now the AppDaemon log has INFO events every few minutes non-stop. This seems to be the “healthy” state. Yesterday the INFO events stopped for some reason prior to the disarm event being sent. Unfortunately there wasn’t an error message or any other info about why the INFO events stopped in the log…
Managed to get everything set up for my panel, seems to be working. I cannot arm it however because some sensors need bypassed when arming. This is from the log:
2021-06-10 16:26:54.334113 INFO qolsys_panel: publishing ERROR event to:
2021-06-10 16:26:54.333431 ERROR qolsys_panel: ERROR event: {"event":"ERROR","partition_id":0,"error_type":"ARM_FAILED","description":"Zones not bypassed","version":1,"nonce":"qolsys","requestID":"49460038-a49f-4cde-b267-606904e5f159"}
2021-06-10 16:26:54.233353 INFO qolsys_panel: armString: {'partition_id': '0', 'action': 'ARMING', 'arming_type': 'ARM_AWAY', 'version': 0, 'nonce': 'qolsys', 'source': 'C4', 'version_key': 1, 'source_key': 'C4', 'token': '******'}
I was also wondering if it might be easy enough to get this to support multiple panels. We have nine in total and I’d love them all to be working off of this.
You have 9 panels on the same network??
There’s a setting on the panel itself to automatically bypass when arming. I don’t recall where it is… maybe you can find it on one of the nine panels
My first reaction was “uhhh I didn’t think about multiple panels when building this” but then I remembered it’s all in AppDaemon… so all you have to do is have multiple apps defined e.g.
qolsys_panel_1:
module: qolsys_client
class: QolsysClient
mqtt_namespace: mqtt <see below for my config>
qolsys_host: <your IP here>
qolsys_token: <your token here>
qolsys_port: 12345 # Optional
request_topic: qolsys/panel1/requests
qolsys_info_topic: qolsys/panel1/info
qolsys_zone_update_topic: qolsys/panel1/zone_update # Optional
qolsys_zone_event_topic: qolsys/panel1/zone_event # Optional
qolsys_alarming_event_topic: qolsys/panel1/alarming # Optional
qolsys_disarming_event_topic: qolsys/panel1/disarm # Optional
qolsys_disarm_code: 4567 # Optional - Required if you want to disarm the panel
qolsys_panel_2:
module: qolsys_client
class: QolsysClient
mqtt_namespace: mqtt <see below for my config>
qolsys_host: <your IP here>
qolsys_token: <your token here>
qolsys_port: 12345 # Optional
request_topic: qolsys/panel2/requests
qolsys_info_topic: qolsys/panel2/info
qolsys_zone_update_topic: qolsys/panel2/zone_update # Optional
qolsys_zone_event_topic: qolsys/panel2/zone_event # Optional
qolsys_alarming_event_topic: qolsys/panel2/alarming # Optional
qolsys_disarming_event_topic: qolsys/panel2/disarm # Optional
qolsys_disarm_code: 4567 # Optional - Required if you want to disarm the panel
...
Note the panel specific topics.
Disclaimer: I have not tried this and won’t be able to test it. But in my theory, it should work just peachy. You just have to make sure each and every panel-specific topic is defined.
I haven’t had any of the issues you described with the panel, logging, or disconnects. I wish I could help.
If I’m not mistaken, you can programmatically bypass during arming through the json commands. I could also see a need to not want it to automatically bypass them every time however have a need to bypass arm the system through HA.
I did find the auto bypass setting on the panel, that fixed it for me, thanks!
The nine panels are on site-to-site networks, so not on the same physical network, but they don’t know that. I’ll let you know how it goes when I get a chance to try that out, thank you!
@crazeeeyez
Is there a MQTT topic for when the panel’s alarm is actually triggered? I listened in on the alarming topic and it didn’t seem to report when the alarm sounded.
I added in a second panel. The logs seem to show it communicating with AppDaemon, but the dashboard only shows 1 partition and the 2nd panel’s sensors are unavailable.
2021-06-11 10:54:52.609311 INFO qolsys_panel_1: publishing ZONE_EVENT event to: qolsys/panel1/zone_event
2021-06-11 10:54:52.706595 INFO qolsys_panel_2: publishing ZONE_EVENT event to: qolsys/panel2/zone_event
2021-06-11 10:54:52.774243 INFO qolsys_panel_1: Publishing to: mqtt-states/binary_sensor/main_hall/state, Payload: Closed
2021-06-11 10:54:52.802114 INFO qolsys_panel_2: Publishing to: mqtt-states/binary_sensor/guest_front_door_motion/state, Payload: Closed
EDIT: Just saw this in the logs, looks like it just isn’t being published to a topic:
2021-06-11 11:03:24.739772 INFO qolsys_panel_1: publishing ALARM event to:
I am so glad you asked… this has been bothering me. I built this without ever triggering the alarm. With my family home for the past year+, I haven’t had a chance to try out the triggering events. I think I’ll get the chance to get those events in the next few weeks.
If I’m not mistaken, the panel does send a message when the alarm goes off.
I just got this running with my system and the states are updating correctly. However, I’m having a problem with when I go to arm the system from home assistant, my IQ panel crashes and reboots. Is there something obvious I’m missing?
I should note that disarming works though.
I tried adding this to apps.yaml but it ended with the same result as before ("publishing ALARM event to: "):
qolsys_alarm_status_topic: qolsys/panel1/alarm
There is a siren test mode built into the panel btw, Installation > Sirens and Alarms > Panel Sirens > Installer/Test Mode
The second panel did end up appearing on the dashboard, I assume it just took it a little bit to discover everything:
Now I just need to figure out how to remove that old “partition1”
The panel doesn’t like the arm/disarm commands very much, occasionally they’ll work, at the moment they don’t. Not a huge deal for me though as I mainly just need to know when the panel sounds off.
Thanks again for all your work on this, I really appreciate it.
@AHRG I added pending (i.e. countdown to trigger) and triggered to 1.8.0. I’ve done some rudimentary testing. Give it a try.