Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can ELK M1 alarm trigger Homekit automation #41

Open
Turnabout1 opened this issue Sep 28, 2022 · 5 comments
Open

Can ELK M1 alarm trigger Homekit automation #41

Turnabout1 opened this issue Sep 28, 2022 · 5 comments

Comments

@Turnabout1
Copy link

Hello,
Would like to be able to trigger Homekit automation (turn on lights, etc.)when ELK alarm is triggered. Is this possible using this plugin?

Thank you!

@paulw11
Copy link
Owner

paulw11 commented Nov 1, 2022

It doesn't seem possible to create automation triggers in HomeKit based on the state of an alarm (which I think would be a useful feature - You can submit it to Apple as a feature request).

I haven't investigated too much, but it certainly seems like the sort of thing you could build with Homebridge pretty easily. using a logic plug in. You may need to use some M1 wiring and configuration so that you have an output that changes state when the alarm sounds and this is connected to an input. You could then write a HomeKit rule that controlled lights based on that input state changing (It would be a movements sensor in HomeKit for example).

Unfortunately my day job keeps me pretty busy, but I can see how I could add a support for a "phantom" output from this plugin that would avoid the M1 config and wiring.

I will keep this issue open to track that as an idea

@Turnabout1
Copy link
Author

Turnabout1 commented Nov 2, 2022 via email

@kristiandg
Copy link

kristiandg commented May 27, 2023

Here's a possible work-around for you. This was a little trick I used over on HAI, which had "Flags" (virtual "switches") before I started using HomeBridge...

Of course, as I was typing this out, I discovered that Counter status doesn't appear to be extended to the Plugin. If the plugin could be updated to support Counter status, that would be great, as it would give you the ability to extend whatever flags/data you like between non-compatible systems (or missing HomeKit features). You may also be able to use the higher-end outputs that don't have physical hardware to achieve this (thus, making them virtual) - you'd have to test - but it lists 64 on the core controller, and there's really only like 16, so if you don't have expansion output modules, you might be able to use 17-64 as "virtual").

Create the following Counter/Output:
Disarmed
Armed
Armed-Stay
Armed-Away
Armed-Night
Armed-Vacation

Then create the following rules:
Whenever Security Disarmed > Set Counter_Disarmed = 1 (or Output ON)
& Set Counter_Armed = 0 (or Output OFF)
& Set Counter_Armed-Stay = 0 (or Output OFF)
& Set Counter_Armed-Away = 0 (or Output OFF)
& Set Counter_Armed-Night = 0 (or Output OFF)
& Set Counter_Armed-Vacation = 0 (or Output OFF)

Whenever Security Armed to Any Mode>Set Counter_Armed = 1 (or Output ON)
& Set Counter_Disarmed = 0 (or Output OFF)

Whenever Security Armed-Stay > Set Counter_Armed-Stay = 1 (or Output ON)
& Set Counter_Armed-Away = 0 (or Output OFF)
& Set Counter_Armed-Night = 0 (or Output OFF)
& Set Counter_Armed-Vacation = 0 (or Output OFF)

Whenever Security Armed-Away > Set Counter_Armed-Away = 1 (or Output ON)
& Set Counter_Armed-Stay = 0 (or Output OFF)
& Set Counter_Armed-Night = 0 (or Output OFF)
& Set Counter_Armed-Vacation = 0 (or Output OFF)

Whenever Security Armed-Night > Set Counter_Armed-Night = 1 (or Output ON)
& Set Counter_Armed-Stay = 0 (or Output OFF)
& Set Counter_Armed-Away = 0 (or Output OFF)
& Set Counter_Armed-Vacation = 0 (or Output OFF)

Whenever Security Armed-Vacation > Set Counter_Armed-Vacation = 1 (or Output ON)
& Set Counter_Armed-Stay = 0 (or Output OFF)
& Set Counter_Armed-Away = 0 (or Output OFF)
& Set Counter_Armed-Night = 0 (or Output OFF)

All the extra counters to 0 may seem redundant, but I've had weird situations in the past where the controller got out of sync with reality (a power cycle, a crash, whatever), so since you'd have other things relying on these status modes, I always just true up the status every time there's a change. Heck, even running it every few minutes to ensure the status is correct is something I've done before. :)

I also create a "room" in HomeKit called "SYSTEM - DO NOT EDIT" (with a red background), and that's where I store all these virtual items for programming. You'd put all these Counters/Outputs in there, then program away. Hopefully the customer understands "Do Not Edit" means "don't effin' touch it". It's also where I sometimes put fire zones (if it's structured fire/smoke and contains several rooms in the zone).

So, if you're able to do the above, then you'll have a handful of switches that are extending the security status into HomeKit for you to do other things with. The downside is, these are switches, not sensors. In an ideal world, you could actually see these as sensors instead (so you couldn't control them - we had that option over on HAI). That's how I'd envision the counters working (versus outputs): If 0, consider as off/closed, if greater than 0, consider as on/open (no ability to edit, just a sensor, so delivering status only).

Now, here's a fun additional one for you:
Do you remember those old car alarms that would beep twice when disarmed (but would beep 4 times if you disarmed and they had been set off?)...

Create a counter called:
AlarmHistory:

Rules:
Whenever Burglar Alarm Area 1 (or AnyAlarmType if you like) > Change Counter_AlarmHistory = Add 1
Whenever Security-Disarmed (I really wanted "Acknowledged", but couldn't find) > Wait 10s > Change Counter_AlarmHistory = 0

(The "wait" on Elk may need to be achieved by a counter/custom setting timer that counts down from 10, then the rule clears the AlarmHistory)

Now, you have a flag/indicator when the alarm had been tripped in your absence. So now, in HomeKit you make a Shortcut:
When Security Disarmed
& if AlarmHistory = On
Then: Flash Front Door Light 4 times & Flash Garage Light 4 times (4 flashes means there was an alarm)
Else: Flash Front Door Light 2 times & Flash Garage Light 2 times (2 flashes just means disarmed)

When Security Armed
Flash Front Door Light 1 time & Flash Garage Light 1 time (1 flash means armed)

So now, when you disarm your home, if it's been set off while you were gone, you'll see a special light flash and know to possibly enter with caution.

Yeah, I know this was long, and probably not the right place for it, but this was to hopefully give you a work around while HomeKit gives you what you want.

@paulw11
Copy link
Owner

paulw11 commented Sep 11, 2023

Does your key code begin with a 0 by any chance? I just noticed an inconsistency in the plugin between defining the keypad code as an integer and a string. As an integer any leading 0 would be lost.

@kristiandg
Copy link

kristiandg commented Sep 11, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants