vanackej / risco-mqtt-local

Provide Risco alarm system integration to Home assistant using local TCP communication (no cloud required) and MQTT
MIT License
24 stars 11 forks source link

Bypassing zone errors #24

Closed markxroberts closed 2 years ago

markxroberts commented 2 years ago

Describe the bug Thanks for all the excellent work you've done on this project. Bypass zone bypasses the wrong zone or offers an error that zone can't be bypassed. Renaming zones doesn't always work as per closed issue #23

Configuration

Logs

2/25/2022, 8:27:07 PM [warn] Command[null] Receipt of an error code: CRC Error
2/25/2022, 8:27:12 PM [warn] Command[46] 'DCN' Timeout
2/25/2022, 8:27:12 PM [warn] Risco command error: TIMEOUT. Command: {"panelId":1,"commandId":46,"attempts":1,"crcOk":false,"commandStr":"DCN","sentBuffer":{"type":"Buffer","data":[2,54,51,79,84,97,73,248,75,193,171,3]}}
2/25/2022, 8:27:12 PM [warn] Error while sending DCN command
2/25/2022, 8:27:12 PM [info] TCP Socket Disconnected
2/25/2022, 8:27:12 PM [info] Won't attempt automatic reconnection
Loading config from: /data/config.json
2/25/2022, 8:27:31 PM [info] Logging commands to risco-commands-2022-02-25T20:27:31.891Z.csv
2/25/2022, 8:27:32 PM [info] autoConnect enabled, starting communication
2/25/2022, 8:27:32 PM [info] Connecting to mqtt server: mqtt://192.168.3.81:1883
2/25/2022, 8:27:33 PM [info] Connected on mqtt server: mqtt://192.168.3.81:1883
2/25/2022, 8:27:33 PM [info] Panel is not connected, waiting
2/25/2022, 8:27:34 PM [info] Panel info: LightSys/RP432, FW 5.93
2/25/2022, 8:27:34 PM [info] Panel options: 4 parts, 50 zones, 32 outputs, Pir Cam support: false
2/25/2022, 8:27:34 PM [info] Starting devices discovery
2/25/2022, 8:27:34 PM [info] Retrieving System Information
2/25/2022, 8:27:34 PM [info] Retrieving zones configuration
2/25/2022, 8:28:13 PM [info] Retrieving outputs configuration
2/25/2022, 8:28:16 PM [warn] Command[42] Receipt of an error code: Device Doesn't Exists
2/25/2022, 8:28:16 PM [warn] Got error while fetching output 7 data: N19
2/25/2022, 8:28:16 PM [info] Output 7 does not exists, stopping outputs discovery
2/25/2022, 8:28:16 PM [info] Retrieving partitions configuration
2/25/2022, 8:28:17 PM [info] Panel and MQTT communications are ready
2/25/2022, 8:28:17 PM [info] Publishing Home Assistant discovery info
2/25/2022, 8:28:17 PM [info] [Panel => MQTT][Discovery] Published alarm_control_panel to HA on partition 1
2/25/2022, 8:28:17 PM [info] [Panel => MQTT][Discovery] Published alarm_control_panel to HA on partition 2
2/25/2022, 8:28:17 PM [info] [Panel => MQTT][Discovery] Published binary_sensor to HA: Zone label = Front Door, HA name = Front door
2/25/2022, 8:28:17 PM [info] [Panel => MQTT][Discovery] Published binary_sensor to HA: Zone label = Hall PIR, HA name = Hall PIR
2/25/2022, 8:28:17 PM [info] [Panel => MQTT][Discovery] Published binary_sensor to HA: Zone label = Kitchen PIR, HA name = Kitchen PIR
2/25/2022, 8:28:17 PM [info] [Panel => MQTT][Discovery] Published binary_sensor to HA: Zone label = Lounge PIR, HA name = Lounge PIR
2/25/2022, 8:28:17 PM [info] [Panel => MQTT][Discovery] Published binary_sensor to HA: Zone label = Grnd Flr Bath, HA name = Downstairs bathroom window
2/25/2022, 8:28:17 PM [info] [Panel => MQTT][Discovery] Published binary_sensor to HA: Zone label = Study PIR, HA name = Study PIR
2/25/2022, 8:28:17 PM [info] [Panel => MQTT][Discovery] Published binary_sensor to HA: Zone label = Study Window, HA name = Study window
2/25/2022, 8:28:17 PM [info] [Panel => MQTT][Discovery] Published binary_sensor to HA: Zone label = Utility Door, HA name = Utility door
2/25/2022, 8:28:17 PM [info] [Panel => MQTT][Discovery] Published binary_sensor to HA: Zone label = Utility Window, HA name = Utility window
2/25/2022, 8:28:17 PM [info] [Panel => MQTT][Discovery] Published binary_sensor to HA: Zone label = Kitchen LH Wndow, HA name = Kitchen LH Wndow
2/25/2022, 8:28:17 PM [info] [Panel => MQTT][Discovery] Published binary_sensor to HA: Zone label = Kitchen RH Wndow, HA name = Kitchen RH Wndow
2/25/2022, 8:28:17 PM [info] [Panel => MQTT][Discovery] Published binary_sensor to HA: Zone label = Kitchen Patio Dr, HA name = Kitchen patio door
2/25/2022, 8:28:17 PM [info] [Panel => MQTT][Discovery] Published binary_sensor to HA: Zone label = Lounge Patio Dr, HA name = Lounge patio door
2/25/2022, 8:28:17 PM [info] [Panel => MQTT][Discovery] Published binary_sensor to HA: Zone label = Landing PIR, HA name = Landing PIR
2/25/2022, 8:28:17 PM [info] [Panel => MQTT][Discovery] Published binary_sensor to HA: Zone label = M Bed PIR, HA name = Master bedroom PIR
2/25/2022, 8:28:17 PM [info] [Panel => MQTT][Discovery] Published binary_sensor to HA: Zone label = 1st Flr Bath, HA name = Main bathroom window
2/25/2022, 8:28:17 PM [info] [Panel => MQTT][Discovery] Published binary_sensor to HA: Zone label = Plum Bed Window, HA name = Plum bedroom window
2/25/2022, 8:28:17 PM [info] [Panel => MQTT][Discovery] Published binary_sensor to HA: Zone label = Landing Window, HA name = Landing Window
2/25/2022, 8:28:17 PM [info] [Panel => MQTT][Discovery] Published binary_sensor to HA: Zone label = Oak Bed Window, HA name = Oak bedroom window
2/25/2022, 8:28:17 PM [info] [Panel => MQTT][Discovery] Published binary_sensor to HA: Zone label = Beach Bed Window, HA name = Beach bedroom window
2/25/2022, 8:28:17 PM [info] [Panel => MQTT][Discovery] Published binary_sensor to HA: Zone label = M Bed French, HA name = Master bedroom patio door
2/25/2022, 8:28:17 PM [info] [Panel => MQTT][Discovery] Published binary_sensor to HA: Zone label = Dining PIR, HA name = Dining room PIR
2/25/2022, 8:28:17 PM [info] [Panel => MQTT][Discovery] Published binary_sensor to HA: Zone label = Dining Windows, HA name = Dining room windows
2/25/2022, 8:28:17 PM [info] [Panel => MQTT][Discovery] Published binary_sensor to HA: Zone label = Garage Door, HA name = Garage door
2/25/2022, 8:28:17 PM [info] Publishing initial partitions and zones state to Home assistant
2/25/2022, 8:28:17 PM [info] [Panel => MQTT] Published alarm status disarmed on partition 1
2/25/2022, 8:28:17 PM [info] [Panel => MQTT] Published alarm status armed_away on partition 2
2/25/2022, 8:28:17 PM [info] Subscribing to Home assistant commands topics
2/25/2022, 8:28:17 PM [info] Subscribing to riscopanel/alarm/1/set topic
2/25/2022, 8:28:17 PM [info] Subscribing to riscopanel/alarm/2/set topic
2/25/2022, 8:28:17 PM [info] Subscribing to riscopanel/alarm/zone/1-bypass/set topic
2/25/2022, 8:28:17 PM [info] Subscribing to riscopanel/alarm/zone/2-bypass/set topic
2/25/2022, 8:28:17 PM [info] Subscribing to riscopanel/alarm/zone/3-bypass/set topic
2/25/2022, 8:28:17 PM [info] Subscribing to riscopanel/alarm/zone/4-bypass/set topic
2/25/2022, 8:28:17 PM [info] Subscribing to riscopanel/alarm/zone/5-bypass/set topic
2/25/2022, 8:28:17 PM [info] Subscribing to riscopanel/alarm/zone/6-bypass/set topic
2/25/2022, 8:28:17 PM [info] Subscribing to riscopanel/alarm/zone/7-bypass/set topic
2/25/2022, 8:28:17 PM [info] Subscribing to riscopanel/alarm/zone/9-bypass/set topic
2/25/2022, 8:28:17 PM [info] Subscribing to riscopanel/alarm/zone/10-bypass/set topic
2/25/2022, 8:28:17 PM [info] Subscribing to riscopanel/alarm/zone/11-bypass/set topic
2/25/2022, 8:28:17 PM [info] Subscribing to riscopanel/alarm/zone/12-bypass/set topic
2/25/2022, 8:28:17 PM [info] Subscribing to riscopanel/alarm/zone/13-bypass/set topic
2/25/2022, 8:28:17 PM [info] Subscribing to riscopanel/alarm/zone/14-bypass/set topic
2/25/2022, 8:28:17 PM [info] Subscribing to riscopanel/alarm/zone/17-bypass/set topic
2/25/2022, 8:28:17 PM [info] Subscribing to riscopanel/alarm/zone/18-bypass/set topic
2/25/2022, 8:28:17 PM [info] Subscribing to riscopanel/alarm/zone/19-bypass/set topic
2/25/2022, 8:28:17 PM [info] Subscribing to riscopanel/alarm/zone/20-bypass/set topic
2/25/2022, 8:28:17 PM [info] Subscribing to riscopanel/alarm/zone/21-bypass/set topic
2/25/2022, 8:28:17 PM [info] Subscribing to riscopanel/alarm/zone/22-bypass/set topic
2/25/2022, 8:28:17 PM [info] Subscribing to riscopanel/alarm/zone/23-bypass/set topic
2/25/2022, 8:28:17 PM [info] Subscribing to riscopanel/alarm/zone/24-bypass/set topic
2/25/2022, 8:28:17 PM [info] Subscribing to riscopanel/alarm/zone/25-bypass/set topic
2/25/2022, 8:28:17 PM [info] Subscribing to riscopanel/alarm/zone/26-bypass/set topic
2/25/2022, 8:28:17 PM [info] Subscribing to riscopanel/alarm/zone/27-bypass/set topic
2/25/2022, 8:28:17 PM [info] Subscribing to panel partitions events
2/25/2022, 8:28:17 PM [info] Subscribing to panel zones events
2/25/2022, 8:28:17 PM [info] Initialization completed
2/25/2022, 8:31:56 PM [info] [MQTT => Panel] Received bypass zone command true on topic riscopanel/alarm/zone/4-bypass/set for zone 4
2/25/2022, 8:31:57 PM [info] [MQTT => Panel] toggle bypass command sent on zone 4
2/25/2022, 8:32:23 PM [info] [MQTT => Panel] Received bypass zone command true on topic riscopanel/alarm/zone/17-bypass/set for zone 7
2/25/2022, 8:32:23 PM [info] [MQTT => Panel] toggle bypass command sent on zone 7
2/25/2022, 8:32:55 PM [info] [MQTT => Panel] Received bypass zone command true on topic riscopanel/alarm/zone/17-bypass/set for zone 7
2/25/2022, 8:32:55 PM [info] [MQTT => Panel] Zone is already on the desired bypass state
2/25/2022, 8:34:04 PM [info] [MQTT => Panel] Received bypass zone command false on topic riscopanel/alarm/zone/7-bypass/set for zone 7
2/25/2022, 8:34:05 PM [info] [MQTT => Panel] toggle bypass command sent on zone 7
2/25/2022, 8:34:17 PM [info] [MQTT => Panel] Received bypass zone command true on topic riscopanel/alarm/zone/21-bypass/set for zone 1
2/25/2022, 8:34:17 PM [warn] Command[26] Receipt of an error code: Invalid Value
2/25/2022, 8:34:17 PM [error] [MQTT => Panel] Failed to send toggle bypass command on zone 1
2/25/2022, 8:34:36 PM [info] [MQTT => Panel] Received bypass zone command true on topic riscopanel/alarm/zone/19-bypass/set for zone 9
2/25/2022, 8:34:36 PM [warn] Command[31] Receipt of an error code: Invalid Value
2/25/2022, 8:34:36 PM [error] [MQTT => Panel] Failed to send toggle bypass command on zone 9
2/25/2022, 8:35:10 PM [info] [MQTT => Panel] Received bypass zone command true on topic riscopanel/alarm/zone/17-bypass/set for zone 7
2/25/2022, 8:35:11 PM [info] [MQTT => Panel] toggle bypass command sent on zone 7
2/25/2022, 8:36:07 PM [info] [MQTT => Panel] Received bypass zone command true on topic riscopanel/alarm/zone/21-bypass/set for zone 1
2/25/2022, 8:36:07 PM [warn] Command[1] Receipt of an error code: Invalid Value
2/25/2022, 8:36:07 PM [error] [MQTT => Panel] Failed to send toggle bypass command on zone 1
2/25/2022, 8:36:25 PM [info] [MQTT => Panel] Received bypass zone command true on topic riscopanel/alarm/zone/21-bypass/set for zone 1
2/25/2022, 8:36:26 PM [warn] Command[6] Receipt of an error code: Invalid Value
2/25/2022, 8:36:26 PM [error] [MQTT => Panel] Failed to send toggle bypass command on zone 1
2/25/2022, 8:36:47 PM [info] [MQTT => Panel] Received bypass zone command true on topic riscopanel/alarm/zone/14-bypass/set for zone 4
2/25/2022, 8:36:47 PM [info] [MQTT => Panel] Zone is already on the desired bypass state

Additional context Add any other context about the problem here.

markxroberts commented 2 years ago

Additional info - see below command for zone 23 processed on zone 3...

2/25/2022, 8:52:50 PM [info] [MQTT => Panel] toggle bypass command sent on zone 5
2/25/2022, 8:53:08 PM [info] [MQTT => Panel] Received bypass zone command true on topic riscopanel/alarm/zone/25-bypass/set for zone 5
2/25/2022, 8:53:08 PM [info] [MQTT => Panel] Zone is already on the desired bypass state
2/25/2022, 8:54:24 PM [info] [MQTT => Panel] Received bypass zone command true on topic riscopanel/alarm/zone/25-bypass/set for zone 5
2/25/2022, 8:54:24 PM [info] [MQTT => Panel] Zone is already on the desired bypass state
2/25/2022, 8:55:44 PM [info] [MQTT => Panel] Received bypass zone command false on topic riscopanel/alarm/zone/25-bypass/set for zone 5
2/25/2022, 8:55:44 PM [info] [MQTT => Panel] toggle bypass command sent on zone 5
2/25/2022, 8:55:48 PM [info] [MQTT => Panel] Received bypass zone command false on topic riscopanel/alarm/zone/25-bypass/set for zone 5
2/25/2022, 8:55:48 PM [info] [MQTT => Panel] Zone is already on the desired bypass state
2/25/2022, 9:00:57 PM [info] [MQTT => Panel] Received bypass zone command true on topic riscopanel/alarm/zone/23-bypass/set for zone 3
2/25/2022, 9:00:57 PM [info] [MQTT => Panel] Zone is already on the desired bypass state
2/25/2022, 9:01:01 PM [info] [MQTT => Panel] Received bypass zone command true on topic riscopanel/alarm/zone/23-bypass/set for zone 3
2/25/2022, 9:01:01 PM [info] [MQTT => Panel] Zone is already on the desired bypass state\
ob1w4nken0b1 commented 2 years ago

I can confirm that zone bypass works kinda strange...some zones are correctly bypassed while others end up bypassing a different zone.

vanackej commented 2 years ago

I think I see the issue. You have more than 9 zones and the problem is with zone ids >= 10, isn't it ?

markxroberts commented 2 years ago

Yes, that's right. For zones more than 10 it matches to single figure zones less than 10 where the last figure is the same. Wondered whether this had anything to do with the behaviour of the filter function in the code?

vanackej commented 2 years ago

Yes. That's a piece of code that was already existing in the library i forked and I didn't check the regex. I also didn't see the issue because I only have 4 zones in my local setup.