Jump to content


Photo
- - - - -

[download] Module: DoorMinder - intelligent monitoring of doors and windows


  • Please log in to reply
36 replies to this topic

#1 123

123

    Cocoonut

  • Registered
  • PipPipPipPip
  • 2170 posts
  • Location:Montreal, QC
  • Experience:average
  • Software:Premise
  • Hardware:Elk M1

Posted 14 March 2009 - 04:16 PM

Posted Image

File Name: Module: DoorMinder - intelligent monitoring of doors and windows
File Submitter: 123
File Submitted: 14 Mar 2009
File Updated: 30 Mar 2009
File Category: Premise
Author: 123
Contact: PM me
Version: 1.3

>>> Introduction

DoorMinder is a Module that adds the following features to all Door, GarageDoor, and Window objects:
  • Annunciator
    Announces when a door or window is opened/closed.
  • Reminder
    Reminds you when a door or window is left open too long. It can be constrained to operate within a specific time period (when you are home) and only if the exterior temperature warrants it (when the furnace or AC is active).
Here's a typical scenario:
  • It is cold outside.
    The exterior temperature is below 32 F (ReminderLowTemp).
  • You arrive home.
    The time is between 6:00 PM (StartTime) and 11:00 PM (EndTime).
  • You forget to close the garage door.
    The garage door has been left open for longer than 20 minutes (ReminderDelay).
  • You are reminded to close the door.
    A spoken reminder is issued announcing the garage door was left open.
  • You ignore the reminder.
    Reminders are issued every 2 minutes (ReminderPeriod) until the door is closed.
The ability to specify ranges for Time and Temperature ensures that reminders are issued only when appropriate (i.e. when the furnace, or AC, is operating).

DoorMinder is configured with Premise Builder but can also be controlled with Premise Browser (enabled/disabled/paused). For example, if you wish to leave a door open for awhile, you can Pause the Reminder function and it will suspend all reminders for one hour. After one hour, the Reminder function will automatically re-enable itself.

The following features make DoorMinder extremely flexible:

Extends existing objects
DoorMinder is a class extension; it adds new functionality to all Door, GarageDoor, and Window objects. Each object can have unique DoorMinder properties such as AnnunciatorEnabled, ReminderEnabled, ReminderDelay, and the time period.

Module-based
The Module's source code is visible and allows you to customize it. For example:
  • Instead of using the ReminderLowTemp and ReminderHighTemp properties, you could use a Thermostat object's HeatingSetPoint and CoolingSetPoint properties to serve as temperature thresholds.
  • Reminders are normally issued in the form of Text-To-Speech. You can alter the code to transmit email and/or flash a light.
  • A counter keeps track of the number of times a reminder is repeated. You can add logic to take action after the fifth reminder and send a signal to close the garage door.
Supports Premise Browser
The Module provides a new user-interface for all Door and Windows. It displays the current state of the Annunciator and Reminder functions (enabled/disabled/paused) plus the state of the Door (open/closed). If the Occupancy module is installed, DoorMinder's UI will also display the last time the Door was opened.


DoorMinder is controlled via the following properties:
  • AnnunciatorEnabled
    Allows you selectively enable/disable the Annunciator function for each door and window.
  • StartTime and StopTime
    Specify hours of the day when the Annunciator is operational. All hours become eligible if StartTime equals EndTime.
  • ReminderEnabled
    Allows you selectively enable/disable the Reminder function for each door and window.
  • ReminderDelay
    Specify the amount of time a door, or window, is left open before a reminder is issued (one or more minutes).
  • ReminderPeriod
    Specify the amount time between repeated reminders (zero or more minutes; zero suppresses repeated reminders). This is the delay time after the first reminder is issued.
  • StartTime and EndTime
    Specify hours of the day when reminders may be issued. All hours become eligible if StartTime equals EndTime.
  • ReminderLowTemp and ReminderHighTemp
    Specify low and high temperature thresholds for each door and window. Reminders will be sent only if the exterior temperature exceeds the thresholds.


>>> Installation
  • Ensure the AutomationBrowser module is installed!
  • Using Premise Builder, import the attached XDO file.


>>> Configuration

You have to specify a source for the exterior temperature value. In Builder, click Modules and navigate to the following function: Modules/DoorMinder/Classes/Reminder/ExceedsTemp
It contains examples of how to set the temperature source using the XML Weather module, a Temperature Probe, and a Thermostat.

You have to specify a means of issuing the Annunciator and Reminder messages. In Builder, click Modules and navigate to the following function: Modules/DoorMinder/Classes/Reminder/PlayReminder
It contains examples of how to use the MSSAPI Speech and ELK M1 drivers to speak the reminder message. Similarly, modify the following function to issue appropriate Annunciator messages: Modules/DoorMinder/Classes/Annunciator/PlayAnnunciator

Monitoring is enabled on an individual basis; set the AnnunciatorEnabled and ReminderEnabled properties for each Door and Window object.

To enable a Time range, adjust StartTime and EndTime. By default, both values are set to 12:00 AM and effectively allow all hours to be eligible (i.e. time is ignored).

To enable the Temperature thresholds, set ReminderLowTemp and ReminderHighTemp. By default, both values are set to 70 F and effectively allow all temperatures to be eligible (i.e. temperature is ignored).

The default values for Time and Temperature are set in the Module and any changes will automatically update all Door and Window objects. If you wish to alter the Module's default values, using Builder click Modules and navigate to the following properties and change them to suit your needs:
Modules/DoorMinder/Classes/Reminder/ReminderLowTemp/DefaultValue
Modules/DoorMinder/Classes/Reminder/ReminderHighTemp/DefaultValue
Modules/DoorMinder/Classes/Reminder/ReminderStartTime/DefaultValue
Modules/DoorMinder/Classes/Reminder/ReminderEndTime/DefaultValue



>>> Addendum
V1.1 - Cosmetic corrections to the user-interface.
V1.2 - Bug fix. Corrected last line of the "PlayReminder" function.
V1.3 - Refined UI's appearance and fixed a bug.

Click here to download this file

#2 123

123

    Cocoonut

  • Registered
  • PipPipPipPip
  • 2170 posts
  • Location:Montreal, QC
  • Experience:average
  • Software:Premise
  • Hardware:Elk M1

Posted 14 March 2009 - 06:51 PM

Here's how to alter the appearance of DoorMinder's user-interface:

Using Premise Builder, navigate to DoorMinder's Plugin: Modules/Plugins/Selectors/ClasslessSelector/DoorMinder

The user-interface (UI) contains several nested elements organized in groups. For example, FunctionControls groups together the Annunciator and Reminder controls. Annunciator itself serves to group together the StateIndicator, Control, and Pause buttons. The upper portion of the first image displays all of DoorMinder's UI elements. The second image identifies the elements in the actual UI.

Each element's appearance is governed by numerous CSS properties. The lower portion of the first image displays some of the CSS properties for the DoorStateIndicator. The key properties are:
  • Position and Size (Left, Top, Width, Height)
  • Color (Color, BackgroundColor)
  • Text appearance (FontFamily, FontSize, FontWeight, TextAlign, etc)
Many CSS properties are dynamically displayed; if you change a CSS property in Builder, Premise Browser will immediately show the results. The easiest way to see your changes is to use a PC with two monitors or two PCs (Builder running on one PC and Browser on the other).

Attached Files


Edited by 123, 15 March 2009 - 09:12 AM.


#3 123

123

    Cocoonut

  • Registered
  • PipPipPipPip
  • 2170 posts
  • Location:Montreal, QC
  • Experience:average
  • Software:Premise
  • Hardware:Elk M1

Posted 30 March 2009 - 02:51 PM

Version 1.3 includes a refined user-interface and a bug fix.

If you open a door and then pause the Reminder function, you are effectively disabling the Reminder function for one hour. If you close the door within the hour, DoorMinder V1.3 will immediately re-enable the Reminder function (i.e. un-pause it). Previous versions of DoorMinder would, after the door was closed, wait out the balance of the remaining hour before re-enabling the Reminder function. Version 1.3 also corrects the operation of the Annunciator function.

If you compare the attached diagram to the previously posted image you'll see the additional components that have been added in order to refine the appearance of DoorMinder's user-interface.

Attached Files



#4 etc6849

etc6849

    Cocoonut

  • Registered
  • PipPipPipPip
  • 1728 posts
  • Location:Irmo, SC
  • Experience:average
  • Software:Premise
  • Hardware:Elk M1
  • Tech:X10-RF, Z-Wave, Custom
  • Phone:OBi100/110

Posted 29 September 2009 - 06:27 PM

Thanks 123, this is very nice!

#5 nov0798

nov0798

    Dedicated Cocooner

  • Registered
  • PipPipPip
  • 530 posts
  • Location:Dumfries, VA
  • Experience:average
  • Software:Premise
  • Hardware:Elk M1
  • Tech:UPB, 1-Wire
  • Phone:VoIP via ISP

Posted 09 November 2010 - 05:14 PM

OK, So if I want to use the ELK M1 driver to say my messages, then I have a few questions. This is the sample code from the module.

Example 2: ELK M1 Driver
' This example demonstrates how to trigger Sentences in the ELK M1 driver.
' You must create Sentences for Door, GarageDoor, and Window objects.
' For example, the "DoorLeftOpen" Sentence can be composed of:
' [800hz_Tone] (53)
' [500ms_Silence] (52)
' Door (146)
' Left (257)
' Open (312)
'
'with Devices.CustomDevices.M1_Panel.Voice
' if this.IsOfExplicitType("sys://Schema/Device/DoorSensor") then
' .DoorLeftOpen.Play = true
' elseif this.IsOfExplicitType("sys://Schema/Device/GarageDoorSensor") then
' .GarageDoorLeftOpen.Play = true
' elseif this.IsOfExplicitType("sys://Schema/Device/WindowSensor") then
' .WindowLeftOpen.Play = true
' end if
'end with

Ok I have some questions.

Do I use the entire script, or just pieces of it?

Where do I use the elk speech codes such as 53,52,146,257, etc?

Where do I place this script?

If I want to use it to tell me the garage door is open, would my script look like this?

with Devices.CustomDevices.M1_Panel.Voice
if this.IsOfExplicitType("sys://Schema/Device/Garage_Door") then
.GarageDoorLeftOpen.Play = true
end if
end with

Thanks
Brian

#6 etc6849

etc6849

    Cocoonut

  • Registered
  • PipPipPipPip
  • 1728 posts
  • Location:Irmo, SC
  • Experience:average
  • Software:Premise
  • Hardware:Elk M1
  • Tech:X10-RF, Z-Wave, Custom
  • Phone:OBi100/110

Posted 12 November 2010 - 08:30 AM

I think I remember that this module uses vbscript and your PC for text to speach by default, but should work with the Elk M1 if you follow the instructions 123 gives. I'm not sure what "modifications" are necessary as I don't have the code in front of me now. My M1G arrived yesterday (have to do a complete install) so if you wait a while, I'll be figuring this out myself and will post the modification :)

It contains examples of how to use the MSSAPI Speech and ELK M1 drivers to speak the reminder message. Similarly, modify the following function to issue appropriate Annunciator messages: Modules/DoorMinder/Classes/Annunciator/PlayAnnunciator


. However, you would need something connected to your soundcards output.

You would need a small modification to the driver to do what you want.

Edited by etc6849, 12 November 2010 - 08:30 AM.


#7 chucklyons

chucklyons

    Dedicated Cocooner

  • Registered
  • PipPipPip
  • 803 posts
  • Software:Premise

Posted 12 November 2010 - 10:51 AM

Given your questions, the script that you're pointing to as the sample script, then your version of that script, and the questions you are asking, the most critical thing you can do is this:

Follow the naming conventions from the sample script that you are work. It will make your life much easier, help you get the feel of how Premise works with objects, and the way you can manipulate objects and their properties to do all kind of 'cool' things.

You have ("sys://Schema/Device/Garage_Door") vs the sample script's ("sys://Schema/Device/GarageDoorSensor"). Nothing wrong with that. Coupled with your question of what part of the script to use, thats why I strongly encourage you to go step by step and follow the naming convention.

Keep plugging away - but starting with a simpler effort than integrating the Elk module into Premise would be a good approach. Like ETC, my Elk is on its way, so I'll be able to give you some better advice. Or maybe asking you for advice :)

Edited by chucklyons, 12 November 2010 - 10:51 AM.


#8 nov0798

nov0798

    Dedicated Cocooner

  • Registered
  • PipPipPip
  • 530 posts
  • Location:Dumfries, VA
  • Experience:average
  • Software:Premise
  • Hardware:Elk M1
  • Tech:UPB, 1-Wire
  • Phone:VoIP via ISP

Posted 12 November 2010 - 03:49 PM

You have ("sys://Schema/Device/Garage_Door") vs the sample script's ("sys://Schema/Device/GarageDoorSensor"). Nothing wrong with that

The reason I used this, is because that is what my sensor is named, so I assumed it should be the same thing in the script, unless Im wrong!

Ive been able to import all the modules so far and all appears to be working correctly, just a steep learning curve for me. As Ive said in the past, once I get to the point where it "clicks" for me, then Ill be fine. Unfortunately, I am a tactile learner, and must do in order to learn. I can read all day, but unless I can do and apply, I get lost. With Premise, its kinda hard to play with anything, well because I dont really understand what it does.

Example:
Ill use the door minder
Door Minder is a module - SOmething that resides within the program that functions independently - I get this!

Within that module, you then have classes - kinda lost on what this is?

Within then Classes properties box, you have an object property, so is the class an object?

Within the Classes, you now have a sub classes, such as Door Minder, which in its property box has provisions for and object property, and a Class property, so is it an object or a class?

If you dig deeper you now have so many other things such as
Scriptlets
Methods, etc, etc.

I get lost on what all these things do.

I wish I had a manual that tears apart one module, and would explain what each sub thing does, or doesnt do, and why you would want to use that or not. Ive read parts of the help section, but sometimes still dont completely understand.

Oh well one day ill get it!

#9 123

123

    Cocoonut

  • Registered
  • PipPipPipPip
  • 2170 posts
  • Location:Montreal, QC
  • Experience:average
  • Software:Premise
  • Hardware:Elk M1

Posted 12 November 2010 - 04:15 PM

...Within that module, you then have classes - kinda lost on what this is?
Within then Classes properties box, you have an object property, so is the class an object?...

Fuhgeddabowdit!

Unless you are planning to create a new Module, you don't need to understand that stuff. Just about everything you need to do, happens in Premise Home and you need not worry about a Module's innards.

Modules are a means of introducing new functionality to Premise. For example, the ELK M1 Module creates a new Device (to let Premise talk to an ELK M1 alarm panel). The SSMTP Module creates a new Device (to let Premise send email via the Secure SMTP protocol). The DoorMinder Module creates a new Home object (that enhances how a door is modelled).

Some Modules create new Devices whereas other Modules introduce new Home objects. Oh sure, they do more (GlobalScripts, Logic Diagrams, Timers, etc) but, for now, just think about Devices and Home objects.

Like the first posts in this thread says, after you install the DoorMinder Module, all of Premise's existing Door, Window, and GarageDoor objects (these are the objects you add in Home) get additional functionality.

Edited by 123, 12 November 2010 - 04:19 PM.


#10 nov0798

nov0798

    Dedicated Cocooner

  • Registered
  • PipPipPip
  • 530 posts
  • Location:Dumfries, VA
  • Experience:average
  • Software:Premise
  • Hardware:Elk M1
  • Tech:UPB, 1-Wire
  • Phone:VoIP via ISP

Posted 13 November 2010 - 01:22 AM

Ok thanks,
So 123 or anyone, as far as doorminder goes, could you please tell me where I put the script to speak the reminder through the M1?

I see the script example, but again, do I use the entire script that is given or do I just do a piece of it for each door?

I would assume that this script example goes in a script linked to that object(door sensor, etc?), similar to an on change script?

Do I need to change the name in the script to match the name of my sensor, as I did in red?

Sorry for all the questions, just trying to learn.

#11 nov0798

nov0798

    Dedicated Cocooner

  • Registered
  • PipPipPip
  • 530 posts
  • Location:Dumfries, VA
  • Experience:average
  • Software:Premise
  • Hardware:Elk M1
  • Tech:UPB, 1-Wire
  • Phone:VoIP via ISP

Posted 19 November 2010 - 03:39 PM

Can anyone comment on my last request(s) as to where I place this script so I can get the M1 to speak the words.

Also where do I define the words to be spoken? Do I just type what I want said, or do I need to define the codes for each word? I assume the codes for each word are already defines in the M1 module itself?

Thanks

#12 chucklyons

chucklyons

    Dedicated Cocooner

  • Registered
  • PipPipPip
  • 803 posts
  • Software:Premise

Posted 20 November 2010 - 10:45 AM

I just got my M1 yesterday, so it will be a few days before I can provide anything of value...or no value, as it were..

#13 etc6849

etc6849

    Cocoonut

  • Registered
  • PipPipPipPip
  • 1728 posts
  • Location:Irmo, SC
  • Experience:average
  • Software:Premise
  • Hardware:Elk M1
  • Tech:X10-RF, Z-Wave, Custom
  • Phone:OBi100/110

Posted 20 November 2010 - 11:03 AM

You bought an M1 too? I finally have mine half installed via an extension cord until my leviton surge protecting outlet shows up. I have a lot of wires to fish. It will be a week or so before I'm done with that. In the mean time, there are two step by step instructions of speach for the M1G that nov could try to become familar with it. They're in 123's 41 page manual that comes with his M1 driver. Looks like I'm going to have to donate to 123 because his M1G driver is very nice!

#14 nov0798

nov0798

    Dedicated Cocooner

  • Registered
  • PipPipPip
  • 530 posts
  • Location:Dumfries, VA
  • Experience:average
  • Software:Premise
  • Hardware:Elk M1
  • Tech:UPB, 1-Wire
  • Phone:VoIP via ISP

Posted 22 November 2010 - 02:37 AM

Ok through some trial and error, I finally figured this out. Wasnt that hard after all. Slowly learning, but Ill get there!

#15 etc6849

etc6849

    Cocoonut

  • Registered
  • PipPipPipPip
  • 1728 posts
  • Location:Irmo, SC
  • Experience:average
  • Software:Premise
  • Hardware:Elk M1
  • Tech:X10-RF, Z-Wave, Custom
  • Phone:OBi100/110

Posted 22 November 2010 - 11:24 AM

That's good. I saw your other post you deleted. I bet you forgot to copy the mdb file? I did the same thing when I first used 123's module ;)

It sounds like speach is working now?




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users