Security Manager Plugin

Posted on
Tue May 24, 2016 8:30 am
Colorado4Wheeler offline
User avatar
Posts: 2794
Joined: Jul 20, 2009
Location: Colorado

Security Manager Plugin

Introduction

Security Manager monitors devices you specify to see if your house is secure. The concept is relatively simple, if your device or devices are not in a state that indicates security (i.e., garage door is closed and front door is locked) then the plugin indicates that your house is not secured by toggling its own state on and off.

You should be able to use any device in your network in this plugin because not only does it allow for standard devices such as On/Off and I/O but lets you specify a custom set of parameters based on the states that a device may have.

Because the plugin is a device you can trigger from it, such as "if Security is off and it's after 9PM then turn on lights and send me a text message". I also use it as a visual indication in my control pages, a big red light when the house is not secure and a green on when it is.

The plugin will monitor in real time the state of all devices specified, so you will get instant results. For example, when you unlock the front door the plugin will immediately change from "On" (being secure) to "Off" (being insecure), so once you set this it should be done.

Download and Installation

Install according to the Indigo documentation, then create a new Security Manager device and specify the devices you want to include in the group as well as what state indicates not being secure.

Download Plugin (Indigo File Library)

Release Notes

  • May 26, 2016 (1.0.2):
    • BUG Fix - Device validation issue fixed when creating a new device
  • May 25, 2016 (1.0.1):
    • Change - For boolean values you can now use any variation of the words true and false instead of being forced to use all lowercase letters
  • May 24, 2016 (1.0.1):
    • Initial release

Configuration and Use

Each plugin device supports four devices, one of which can be another Security Manager plugin device. In this way you can monitor an unlimited number of devices to monitor as well as be able to break down your home security into zones (i.e., bedroom security, front door security, garage security, etc).

Add up to four devices per plugin device, you goal is to set this that if any of these devices are in the state you specify then it is NOT secure. If you have multiple Security Manager devices you can link them into any other Security Manager device and it knows that if that device is not secure then this group will fail security as well.

Screen Shot 2016-05-24 at 7.56.15 AM.png
Screen Shot 2016-05-24 at 7.56.15 AM.png (71.79 KiB) Viewed 14647 times


Advanced

The options are fairly self explanatory, only one bears a bit more explanation - Advanced Custom Devices. If you want to really dial the plugin in then you can use any state of any device but you will need to know what the EXACT state name is as well as the EXACT value that determines it is insecure. The button "Show States In Log" will help you figure this out and will dump all of the states of the selected device to the log so you can see which one you want to use.

When it comes to naming, note that "onoffstate" is different than "onOffState" so make sure the state name is exactly as the log dump shows. For the value it's a little tricky since there can be so many different types of states (boolean, string, number, etc) so the current way to configure that is:

    If the state is boolean then use either true or false as the value (WITHOUT quotes), the plugin will properly interpret that as boolean. You can use any variation of the word true or false (True, true, TRUE, TrUe, etc)
    If the state is a string the surround the value with double quotes, i.e., if state UIDeviceState is "on"
    A non quoted value is literal and should generally be a number

Examples of Use
  • Example: When the garage door I/O linc is off (door is open) and the door lock is off (unlocked) then we are insecure, therefore the device shows a state of Off
    • Trigger: When the Security Group changes to Off say "The house is not secure"
    • Control Page: A button configured for the On/Off state of the Security Group that changes color depending on if the group is secure (On) or insecure (Off):
      • Image 1: Button.png (Off state, insecure)
      • Image 2: Button+on.png (On state, secure)
  • Example: In addition to the Security Group in the first example, a second Security Group device is created to check if various motion sensors are On or Off:
    • Device: Create a Security Group device for the locks
    • Device: Create a Security Group device for the motion sensors
    • Device: Create a Security Group device for the other two Security Group devices that serves as the master "is secure" device in Indigo, if either device 1 or 2 are insecure then this device is insecure as well

My Modest Contributions to Indigo:

HomeKit Bridge | Device Extensions | Security Manager | LCD Creator | Room-O-Matic | Smart Dimmer | Scene Toggle | Powermiser | Homebridge Buddy

Check Them Out Here

Posted on
Tue May 24, 2016 3:11 pm
Coolcaper offline
Posts: 299
Joined: Aug 30, 2013
Location: Australia

Re: New Plugin: Security Manager

Thanks again! Makes many of my security triggers obsolete now.

Posted on
Tue May 24, 2016 3:43 pm
durosity offline
User avatar
Posts: 4320
Joined: May 10, 2012
Location: Newcastle Upon Tyne, Ye Ol' England.

