Security Manager Plugin

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

Re: Security Manager Plugin

I agree, the first one should work. The second won't, because there are states other than "Open" that are insecure. "Stopped" means the door is stopped, neither open nor closed, for example.

This is what I have for this group. I've tested the door lock alone, and it works.
Attachments
Screen Shot 2016-06-18 at 11.56.25 AM 6-18.png
Screen Shot 2016-06-18 at 11.56.25 AM 6-18.png (317.1 KiB) Viewed 4665 times

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

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

Re: Security Manager Plugin

Ok, I tested it and everything worked for me, I wonder if you have a different state backwards - or maybe my test is flawed, but I did this:

Created a device to match yours:
Code: Select all
         <State id="doorStatus">
            <ValueType>String</ValueType>
            <TriggerLabel>Current device state</TriggerLabel>
            <ControlPageLabel>Current device state</ControlPageLabel>
         </State>
         
         <State id="doorStatus.closed">
            <ValueType>Boolean</ValueType>
            <TriggerLabel>Current device state</TriggerLabel>
            <ControlPageLabel>Current device state</ControlPageLabel>
         </State>


With an action to toggle the doorClosed.closed state:
Code: Select all
def TEST (self, devAction):
      dev = indigo.devices[devAction.deviceId]
      
      if dev.states["doorStatus.closed"]:
         dev.updateStateOnServer ("doorStatus.closed", False)
      else:
         dev.updateStateOnServer ("doorStatus.closed", True)
         
      indigo.server.log(unicode(dev.states))


Then I created that device in Indigo and linked a new security module to it:
Screen Shot 2016-06-18 at 11.37.47 AM.png
Device list
Screen Shot 2016-06-18 at 11.37.47 AM.png (23.39 KiB) Viewed 4651 times
Screen Shot 2016-06-18 at 11.38.13 AM.png
Security Manager Device
Screen Shot 2016-06-18 at 11.38.13 AM.png (82.07 KiB) Viewed 4651 times


I created a button on my control page to run the toggle action. When I toggle it on (true):
Screen Shot 2016-06-18 at 11.39.04 AM.png
Toggle Action On
Screen Shot 2016-06-18 at 11.39.04 AM.png (14.77 KiB) Viewed 4651 times
Screen Shot 2016-06-18 at 11.39.36 AM.png
Toggle On States
Screen Shot 2016-06-18 at 11.39.36 AM.png (16.42 KiB) Viewed 4651 times


And when I toggle it off (false):
Screen Shot 2016-06-18 at 11.40.30 AM.png
Toggle Off Device
Screen Shot 2016-06-18 at 11.40.30 AM.png (14.73 KiB) Viewed 4651 times
Screen Shot 2016-06-18 at 11.40.58 AM.png
Toggle Off States
Screen Shot 2016-06-18 at 11.40.58 AM.png (15.54 KiB) Viewed 4651 times


Does that seem like a legit test?

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 11:56 am
Colorado4Wheeler offline
User avatar
Posts: 2794
Joined: Jul 20, 2009
Location: Colorado

Re: Security Manager Plugin

Another thought, try setting up the way you think it should work and then reload the plugin, perhaps the states aren't updating properly when you first create the device. This is one of the things I corrected in later libraries that I need to apply to this plugin just to be safe.

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 11:58 am
FlyingDiver offline
User avatar
Posts: 7189
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Security Manager Plugin

Another thought, try setting up the way you think it should work and then reload the plugin, perhaps the states aren't updating properly when you first create the device. This is one of the things I corrected in later libraries that I need to apply to this plugin just to be safe.


I think I did that, but I'll try again to be sure.

Can you run your test again, but with this as the status definition for the device?


Code: Select all
         <State id="doorStatus">
            <ValueType>
               <List>
                  <Option value="open">Open</Option>
                  <Option value="closed">Closed</Option>
                  <Option value="stopped">Stopped</Option>
                  <Option value="opening">Opening</Option>
                  <Option value="closing">Closing</Option>
               </List>
            </ValueType>
         </State>


That's the actual definition, and is based on how I was told enumerated states should be defined.

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

Posted on
Sat Jun 18, 2016 12:03 pm
Colorado4Wheeler offline
User avatar
Posts: 2794
Joined: Jul 20, 2009
Location: Colorado

Re: Security Manager Plugin

I'll try that after lunch and see if it comes out differently. One way or the other we'll get you working this weekend :)

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 12:07 pm
FlyingDiver offline
User avatar
Posts: 7189
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Security Manager Plugin

It's also quite possible the MyQ plugin isn't setting states properly. All I see in the states inspector panel is "doorState=Closed", which SHOULD mean that doorState.closed=true. According to how I was told enumerated states work.

I'm considering switching the device type to relay rather than custom and just adding doorState as an additional state. More code logic needed to set the onOffState properly, but the bonus would be that there would be On/Off (Open/Close) buttons on the device panel.

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

Posted on
Sat Jun 18, 2016 12:08 pm
Colorado4Wheeler offline
User avatar
Posts: 2794
Joined: Jul 20, 2009
Location: Colorado

Re: Security Manager Plugin

Ok, I just did that and everything still works hunky dorey.

Code: Select all
<State id="doorStatus">
            <ValueType>
               <List>
                 <Option value="open">Open</Option>
                 <Option value="closed">Closed</Option>
                 <Option value="stopped">Stopped</Option>
                 <Option value="opening">Opening</Option>
                 <Option value="closing">Closing</Option>
               </List>
            </ValueType>
            <TriggerLabel>Current device state</TriggerLabel>
            <ControlPageLabel>Current device state</ControlPageLabel>
         </State>


Code: Select all
def TEST (self, devAction):
      dev = indigo.devices[devAction.deviceId]
      
      if dev.states["doorStatus"] == "open":
         dev.updateStateOnServer ("doorStatus", "closed")
      else:
         dev.updateStateOnServer ("doorStatus", "open")
         
      indigo.server.log(unicode(dev.states))

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 5:48 pm
Colorado4Wheeler offline
User avatar
Posts: 2794
Joined: Jul 20, 2009
Location: Colorado

Re: Security Manager Plugin

FD, did you figure this out?

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 6:02 pm
FlyingDiver offline
User avatar
Posts: 7189
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Security Manager Plugin

Colorado4Wheeler wrote:
FD, did you figure this out?


Yeah, late this afternoon when I was working on the MyQ plugin. Case mismatch. At least, that's what I think it was. Of course, now it's a relay device and I can just use the On/Off state instead. :D

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

Posted on
Fri Aug 26, 2016 8:58 am
whmoorejr offline
User avatar
Posts: 762
Joined: Jan 15, 2013
Location: Houston, TX

Re: Security Manager Plugin

This may be my new favorite plugin.

Security wise, there is a lot of stuff I track at my house.... motion sensors, doors, windows, etc. I have triggers and variables that track how many times the states of these devices change during the day (it resents all my "counters" at night). If I change house modes or leave the house, all the counters are zeroed out and indigo sends me a text to let me know. (hey, you left the house, all security counters set to zero). When my geofence detects me coming home, I get a roll up of all the counters.... but I have to scroll through a long ass text to see if anything is greater than zero and evaluate it.

My goal with your plugin is to create a counter for it that sets to zero whenever all devices are "Secure". Any change from any device to "insecure" would increase the counter by 1. On return to my house, if the counter is still zero, a simple text "Still Secure" or it could even trigger a separate light on the patio or something so when my wife or I approach the house, we can tell at a glance that our house has remained secured in our absence.

Thank you for writing this and I can't wait till I have more free time to play with it some more.

Bill
My Plugin: My People

Posted on
Fri Aug 26, 2016 9:16 am
Colorado4Wheeler offline
User avatar
Posts: 2794
Joined: Jul 20, 2009
Location: Colorado

Re: Security Manager Plugin

whmoorejr wrote:
This may be my new favorite plugin.


Thank you for the kudos, it's always nice to hear success stories! The reasons you like it are pretty much the reasons I wrote it, I needed that kind of functionality in my own house and had a series of triggers and actions and scripts to accomplish it, this makes things easier for me and I'm glad it makes them easier for you too!

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