EHylands / homebridge-qolsys

Homebridge Qolsys IQ Panel plugin
MIT License
17 stars 1 forks source link

Night Arm mode support when Night Arm Mode enabled on IQ 4 #39

Open cistearns opened 5 months ago

cistearns commented 5 months ago

Is it now possible to have Night Mode support enabled and functional in HomeKit, when the IQ4 also does have a Night Zone enabled which enables Night Arm on the panel?

I know there was the problem with it showing up in HomeKit when it shouldn't, but ideally it should show up when available, and I'm not seeing that.

To enabled Night Mode support on the IQ4 (versions 4.4.0 or newer) you would set a Motion Sensor to Type 21. If you set all motion sensors that are currently on type 17 to type 21 then functionally the panel behaves the same except there is now a Night Arm mode available. If you leave any motion sensor on 17, then that motion sensor will trigger an alarm if the panel is set to Night Mode in addition to Away Mode.

cistearns commented 5 months ago

Not that when Arming in Night Mode, it likely should take similar params as Away - since it makes use of the delay under the assumption that you need to make you way from a monitored area to say a bedroom upstairs.

EHylands commented 5 months ago

Hi @cistearns were you able to run the plugin with "show panel debug information" and capture the command received from panel when night mode is enabled ?

I doubt we can discover if night mode is available from the C4 interface.

It can be enabled as a config option though

cistearns commented 5 months ago

One way to tell is if the group for the motion sensor is set to "nightmotion" If one of those exists then Night Arming is available. I don't know if you had already been parsing out the group info, in the JSON, since those details mostly impact panel alarm behaviors. Here is an example: {"id":"xxxxxx","type":"Motion","name":"Night Motion","group":"nightmotion","status":"Closed","state":"0","zone_id":9,"zone_physical_type":2,"zone_alarm_type":10,"zone_type":2,"partition_id":0}

The arming message we receive is: Received: {"event":"ARMING","arming_type":"ARM_NIGHT","partition_id":0,"version":1,"requestID":"ee2ed2b7-f951-4b28-acf2-d42517c56cc4"} Which we throw an error on since we don't know the arming type.

Personally after messing with it a bit more, my own person use case for it likely won't workout. But this still might be something useful for others.

Side note I'v been getting more JSON ERROR OR PARTIAL MESSAGE errors lately when we pull the info from C4 and then it works on a retry. Are there some fixed length buffers having issues with large lists or is this an issue on the panel side?

EHylands commented 5 months ago

I could automatically add the night mode if any zone group in the partition is set to nightmotion.

A downside I foresee is that for any changes to occur with the security accessory, it needs to be deleted and readded, loosing any configured automations in the process. (You need to delete the accessory in the config file, restart homebridge, readd the accessory in config, restart homebridge..)

EHylands commented 5 months ago

Side note I'v been getting more JSON ERROR OR PARTIAL MESSAGE errors lately when we pull the info from C4 and then it works on a retry. Are there some fixed length buffers having issues with large lists or is this an issue on the panel side?

The panel sends every json packet line by line. A packet can be split over multiple lines if too big.

The plugin reassembles every line sent and checks if it's valid json data.

There may be some occurrences where the end of one packet and the beginning of a new one is sent on a single line, and that would be considered as invalid data for the moment. I have not documented any occurrence of this happening with my limited setup. If you can document any failure in logfile, I could finetune the packet reassembly process!

cistearns commented 1 month ago

I could automatically add the night mode if any zone group in the partition is set to nightmotion.

A downside I foresee is that for any changes to occur with the security accessory, it needs to be deleted and readded, loosing any configured automations in the process. (You need to delete the accessory in the config file, restart homebridge, readd the accessory in config, restart homebridge..)

Sorry I didn't get back on this sooner. I think we could just add a config option that the user can choose to indicate if their panel has any Night Zones setup,. Default the setting to false. When false, and we get a ARM_NIGHT event just map it to the same as Stay (though Away is also a valid mapping). When the config is true support the Night mode.

Using the config option makes it opt in, so people can set this up, but otherwise we at least capture the arming state rather than dropping it completely.