XaF / qolsysgw

Qolsys IQ Panel 2+ gateway to an Home Assistant Alarm Control Panel
MIT License
131 stars 13 forks source link

Sensors incorrectly report tampered conditions #117

Open jsb5151 opened 1 year ago

jsb5151 commented 1 year ago

Before submitting this form

Description of the bug

I have a sensor on my hardwire translator that monitors my garage door. However, in some cases, it stays "open" but with a Tampered condition on qolsysgw, even though the sensor is secure on the IQPanel. It seems that triggering another sensor at the same time on my HW translator causes this issue.

Also, I have a PG9945 sensor that has a built-in reed switch as well as the AUX input. Same condition happens, it occasionally reports an Open condition with a Tampered = true, and closing the sensor reports an Open condition with a Tampered = false. Sometimes it clears itself on its own.

Further research seems to indicate that every time there is a sensor status change from the hardwire translator or a multiple loop sensor like the PG9945, it reports ALL of them through the API even though their status hasn't changed. This means we get 2 "Open" zone_event messages on an opened sensor on the API which is interpreted as a Tampered condition by qolsysgw.

This means we can't really report tampered conditions reliably on devices that report as multiple sensors/multiple loops. It just reports as "Open" in the C4 integration anyway, as there is no explicit field in the API for this.

Is there a way to disable Tamper reporting altogether? Perhaps on individual sensors?

Expected behavior

Garage open = open Garage closed = closed, no tampered condition :)

Or, a way to disable tamper reporting on selected sensors, if not all of them.

DEBUG logs

Sensor is a PG9945 with ID 101-5348, zone 5 is the built-in reed switch, zone 19 is the aux input.

Z5 CLOSED/Z19 CLOSED -> Z5 OPEN/Z19 CLOSED

2023-07-28 12:48:02.523839 DEBUG qolsys_panel: Data received (len: 154): {"event":"ZONE_EVENT","zone_event_type":"ZONE_ACTIVE","version":1,"zone":{"status":"Open","zone_id":5},"requestID":"0e9f9a67-1911-400d-89de-2b548a33b7d7"}
2023-07-28 12:48:02.530519 DEBUG qolsys_panel: Qolsys callback for event: <QolsysEventZoneEventActive zone=namespace(id=5, status='Open') version=1>
2023-07-28 12:48:02.531320 DEBUG qolsys_panel: call_service: mqtt/publish, {'namespace': 'mqtt', 'topic': 'qolsys/qolsys_panel/event', 'payload': '{"event": "ZONE_EVENT", "zone_event_type": "ZONE_ACTIVE", "version": 1, "zone": {"status": "Open", "zone_id": 5}, "requestID": "0e9f9a67-1911-400d-89de-2b548a33b7d7"}'}
2023-07-28 12:48:02.647533 DEBUG qolsys_panel: Received MQTT_MESSAGE with data={'topic': 'qolsys/qolsys_panel/event', 'wildcard': '#', 'payload': '{"event": "ZONE_EVENT", "zone_event_type": "ZONE_ACTIVE", "version": 1, "zone": {"status": "Open", "zone_id": 5}, "requestID": "0e9f9a67-1911-400d-89de-2b548a33b7d7"}'} and kwargs={'topic': 'qolsys/qolsys_panel/event', '__thread_id': 'MainThread'}
2023-07-28 12:48:02.655661 DEBUG qolsys_panel: MQTT callback for event: <QolsysEventZoneEventActive zone=namespace(id=5, status='Open') version=1>
2023-07-28 12:48:02.664906 DEBUG qolsys_panel: ACTIVE zone=namespace(id=5, status='Open')
2023-07-28 12:48:02.673978 DEBUG qolsys_panel: Sensor '101-5348' (PG9945 Reed) status updated to 'Open'
2023-07-28 12:48:02.683379 DEBUG qolsys_panel: Notifying <QolsysSensorDoorWindow id=101-5348 name=PG9945 Reed group=entryexitdelay status=Open state=0 zone_id=5 zone_type=1 zone_physical_type=1 zone_alarm_type=3 partition_id=0> observers with: {'change': 'update_status', 'prev_value': 'Closed', 'new_value': 'Open'}
2023-07-28 12:48:02.692839 DEBUG qolsys_panel: Received update from sensor 'PG9945 Reed' for CHANGE=update_status, from prev_value=Closed to new_value=Open
2023-07-28 12:48:02.702123 DEBUG qolsys_panel: Data received (len: 157): {"event":"ZONE_EVENT","zone_event_type":"ZONE_ACTIVE","version":1,"zone":{"status":"Closed","zone_id":19},"requestID":"af8c070d-ff8f-4f59-8067-d35284b8daae"}
2023-07-28 12:48:02.708797 DEBUG qolsys_panel: Qolsys callback for event: <QolsysEventZoneEventActive zone=namespace(id=19, status='Closed') version=1>
2023-07-28 12:48:02.710199 DEBUG qolsys_panel: call_service: mqtt/publish, {'namespace': 'mqtt', 'retain': True, 'topic': 'homeassistant/binary_sensor/pg9945_reed/state', 'payload': 'Open'}
2023-07-28 12:48:02.712239 DEBUG qolsys_panel: call_service: mqtt/publish, {'namespace': 'mqtt', 'topic': 'qolsys/qolsys_panel/event', 'payload': '{"event": "ZONE_EVENT", "zone_event_type": "ZONE_ACTIVE", "version": 1, "zone": {"status": "Closed", "zone_id": 19}, "requestID": "af8c070d-ff8f-4f59-8067-d35284b8daae"}'}
2023-07-28 12:48:03.302708 DEBUG qolsys_panel: Received MQTT_MESSAGE with data={'topic': 'qolsys/qolsys_panel/event', 'wildcard': '#', 'payload': '{"event": "ZONE_EVENT", "zone_event_type": "ZONE_ACTIVE", "version": 1, "zone": {"status": "Closed", "zone_id": 19}, "requestID": "af8c070d-ff8f-4f59-8067-d35284b8daae"}'} and kwargs={'topic': 'qolsys/qolsys_panel/event', '__thread_id': 'MainThread'}
2023-07-28 12:48:03.310358 DEBUG qolsys_panel: MQTT callback for event: <QolsysEventZoneEventActive zone=namespace(id=19, status='Closed') version=1>
2023-07-28 12:48:03.317862 DEBUG qolsys_panel: ACTIVE zone=namespace(id=19, status='Closed')

Z5 OPEN/Z19 CLOSED -> Z5 OPEN/Z19 OPEN

2023-07-28 12:48:33.808831 DEBUG qolsys_panel: Data received (len: 154): {"event":"ZONE_EVENT","zone_event_type":"ZONE_ACTIVE","version":1,"zone":{"status":"Open","zone_id":5},"requestID":"b60c3aa2-fb4f-41f1-a3c5-c7540ec37a09"}
2023-07-28 12:48:33.816391 DEBUG qolsys_panel: Qolsys callback for event: <QolsysEventZoneEventActive zone=namespace(id=5, status='Open') version=1>
2023-07-28 12:48:33.817224 DEBUG qolsys_panel: call_service: mqtt/publish, {'namespace': 'mqtt', 'topic': 'qolsys/qolsys_panel/event', 'payload': '{"event": "ZONE_EVENT", "zone_event_type": "ZONE_ACTIVE", "version": 1, "zone": {"status": "Open", "zone_id": 5}, "requestID": "b60c3aa2-fb4f-41f1-a3c5-c7540ec37a09"}'}
2023-07-28 12:48:34.012004 DEBUG qolsys_panel: Received MQTT_MESSAGE with data={'topic': 'qolsys/qolsys_panel/event', 'wildcard': '#', 'payload': '{"event": "ZONE_EVENT", "zone_event_type": "ZONE_ACTIVE", "version": 1, "zone": {"status": "Open", "zone_id": 5}, "requestID": "b60c3aa2-fb4f-41f1-a3c5-c7540ec37a09"}'} and kwargs={'topic': 'qolsys/qolsys_panel/event', '__thread_id': 'MainThread'}
2023-07-28 12:48:34.019320 DEBUG qolsys_panel: MQTT callback for event: <QolsysEventZoneEventActive zone=namespace(id=5, status='Open') version=1>
2023-07-28 12:48:34.026595 DEBUG qolsys_panel: ACTIVE zone=namespace(id=5, status='Open')
2023-07-28 12:48:34.200709 DEBUG qolsys_panel: Data received (len: 155): {"event":"ZONE_EVENT","zone_event_type":"ZONE_ACTIVE","version":1,"zone":{"status":"Open","zone_id":19},"requestID":"a4a6becd-2c95-4971-b2ee-5343c3007593"}
2023-07-28 12:48:34.207303 DEBUG qolsys_panel: Qolsys callback for event: <QolsysEventZoneEventActive zone=namespace(id=19, status='Open') version=1>
2023-07-28 12:48:34.208050 DEBUG qolsys_panel: call_service: mqtt/publish, {'namespace': 'mqtt', 'topic': 'qolsys/qolsys_panel/event', 'payload': '{"event": "ZONE_EVENT", "zone_event_type": "ZONE_ACTIVE", "version": 1, "zone": {"status": "Open", "zone_id": 19}, "requestID": "a4a6becd-2c95-4971-b2ee-5343c3007593"}'}
2023-07-28 12:48:34.603919 DEBUG qolsys_panel: Received MQTT_MESSAGE with data={'topic': 'qolsys/qolsys_panel/event', 'wildcard': '#', 'payload': '{"event": "ZONE_EVENT", "zone_event_type": "ZONE_ACTIVE", "version": 1, "zone": {"status": "Open", "zone_id": 19}, "requestID": "a4a6becd-2c95-4971-b2ee-5343c3007593"}'} and kwargs={'topic': 'qolsys/qolsys_panel/event', '__thread_id': 'MainThread'}
2023-07-28 12:48:34.611906 DEBUG qolsys_panel: MQTT callback for event: <QolsysEventZoneEventActive zone=namespace(id=19, status='Open') version=1>
2023-07-28 12:48:34.619202 DEBUG qolsys_panel: ACTIVE zone=namespace(id=19, status='Open')
2023-07-28 12:48:34.627165 DEBUG qolsys_panel: Sensor '101-5348' (Front Window) status updated to 'Open'
2023-07-28 12:48:34.635418 DEBUG qolsys_panel: Notifying <QolsysSensorDoorWindow id=101-5348 name=Front Window group=entryexitdelay status=Open state=0 zone_id=19 zone_type=1 zone_physical_type=1 zone_alarm_type=3 partition_id=0> observers with: {'change': 'update_status', 'prev_value': 'Closed', 'new_value': 'Open'}
2023-07-28 12:48:34.643807 DEBUG qolsys_panel: Received update from sensor 'Front Window' for CHANGE=update_status, from prev_value=Closed to new_value=Open
2023-07-28 12:48:34.648373 DEBUG qolsys_panel: call_service: mqtt/publish, {'namespace': 'mqtt', 'retain': True, 'topic': 'homeassistant/binary_sensor/front_window/state', 'payload': 'Open'}