Re: New Plugin: Security Manager

Mine too!

Computer says no.

Posted on
Tue May 24, 2016 3:58 pm
Colorado4Wheeler offline
User avatar
Posts: 2794
Joined: Jul 20, 2009
Location: Colorado

Re: New Plugin: Security Manager

Mine too actually, lol. :mrgreen:

My Modest Contributions to Indigo:

HomeKit Bridge | Device Extensions | Security Manager | LCD Creator | Room-O-Matic | Smart Dimmer | Scene Toggle | Powermiser | Homebridge Buddy

Check Them Out Here

Posted on
Tue May 24, 2016 7:52 pm
kw123 offline
User avatar
Posts: 8333
Joined: May 12, 2013
Location: Dallas, TX

New Plugin: Security Manager

You could test with
unicode(varvalue).lower()

Then True true TRUE and bool would all be true

That would reduce some of the variations.



Sent from my iPhone using Tapatalk

Posted on
Tue May 24, 2016 11:19 pm
GlennNZ offline
User avatar
Posts: 1555
Joined: Dec 07, 2014
Location: Central Coast, Australia

Re: New Plugin: Security Manager

Hi
Thanks a lot for this - looks very useful. :P
Cheers
Glenn

Posted on
Wed May 25, 2016 7:56 am
Colorado4Wheeler offline
User avatar
Posts: 2794
Joined: Jul 20, 2009
Location: Colorado

Re: New Plugin: Security Manager

kw123 wrote:
You could test with
unicode(varvalue).lower()
Then True true TRUE and bool would all be true
That would reduce some of the variations.


Good suggestion, thanks. Actually I was more concerned with dealing with numbers than anything since everything in Indigo will type() to unicode so once I moved on past booleans I didn't give it a second thought but I think I'll incorporate your suggestion in.

My Modest Contributions to Indigo:

HomeKit Bridge | Device Extensions | Security Manager | LCD Creator | Room-O-Matic | Smart Dimmer | Scene Toggle | Powermiser | Homebridge Buddy

Check Them Out Here

Posted on
Wed May 25, 2016 8:17 am
Colorado4Wheeler offline
User avatar
Posts: 2794
Joined: Jul 20, 2009
Location: Colorado

Re: New Plugin: Security Manager (Update to 1.0.1)

The file linked in the original post is now version 1.0.1.

Thanks to kw123's suggestion, the following change has been made for 1.0.1:
- For boolean values you can now use any variation of the words true and false instead of being forced to use all lowercase letters

My Modest Contributions to Indigo:

HomeKit Bridge | Device Extensions | Security Manager | LCD Creator | Room-O-Matic | Smart Dimmer | Scene Toggle | Powermiser | Homebridge Buddy

Check Them Out Here

Posted on
Wed May 25, 2016 11:09 am
roquej offline
User avatar
Posts: 608
Joined: Jan 04, 2015
Location: South Florida, USA

Re: New Plugin: Security Manager

First, thank you for creating it. Second, trying the plugin, as it might make my security triggers easier to manage. However, getting the following error:

EPS - Security Manager Error Error in plugin execution UiValidate:

Traceback (most recent call last):
File "plugin.py", line 168, in validateDeviceConfigUi
File "plugin.py", line 63, in updateSecurityGroup
File "plugin.py", line 82, in deviceInsecure
KeyError: key deviceone not found in dict

Using version 1.01. getting the error with fairly much any device.

Any suggestion?

JP

Posted on
Wed May 25, 2016 11:24 am
Colorado4Wheeler offline
User avatar
Posts: 2794
Joined: Jul 20, 2009
Location: Colorado

Re: New Plugin: Security Manager

Interesting, I don't get that error on mine. Can you create an action group to run the following script and post the results:

Code: Select all
indigo.server.log(unicode(indigo.devices[YOURDEVICEID]))


Just make sure to replace "YOURDEVICEID" with the id of the Security Manager device (right click on the device and select "Copy ID").

My Modest Contributions to Indigo:

HomeKit Bridge | Device Extensions | Security Manager | LCD Creator | Room-O-Matic | Smart Dimmer | Scene Toggle | Powermiser | Homebridge Buddy

Check Them Out Here

Posted on
Thu May 26, 2016 1:21 pm
roquej offline
User avatar
Posts: 608
Joined: Jan 04, 2015
Location: South Florida, USA

Re: New Plugin: Security Manager

Sorry for the delay.

Again, I get the following error when I try saving after assigned a device to the group:

EPS - Security Manager Error Error in plugin execution UiValidate:

Traceback (most recent call last):
File "plugin.py", line 168, in validateDeviceConfigUi
File "plugin.py", line 63, in updateSecurityGroup
File "plugin.py", line 82, in deviceInsecure
KeyError: key deviceone not found in dict

The error log, as per your suggestion is:

May 26, 2016, 3:19:13 PM
Action Group Test Security Group
Script address :
batteryLevel : None
buttonGroupCount : 0
configured : False
description :
deviceTypeId : epssecm
displayStateId : onOffState
displayStateImageSel : None
displayStateValRaw : False
displayStateValUi : off
enabled : True
energyAccumBaseTime : None
energyAccumTimeDelta : None
energyAccumTotal : None
energyCurLevel : None
errorState :
folderId : 1848949992
globalProps : MetaProps : (dict)
id : 1775547127
lastChanged : 2000-01-01 00:00:00
model : Security Group
name : Security Group-Entry Sensors
ownerProps : com.eps.indigoplugin.security-manager : (dict)
pluginId : com.eps.indigoplugin.security-manager
pluginProps : emptyDict : (dict)
protocol : Plugin
remoteDisplay : True
states : States : (dict)
onOffState : off (on/off bool)
subModel :
supportsAllLightsOnOff : False
supportsAllOff : False
supportsStatusRequest : False
version : 0

JP

Posted on
Thu May 26, 2016 2:27 pm
Colorado4Wheeler offline
User avatar
Posts: 2794
Joined: Jul 20, 2009
Location: Colorado

Re: New Plugin: Security Manager

Ok, I am able to replicate the problem, let me get to the bottom of it and I'll let you know (and post an updated version).

My Modest Contributions to Indigo:

HomeKit Bridge | Device Extensions | Security Manager | LCD Creator | Room-O-Matic | Smart Dimmer | Scene Toggle | Powermiser | Homebridge Buddy

Check Them Out Here

Posted on
Thu May 26, 2016 2:54 pm
Colorado4Wheeler offline
User avatar
Posts: 2794
Joined: Jul 20, 2009
Location: Colorado

Re: New Plugin: Security Manager (Update to 1.0.2)

The file linked in the original post is now version 1.0.2.

- Device validation issue fixed when creating a new device

The validation I had in place will need to be re-written a bit, so in order to make sure things are functional I removed the extra bit causing the problem, this means after you create your device it will not check all devices in the group upon saving to see if they are secure, you will need to "prime the pump" one time by toggling one of your security devices (or wait until they change state naturally if you don't mind waiting for it).

So when you create a new Security Group the default is that it will be "Off" and, thus, insecure until one of the devices in the group changes states. I'll work on making the dialog close do an instant validation but wanted to get this released ASAP since it was a bug.

My Modest Contributions to Indigo:

HomeKit Bridge | Device Extensions | Security Manager | LCD Creator | Room-O-Matic | Smart Dimmer | Scene Toggle | Powermiser | Homebridge Buddy

Check Them Out Here

Posted on
Sat Jun 18, 2016 8:22 am
FlyingDiver offline
User avatar
Posts: 7189
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Security Manager Plugin

I have some devices that I'd like to add to a security group where I need to test for a specific enumerated state to be true or false. I tried to set it up for a custom device to be a value of "false", but I don't think it's working. Here's the state dump for the device:

Code: Select all
     doorStatus : Open (string)
     doorStatus.closed : false (bool)
     doorStatus.closing : false (bool)
     doorStatus.open : false (bool)
     doorStatus.opening : false (bool)
     doorStatus.stopped : false (bool)

Can I do a test for doorStatus.closed = False?

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Sat Jun 18, 2016 9:47 am
Colorado4Wheeler offline
User avatar
Posts: 2794
Joined: Jul 20, 2009
Location: Colorado

Re: Security Manager Plugin

Neither of these two things work? I need to update this plugin a little bit as I've done a lot of specialty coding for states that I want to incorporate into this one as well, but theoretically one of these two statements should work:
Attachments
Screen Shot 2016-06-18 at 9.45.32 AM.png
Screen Shot 2016-06-18 at 9.45.32 AM.png (84.83 KiB) Viewed 13869 times

My Modest Contributions to Indigo:

HomeKit Bridge | Device Extensions | Security Manager | LCD Creator | Room-O-Matic | Smart Dimmer | Scene Toggle | Powermiser | Homebridge Buddy

Check Them Out Here

Who is online

Users browsing this forum: No registered users and 2 guests