e-mcgee / paradox_platform

Paradox alarm homebridge platform
25 stars 6 forks source link

Triggering alarm crashes homebridge #20

Closed vsidlu closed 6 years ago

vsidlu commented 6 years ago

Hi, its me again :)

when alarm is triggered I get this - [2/21/2018, 5:19:06 PM] [Paradox] Zone open [2/21/2018, 5:19:06 PM] [Paradox] Zone 9 on (Livingroom) [2/21/2018, 5:19:06 PM] [Paradox] Zone:Livingroom [2/21/2018, 5:19:06 PM] [Paradox] Partition status [2/21/2018, 5:19:06 PM] [Paradox] Strobe [2/21/2018, 5:19:06 PM] [Paradox] Statusses: [2/21/2018, 5:19:06 PM] [Paradox] Area 1 - Armed Perimeter [2/21/2018, 5:19:06 PM] [Paradox] Area 2 - Disarmed [2/21/2018, 5:19:06 PM] [Paradox] Partition status [2/21/2018, 5:19:06 PM] [Paradox] Steady alarm [2/21/2018, 5:19:06 PM] [Paradox] Bell status (Partition 1) [2/21/2018, 5:19:06 PM] [Paradox] Bell ON [2/21/2018, 5:19:07 PM] [Paradox] Zone in alarm [2/21/2018, 5:19:07 PM] [Paradox] Zone:Livingroomin alarm.

19106: alarm[receivebuffer[25]-1].accessory.setCharacteristic(Characteristic.SecuritySystemCurrentState, Characteristic.SecuritySystemCurrentState.ALARM_TRIGGERED);

19106: TypeError: Cannot read property 'accessory' of undefined 19106: at _parsestatus (/usr/lib/node_modules/homebridge-paradox-securitysystem/index.js:546:43) 19106: at Socket.client.on (/usr/lib/node_modules/homebridge-paradox-securitysystem/index.js:1261:21) 19106: at emitOne (events.js:96:13) 19106: at Socket.emit (events.js:188:7) 19106: at readableAddChunk (_stream_readable.js:176:18) 19106: at Socket.Readable.push (_stream_readable.js:134:10) 19106: at TCP.onread (net.js:559:20)

Time ago I discovered this plugin - https://github.com/grover/homebridge-automation-switches/blob/master/docs/SecuritySystem.md and there is also possibility to trigger alarm. So I can make rule in homekit to trigger alarm if motion sensor is triggered when I am not at home. I can use also motion sensors witch are not connected to Paradox security system. Or make panic button.

thanks in advance for replay!

e-mcgee commented 6 years ago

Can you share your config.json (mask out the password and sensitive info)?

vsidlu commented 6 years ago

Here it is:

{ "bridge": { "name": "-", "username": "-", "port": -, "pin": "-" }, "description": "This is our Homebridge configuration file", "platforms": [ { "platform": "config", "port": -, "log": "-", "restart": "sudo systemctl restart homebridge.service" }, { "platform": "Paradox", "ip": "-", "port": -, "password": "-", "mqtt": false, "mqtturl": "-", "qos": 0, "retain": false, "mqttusername": "-", "mqttpassword": "-", "logindelay": 400, "polldelay": 5000, "waitafterlogin": 600, "delaybetweencmds": 550, "logoutdelay": 500, "logindelayafterreconnect": 1000, "accessories": [ { "name": "Alarm_Partition_1", "config": { "type": "Alarm", "partition": 0, "topic": "Paradox/partition1/" } }, { "name": "inactive", "config": { "type": "Alarm", "partition": 1, "topic": "Paradox/partition2/" } }, { "name": "Connected", "config": { "type": "Connected" } }, { "name": "Entrance", "config": { "type": "Motion Sensor", "zone": 1, "topic": "Paradox/motionsensor1/" } }, { "name": "Guestroom", "config": { "type": "Motion Sensor", "zone": 2, "topic": "Paradox/motionsensor1/" } }, { "name": "Bathroom", "config": { "type": "Motion Sensor", "zone": 3, "topic": "Paradox/motionsensor1/" } }, { "name": "Kids room", "config": { "type": "Motion Sensor", "zone": 4, "topic": "Paradox/motionsensor1/" } }, { "name": "Officeroom", "config": { "type": "Motion Sensor", "zone": 8, "topic": "Paradox/motionsensor1/" } }, { "name": "Livingroom", "config": { "type": "Motion Sensor", "zone": 9, "topic": "Paradox/motionsensor1/" } }, { "name": "WC", "config": { "type": "Motion Sensor", "zone": 0, "topic": "Paradox/motionsensor1/" } }, { "name": "Entrance Door", "config": { "type": "Contact Sensor", "zone": 11, "topic": "Paradox/contactsensor1/" } } ] } ] }

e-mcgee commented 6 years ago

Your config looks fine. I suspect that the partition number is not offset by one so I removed that and will be publishing a new version that we can test. Testing alarm triggering is a bit of a problem so I am glad you were able to pick this up. Unfortunately I am in the middle of implementing a software debounce function so you will need to add the debounce config per zone when using the new version. I am still testing this version so it may be buggy for little while until I sorted it out. I will let you know once the stable version is available and then you will have to modify your config.json by adding the debounce lines.

vsidlu commented 6 years ago

I’ll be happy to help!

e-mcgee commented 6 years ago

OK, the software debounce feature seems to work now so current stable version is 313. You can install this and see if the alarm trigger now works and does not crash anymore. Please let me know. I normally work on the plugin at night so it is a bit difficult to test alarm triggering. My neighbours and wife does not appreciate this when they are trying to sleep ;-)

e-mcgee commented 6 years ago

You will need to update your config.json with the debounceDelay parameter for each zone. Just check out the wiki.

e-mcgee commented 6 years ago

Sorry, I had to update version as my README did not reflect the debounce change. Apologies for that. Please use v314

vsidlu commented 6 years ago

Hi, I added debounceDelay to config.json - made it 600 and it started to crash -

7436: [2/22/2018, 5:18:05 PM] [Paradox] Zone open 7436: [2/22/2018, 5:18:05 PM] [Paradox] Starting debounce delay: 7436: [2/22/2018, 5:18:05 PM] [Paradox] 600 7436: [2/22/2018, 5:18:05 PM] [Paradox] Zone 9 on (Livingroom) 7436: [2/22/2018, 5:18:05 PM] [Paradox] Zone:Livingroom 7436: [2/22/2018, 5:18:05 PM] [Paradox] Stopping debounce 7436: [2/22/2018, 5:18:08 PM] [Paradox] Zone OK 7436: [2/22/2018, 5:18:08 PM] [Paradox] Starting debounce delay: 7436: [2/22/2018, 5:18:08 PM] [Paradox] 600 7436: [2/22/2018, 5:18:08 PM] [Paradox] Zone 9 off (Livingroom) 7436: [2/22/2018, 5:18:08 PM] [Paradox] Zone:Livingroom 7436: [2/22/2018, 5:18:08 PM] [Paradox] Mute : false: [2/22/2018, 5:18:08 PM] [Paradox] Geting Status... 7436: [2/22/2018, 5:18:08 PM] [Paradox] Got status 7436: [2/22/2018, 5:18:08 PM] [Paradox] Results: 7436: [2/22/2018, 5:18:08 PM] [Paradox] Zone 0 off (WC) 7436: [2/22/2018, 5:18:08 PM] [Paradox] Zone 1 off (Entrance) 7436: [2/22/2018, 5:18:08 PM] [Paradox] Zone 2 off (Guestroom) 7436: [2/22/2018, 5:18:08 PM] [Paradox] Zone 3 off (Bathroom) 7436: [2/22/2018, 5:18:08 PM] [Paradox] Zone 4 off (Kids room) 7436: [2/22/2018, 5:18:08 PM] [Paradox] Zone 8 off (Officeroom) 7436: [2/22/2018, 5:18:08 PM] [Paradox] Zone 9 off (Livingroom) 7436: [2/22/2018, 5:18:08 PM] [Paradox] Zone 11 off (Entrance Door) 7436: [2/22/2018, 5:18:08 PM] [Paradox] Alarmstatus :Disarmed

7436: zones[receivebuffer[24]-1].debounce = false;

7436: TypeError: Cannot set property 'debounce' of undefined 7436: at Timeout._onTimeout (/usr/lib/node_modules/homebridge-paradox-securitysystem/index.js:456:61) 7436: at ontimeout (timers.js:386:11) 7436: at tryOnTimeout (timers.js:250:5) 7436: at Timer.listOnTimeout (timers.js:214:5)

what did I wrong?

vsidlu commented 6 years ago

looked at your sample config.json and saw 0 for debounceDelay for motion sensors. changed config.json and now its working. After triggering alarm I get this crash -

[Paradox] Zone open [Paradox] Starting debounce delay: [Paradox] 0 [Paradox] Zone 9 on (Livingroom) [Paradox] Zone:Livingroom [Paradox] Stopping debounce [Paradox] Zone in alarm [Paradox] Zone:Livingroom in alarm. homebridge[2915]: /usr/lib/node_modules/homebridge-paradox-securitysystem/index.js:558 homebridge[2915]:alarm[receivebuffer[25]].accessory.setCharacteristic(Characteristic.SecuritySystemCurrentState, Characteristic.SecuritySystemCurrentState.ALARM_TRIGGERED); homebridge[2915]: ^ homebridge[2915]: TypeError: alarm[receivebuffer[25]].accessory.setCharacteristic is not a function homebridge[2915]: at _parsestatus (/usr/lib/node_modules/homebridge-paradox-securitysystem/index.js:558:52) homebridge[2915]: at Socket.client.on (/usr/lib/node_modules/homebridge-paradox-securitysystem/index.js:1273:21) homebridge[2915]: at emitOne (events.js:96:13) homebridge[2915]: at Socket.emit (events.js:188:7) homebridge[2915]: at readableAddChunk (_stream_readable.js:176:18) homebridge[2915]: at Socket.Readable.push (_stream_readable.js:134:10) homebridge[2915]: at TCP.onread (net.js:559:20)

hope its helping to move on. today I remembered that fire sensors also are connected to paradox. is there way to add also thees sensors to homebridge?

I used WinLoad to mute siren :)

e-mcgee commented 6 years ago

Great thanks. Will look into it. Good idea with muting!

e-mcgee commented 6 years ago

Hi, think I found the bug. I had to add "securitysystemService" to the set Characteristic method in line 558 and 567. I published 315 for you to test thanks.

e-mcgee commented 6 years ago

I will look into the fire sensors as well.

e-mcgee commented 6 years ago

OK I added a smoke sensor accessory in 316. You can test.

e-mcgee commented 6 years ago

I tested by changing one of my motion sensors to a smoke sensor and seems to work pretty well.

vsidlu commented 6 years ago

seems it is working and not hanging on homebridge -

[Paradox] Alarmstatus :Armed Away [Paradox] Zone in alarm [Paradox] Zone:Livingroom in alarm. [Paradox] Alarmstatus :Armed Away [Paradox] Statusses: [Paradox] Area 1 - Armed Away [Paradox] Area 2 - Disarmed [Paradox] Zone OK [Paradox] Starting debounce delay: [Paradox] 0 [Paradox] Zone 9 off (Livingroom) [Paradox] Zone:Livingroom [Paradox] Stopping debounce

also smoke sensor -

[Paradox] Zone open [Paradox] Starting debounce delay: [Paradox] 0 [Paradox] Zone 5 on (Kithcen smoke sensor) [Paradox] Zone:Kithcen smoke sensor [Paradox] Stopping debounce [Paradox] Zone in alarm [Paradox] Zone:Kithcen smoke sensor in alarm.

nice job! thank you!