Z5 OPEN/Z19 OPEN -> Z5 CLOSED/Z19 OPEN - REPORTS TAMPER ON Z19 DUE TO DUPLICATE OPEN MESSAGE

2023-07-28 12:49:38.603432 DEBUG qolsys_panel: Data received (len: 156): {"event":"ZONE_EVENT","zone_event_type":"ZONE_ACTIVE","version":1,"zone":{"status":"Closed","zone_id":5},"requestID":"65ae136b-00ff-4c92-886c-71eb7080168f"}
2023-07-28 12:49:38.610909 DEBUG qolsys_panel: Qolsys callback for event: <QolsysEventZoneEventActive zone=namespace(id=5, status='Closed') version=1>
2023-07-28 12:49:38.611732 DEBUG qolsys_panel: call_service: mqtt/publish, {'namespace': 'mqtt', 'topic': 'qolsys/qolsys_panel/event', 'payload': '{"event": "ZONE_EVENT", "zone_event_type": "ZONE_ACTIVE", "version": 1, "zone": {"status": "Closed", "zone_id": 5}, "requestID": "65ae136b-00ff-4c92-886c-71eb7080168f"}'}
2023-07-28 12:49:38.701221 DEBUG qolsys_panel: Received MQTT_MESSAGE with data={'topic': 'qolsys/qolsys_panel/event', 'wildcard': '#', 'payload': '{"event": "ZONE_EVENT", "zone_event_type": "ZONE_ACTIVE", "version": 1, "zone": {"status": "Closed", "zone_id": 5}, "requestID": "65ae136b-00ff-4c92-886c-71eb7080168f"}'} and kwargs={'topic': 'qolsys/qolsys_panel/event', '__thread_id': 'MainThread'}
2023-07-28 12:49:38.709461 DEBUG qolsys_panel: MQTT callback for event: <QolsysEventZoneEventActive zone=namespace(id=5, status='Closed') version=1>
2023-07-28 12:49:38.716922 DEBUG qolsys_panel: ACTIVE zone=namespace(id=5, status='Closed')
2023-07-28 12:49:38.725071 DEBUG qolsys_panel: Sensor '101-5348' (PG9945 Reed) status updated to 'Closed'
2023-07-28 12:49:38.733649 DEBUG qolsys_panel: Notifying <QolsysSensorDoorWindow id=101-5348 name=PG9945 Reed group=entryexitdelay status=Closed state=0 zone_id=5 zone_type=1 zone_physical_type=1 zone_alarm_type=3 partition_id=0> observers with: {'change': 'update_status', 'prev_value': 'Open', 'new_value': 'Closed'}
2023-07-28 12:49:38.742336 DEBUG qolsys_panel: Received update from sensor 'PG9945 Reed' for CHANGE=update_status, from prev_value=Open to new_value=Closed
2023-07-28 12:49:38.751839 DEBUG qolsys_panel: Data received (len: 155): {"event":"ZONE_EVENT","zone_event_type":"ZONE_ACTIVE","version":1,"zone":{"status":"Open","zone_id":19},"requestID":"7a748498-f3db-4c1e-aedc-e65ffcf1b3dc"}
2023-07-28 12:49:38.758535 DEBUG qolsys_panel: Qolsys callback for event: <QolsysEventZoneEventActive zone=namespace(id=19, status='Open') version=1>
2023-07-28 12:49:38.759868 DEBUG qolsys_panel: call_service: mqtt/publish, {'namespace': 'mqtt', 'retain': True, 'topic': 'homeassistant/binary_sensor/pg9945_reed/state', 'payload': 'Closed'}
2023-07-28 12:49:38.761730 DEBUG qolsys_panel: call_service: mqtt/publish, {'namespace': 'mqtt', 'topic': 'qolsys/qolsys_panel/event', 'payload': '{"event": "ZONE_EVENT", "zone_event_type": "ZONE_ACTIVE", "version": 1, "zone": {"status": "Open", "zone_id": 19}, "requestID": "7a748498-f3db-4c1e-aedc-e65ffcf1b3dc"}'}
2023-07-28 12:49:38.778754 DEBUG qolsys_panel: Received MQTT_MESSAGE with data={'topic': 'qolsys/qolsys_panel/event', 'wildcard': '#', 'payload': '{"event": "ZONE_EVENT", "zone_event_type": "ZONE_ACTIVE", "version": 1, "zone": {"status": "Open", "zone_id": 19}, "requestID": "7a748498-f3db-4c1e-aedc-e65ffcf1b3dc"}'} and kwargs={'topic': 'qolsys/qolsys_panel/event', '__thread_id': 'MainThread'}
2023-07-28 12:49:38.786190 DEBUG qolsys_panel: MQTT callback for event: <QolsysEventZoneEventActive zone=namespace(id=19, status='Open') version=1>
2023-07-28 12:49:38.794447 DEBUG qolsys_panel: ACTIVE zone=namespace(id=19, status='Open')
2023-07-28 12:49:38.802455 DEBUG qolsys_panel: Sensor '101-5348' (Front Window) tampered updated to 'True'
2023-07-28 12:49:38.810802 DEBUG qolsys_panel: Notifying <QolsysSensorDoorWindow id=101-5348 name=Front Window group=entryexitdelay status=Open state=0 zone_id=19 zone_type=1 zone_physical_type=1 zone_alarm_type=3 partition_id=0> observers with: {'change': 'update_tampered', 'prev_value': False, 'new_value': True}
2023-07-28 12:49:38.819214 DEBUG qolsys_panel: Received update from sensor 'Front Window' for CHANGE=update_tampered, from prev_value=False to new_value=True
2023-07-28 12:49:38.827417 DEBUG qolsys_panel: Notifying <QolsysSensorDoorWindow id=101-5348 name=Front Window group=entryexitdelay status=Open state=0 zone_id=19 zone_type=1 zone_physical_type=1 zone_alarm_type=3 partition_id=0> observers with: {'change': 'update_attributes'}
2023-07-28 12:49:38.835806 DEBUG qolsys_panel: Received update from sensor 'Front Window' for CHANGE=update_attributes, from prev_value=None to new_value=None
2023-07-28 12:49:38.840286 DEBUG qolsys_panel: call_service: mqtt/publish, {'namespace': 'mqtt', 'retain': True, 'topic': 'homeassistant/binary_sensor/front_window/attributes', 'payload': '{"group": "entryexitdelay", "state": "0", "zone_type": 1, "zone_physical_type": 1, "zone_alarm_type": 3, "tampered": true}'}`

Additional context

No response

XaF commented 1 year ago

What happens when you do tamper sensors ?

jsb5151 commented 1 year ago

So I had a sensor that had the reed switch open but the aux switch closed, and when it got tampered, both sensors were marked open, both tampered = false.

How does qolsysgw decide if a sensor is tampered if it's not reported by the API?

jsb5151 commented 1 year ago

BTW, looking at the logs, I've noticed that I get a LOT of tampered sensor messages in the logs. The only reason why I noticed it is that I have a push notification every time the garage door status changes (open/close/unavailable).

After all, this may not be limited only to dual sensors, as my PIRs routinely report tampered conditions and I know for a fact that they aren't tampered with, otherwise I would see messages on the IQP2 or on MobileTech!

jsb5151 commented 1 year ago

It seems to happen when some sensors stay open for a very long time; it seems like the panel is sending a redundant zone_action message when a status changes after a while...

XaF commented 1 year ago

I documented in this document: https://github.com/XaF/qolsysgw/blob/main/docs/qolsys-panel-interactions.md (search "tamper") how I've identified (tests and checks) that the panel reports tampered sensors through the control4 API.

I've not had any issue with that, even when keeping my windows open for a while, it does not seem to repeat-report the open status or send redundant messages through ZONE_ACTIVE. The ZONE_UPDATE messages are the ones being used generally to resync the status of sensors that have not reported in a while.

I'm not familiar with dual sensors: how are they working? I would have expected two sensors in the panel, if coming from the same physical sensor, to have zone ids that follow each other but it's not the case in your situation? I'm also curious why the sensor tampering seems to be an issue for all of your sensors: could it be a panel configuration option somewhere?

jsb5151 commented 1 year ago

I've looked at this further, and I still don't know why it reports that. Manually overriding the trouble check in the code fixed my issue. I've looked at panel config options and can't find anything, and MobileTech does not report any trouble conditions at this time.

MattR658 commented 1 month ago

Resurrecting an old thread, I'm seeing the same behavior with one of my sensors. It is an outdoor PowerG sensor (PG9312). It does have an AUX input port similar to the initial report; however, I do not use the AUX input at all.

This sensor is used on an outdoor gate that is opened in the morning and usually left open for about 12-14 hours and then closed at night. The issue I'm seeing is at night when the gate is CLOSED, Home Assistant shows that the gate is still OPEN even though on the IQ 4 panel it is properly showing as closed.

Looking in the logs, I'm seeing that during the coarse of the day while the gate is still OPEN, there is an incorrect reported tamper event being sent. And then when the gate is CLOSED later in the evening, instead of that event being captured as CLOSED, it is clearing the tamper event, which leaves Home Assistant still believing the gate is OPEN. Usually after a few hours during a ZONE_UPDATE, the proper CLOSED state is eventually sent.

I'm not sure if there is any solution to this, or if there is a way to just disable the tamper check altogether for this sensor. Either way, just passing along more details in case it is helpful to resolve this. I'm happy to provide any additional information/logs if it would be helpful.

_Sensor id=107-5354 / Sensor name=Driveway Gate / zoneid=10

Gate OPEN in the morning:

2024-10-17 06:40:18.006044 DEBUG qolsys_panel: Data received (len: 155): {"event":"ZONE_EVENT","zone_event_type":"ZONE_ACTIVE","version":1,"zone":{"status":"Open","zone_id":10},"requestID":"d2f935bb-fe06-42b6-aea9-01d3fe5a8e1a"}
2024-10-17 06:40:18.008616 DEBUG qolsys_panel: Qolsys callback for event: <QolsysEventZoneEventActive zone=namespace(id=10, status='Open') version=1>
2024-10-17 06:40:18.008879 DEBUG qolsys_panel: call_service: mqtt/publish, {'namespace': 'mqtt', 'topic': 'qolsys/qolsys_panel/event', 'payload': '{"event": "ZONE_EVENT", "zone_event_type": "ZONE_ACTIVE", "version": 1, "zone": {"status": "Open", "zone_id": 10}, "requestID": "d2f935bb-fe06-42b6-aea9-01d3fe5a8e1a"}'}
2024-10-17 06:40:18.412581 DEBUG qolsys_panel: Received MQTT_MESSAGE with data={'topic': 'qolsys/qolsys_panel/event', 'wildcard': '#', 'payload': '{"event": "ZONE_EVENT", "zone_event_type": "ZONE_ACTIVE", "version": 1, "zone": {"status": "Open", "zone_id": 10}, "requestID": "d2f935bb-fe06-42b6-aea9-01d3fe5a8e1a"}'} and kwargs={'topic': 'qolsys/qolsys_panel/event', '__thread_id': 'MainThread'}
2024-10-17 06:40:18.414114 DEBUG qolsys_panel: MQTT callback for event: <QolsysEventZoneEventActive zone=namespace(id=10, status='Open') version=1>
2024-10-17 06:40:18.414940 DEBUG qolsys_panel: ACTIVE zone=namespace(id=10, status='Open')
2024-10-17 06:40:18.415858 DEBUG qolsys_panel: Sensor '107-5354' (Driveway Gate) status updated to 'Open'
2024-10-17 06:40:18.416794 DEBUG qolsys_panel: Notifying <QolsysSensorDoorWindow id=107-5354 name=Driveway Gate group=localsafety status=Open state=0 zone_id=10 zone_type=1 zone_physical_type=1 zone_alarm_type=3 partition_id=0> observers with: {'change': 'update_status', 'prev_value': 'Closed', 'new_value': 'Open'}
2024-10-17 06:40:18.417750 DEBUG qolsys_panel: Received update from sensor 'Driveway Gate' for CHANGE=update_status, from prev_value=Closed to new_value=Open
2024-10-17 06:40:18.418992 DEBUG qolsys_panel: call_service: mqtt/publish, {'namespace': 'mqtt', 'retain': True, 'topic': 'homeassistant/binary_sensor/driveway_gate/state', 'payload': 'Open'}

Incorrect gate TAMPER event (while gate is still OPEN):

2024-10-17 19:02:23.029949 DEBUG qolsys_panel: Data received (len: 155): {"event":"ZONE_EVENT","zone_event_type":"ZONE_ACTIVE","version":1,"zone":{"status":"Open","zone_id":10},"requestID":"495ff2aa-c32a-4f17-81d0-358fc86fc4c0"}
2024-10-17 19:02:23.032309 DEBUG qolsys_panel: Qolsys callback for event: <QolsysEventZoneEventActive zone=namespace(id=10, status='Open') version=1>
2024-10-17 19:02:23.032611 DEBUG qolsys_panel: call_service: mqtt/publish, {'namespace': 'mqtt', 'topic': 'qolsys/qolsys_panel/event', 'payload': '{"event": "ZONE_EVENT", "zone_event_type": "ZONE_ACTIVE", "version": 1, "zone": {"status": "Open", "zone_id": 10}, "requestID": "495ff2aa-c32a-4f17-81d0-358fc86fc4c0"}'}
2024-10-17 19:02:23.034805 DEBUG qolsys_panel: Received MQTT_MESSAGE with data={'topic': 'qolsys/qolsys_panel/event', 'wildcard': '#', 'payload': '{"event": "ZONE_EVENT", "zone_event_type": "ZONE_ACTIVE", "version": 1, "zone": {"status": "Open", "zone_id": 10}, "requestID": "495ff2aa-c32a-4f17-81d0-358fc86fc4c0"}'} and kwargs={'topic': 'qolsys/qolsys_panel/event', '__thread_id': 'MainThread'}
2024-10-17 19:02:23.035729 DEBUG qolsys_panel: MQTT callback for event: <QolsysEventZoneEventActive zone=namespace(id=10, status='Open') version=1>
2024-10-17 19:02:23.036556 DEBUG qolsys_panel: ACTIVE zone=namespace(id=10, status='Open')
2024-10-17 19:02:23.037748 DEBUG qolsys_panel: Sensor '107-5354' (Driveway Gate) tampered updated to 'True'
2024-10-17 19:02:23.038737 DEBUG qolsys_panel: Notifying <QolsysSensorDoorWindow id=107-5354 name=Driveway Gate group=localsafety status=Open state=0 zone_id=10 zone_type=1 zone_physical_type=1 zone_alarm_type=3 partition_id=0> observers with: {'change': 'update_tampered', 'prev_value': False, 'new_value': True}
2024-10-17 19:02:23.039732 DEBUG qolsys_panel: Received update from sensor 'Driveway Gate' for CHANGE=update_tampered, from prev_value=False to new_value=True
2024-10-17 19:02:23.040704 DEBUG qolsys_panel: Notifying <QolsysSensorDoorWindow id=107-5354 name=Driveway Gate group=localsafety status=Open state=0 zone_id=10 zone_type=1 zone_physical_type=1 zone_alarm_type=3 partition_id=0> observers with: {'change': 'update_attributes'}
2024-10-17 19:02:23.041711 DEBUG qolsys_panel: Received update from sensor 'Driveway Gate' for CHANGE=update_attributes, from prev_value=None to new_value=None
2024-10-17 19:02:23.042912 DEBUG qolsys_panel: call_service: mqtt/publish, {'namespace': 'mqtt', 'retain': True, 'topic': 'homeassistant/binary_sensor/driveway_gate/attributes', 'payload': '{"group": "localsafety", "state": "0", "zone_type": 1, "zone_physical_type": 1, "zone_alarm_type": 3, "tampered": true}'}

Gate CLOSED in the evening (Home Assistant still reports OPEN):

2024-10-17 21:25:36.209366 DEBUG qolsys_panel: Data received (len: 157): {"event":"ZONE_EVENT","zone_event_type":"ZONE_ACTIVE","version":1,"zone":{"status":"Closed","zone_id":10},"requestID":"10b6f154-c099-45d4-b7cb-4c2471e67a01"}
2024-10-17 21:25:36.211476 DEBUG qolsys_panel: Qolsys callback for event: <QolsysEventZoneEventActive zone=namespace(id=10, status='Closed') version=1>
2024-10-17 21:25:36.211753 DEBUG qolsys_panel: call_service: mqtt/publish, {'namespace': 'mqtt', 'topic': 'qolsys/qolsys_panel/event', 'payload': '{"event": "ZONE_EVENT", "zone_event_type": "ZONE_ACTIVE", "version": 1, "zone": {"status": "Closed", "zone_id": 10}, "requestID": "10b6f154-c099-45d4-b7cb-4c2471e67a01"}'}
2024-10-17 21:25:36.317971 DEBUG qolsys_panel: Received MQTT_MESSAGE with data={'topic': 'qolsys/qolsys_panel/event', 'wildcard': '#', 'payload': '{"event": "ZONE_EVENT", "zone_event_type": "ZONE_ACTIVE", "version": 1, "zone": {"status": "Closed", "zone_id": 10}, "requestID": "10b6f154-c099-45d4-b7cb-4c2471e67a01"}'} and kwargs={'topic': 'qolsys/qolsys_panel/event', '__thread_id': 'MainThread'}
2024-10-17 21:25:36.318875 DEBUG qolsys_panel: MQTT callback for event: <QolsysEventZoneEventActive zone=namespace(id=10, status='Closed') version=1>
2024-10-17 21:25:36.319703 DEBUG qolsys_panel: ACTIVE zone=namespace(id=10, status='Closed')
2024-10-17 21:25:36.320610 DEBUG qolsys_panel: Sensor '107-5354' (Driveway Gate) tampered updated to 'False'
2024-10-17 21:25:36.321845 DEBUG qolsys_panel: Notifying <QolsysSensorDoorWindow id=107-5354 name=Driveway Gate group=localsafety status=Open state=0 zone_id=10 zone_type=1 zone_physical_type=1 zone_alarm_type=3 partition_id=0> observers with: {'change': 'update_tampered', 'prev_value': True, 'new_value': False}
2024-10-17 21:25:36.322817 DEBUG qolsys_panel: Received update from sensor 'Driveway Gate' for CHANGE=update_tampered, from prev_value=True to new_value=False
2024-10-17 21:25:36.323755 DEBUG qolsys_panel: Notifying <QolsysSensorDoorWindow id=107-5354 name=Driveway Gate group=localsafety status=Open state=0 zone_id=10 zone_type=1 zone_physical_type=1 zone_alarm_type=3 partition_id=0> observers with: {'change': 'update_attributes'}
2024-10-17 21:25:36.324708 DEBUG qolsys_panel: Received update from sensor 'Driveway Gate' for CHANGE=update_attributes, from prev_value=None to new_value=None
2024-10-17 21:25:36.325939 DEBUG qolsys_panel: call_service: mqtt/publish, {'namespace': 'mqtt', 'retain': True, 'topic': 'homeassistant/binary_sensor/driveway_gate/attributes', 'payload': '{"group": "localsafety", "state": "0", "zone_type": 1, "zone_physical_type": 1, "zone_alarm_type": 3, "tampered": false}'}

A few hours later, proper CLOSED event is reported (during ZONE_UPDATE):

2024-10-18 01:05:23.288269 DEBUG qolsys_panel: Data received (len: 325): {"event":"ZONE_EVENT","zone_event_type":"ZONE_UPDATE","zone":{"id":"107-5354","type":"Door_Window","name":"Driveway Gate","group":"localsafety","status":"Closed","state":"0","zone_id":10,"zone_physical_type":1,"zone_alarm_type":3,"zone_type":1,"partition_id":0},"version":1,"requestID":"d3809f47-baa5-437c-8349-b256e98bdd80"}
2024-10-18 01:05:23.290989 DEBUG qolsys_panel: Qolsys callback for event: <QolsysEventZoneEventUpdate zone=<QolsysSensorDoorWindow id=107-5354 name=Driveway Gate group=localsafety status=Closed state=0 zone_id=10 zone_type=1 zone_physical_type=1 zone_alarm_type=3 partition_id=0> version=1>
2024-10-18 01:05:23.291264 DEBUG qolsys_panel: call_service: mqtt/publish, {'namespace': 'mqtt', 'topic': 'qolsys/qolsys_panel/event', 'payload': '{"event": "ZONE_EVENT", "zone_event_type": "ZONE_UPDATE", "zone": {"id": "107-5354", "type": "Door_Window", "name": "Driveway Gate", "group": "localsafety", "status": "Closed", "state": "0", "zone_id": 10, "zone_physical_type": 1, "zone_alarm_type": 3, "zone_type": 1, "partition_id": 0}, "version": 1, "requestID": "d3809f47-baa5-437c-8349-b256e98bdd80"}'}
2024-10-18 01:05:23.660930 DEBUG qolsys_panel: Received MQTT_MESSAGE with data={'topic': 'qolsys/qolsys_panel/event', 'wildcard': '#', 'payload': '{"event": "ZONE_EVENT", "zone_event_type": "ZONE_UPDATE", "zone": {"id": "107-5354", "type": "Door_Window", "name": "Driveway Gate", "group": "localsafety", "status": "Closed", "state": "0", "zone_id": 10, "zone_physical_type": 1, "zone_alarm_type": 3, "zone_type": 1, "partition_id": 0}, "version": 1, "requestID": "d3809f47-baa5-437c-8349-b256e98bdd80"}'} and kwargs={'topic': 'qolsys/qolsys_panel/event', '__thread_id': 'MainThread'}
2024-10-18 01:05:23.662512 DEBUG qolsys_panel: MQTT callback for event: <QolsysEventZoneEventUpdate zone=<QolsysSensorDoorWindow id=107-5354 name=Driveway Gate group=localsafety status=Closed state=0 zone_id=10 zone_type=1 zone_physical_type=1 zone_alarm_type=3 partition_id=0> version=1>
2024-10-18 01:05:23.663350 DEBUG qolsys_panel: UPDATE zone=<QolsysSensorDoorWindow id=107-5354 name=Driveway Gate group=localsafety status=Closed state=0 zone_id=10 zone_type=1 zone_physical_type=1 zone_alarm_type=3 partition_id=0>
2024-10-18 01:05:23.664307 DEBUG qolsys_panel: Notifying <QolsysSensorDoorWindow id=107-5354 name=Driveway Gate group=localsafety status=Closed state=0 zone_id=10 zone_type=1 zone_physical_type=1 zone_alarm_type=3 partition_id=0> observers with: {'change': 'update_status', 'prev_value': 'Open', 'new_value': 'Closed'}
2024-10-18 01:05:23.665262 DEBUG qolsys_panel: Received update from sensor 'Driveway Gate' for CHANGE=update_status, from prev_value=Open to new_value=Closed
2024-10-18 01:05:23.666493 DEBUG qolsys_panel: call_service: mqtt/publish, {'namespace': 'mqtt', 'retain': True, 'topic': 'homeassistant/binary_sensor/driveway_gate/state', 'payload': 'Closed'}
jsb5151 commented 1 month ago

Same issue here with my multi-input sensors, like the PG9945 with reed + aux, and PG9WLSHW8 (8 inputs) also runs into this issue.

If you have a sensor with multiple inputs on the same device ID, it'll create that problem. The only way to fix this is to bypass the trouble reporting in the code.