Premise Occupancy, scripting... and ummm stuff

Motorola Premise

dBeau

Active Member
I am trying to get started with scripting in Premise. I've been looking for just the right example and just the right task to get me started. I noticed that the beam sensor in the garage that indicates the presence of a car doesnt keep the garage "occupied" after the timer expires. The sensor stays in the triggered state as long as a car is there but after the 10min (occupancy timeout) it does not reset the occupancy timer. I'd like to fix this.

A couple of thoughts came to mind: A special sensor class could be created with it's own timer. Every 60 seconds or so, the timer would fire and check the state of the sensor. If the sensor is still in the triggered state, it could re-assert the occupancy for the room. Even fancier would be a global collection of occupancy sensors that get checked every 60 seconds or so. When triggered, a sensor could add itself to the collection. It could be automatically removed when it is no longer triggered.

Perhaps there is a better way to solve this problem. I'd be interested in hearing about it, but then I'd have to come up with another idea for scripting. Like...

How about a garage door object, for example. It would bind to a couple of sensors that indicate the position of the door (up or down) and also have a up button and down button to trigger Elk tasks that perform the function. From what I've seen of Premise so far, it should be more than capable of doing this. I'm looking for pointers on how to get started.
 
... the beam sensor in the garage that indicates the presence of a car doesnt keep the garage "occupied" after the timer expires. The sensor stays in the triggered state as long as a car is there but after the 10min (occupancy timeout) it does not reset the occupancy timer. I'd like to fix this.
I believe John_in_VA encountered the same issue when using Insteon motion detectors. The Occupancy module expects a device to trigger (go True then back to False) when it senses activity and not to remain latched True.

... A special sensor class could be created with it's own timer. Every 60 seconds or so, the timer would fire and check the state of the sensor. If the sensor is still in the triggered state, it could re-assert the occupancy for the room.
A very good idea! I'd put that logic in a new "BeamSensor" driver and not in a Home-level object. The driver would inherit from the MotionDetector class. A Home-level MotionDetector object could bind to the "BeamSensor" driver and have its "MotionDetected" property triggered by the driver (using the logic you've described).

How about a garage door object, for example. It would bind to a couple of sensors that indicate the position of the door (up or down) and also have a up button and down button to trigger Elk tasks that perform the function.
You've described a "Composite Class" which is a Home-level object that is composed of other Home-level objects. Damon Deen introduced the concept in this post on the old Support forum. The example he posted is a Garage Door Composite Class. The Composite Garage Door object has two child objects, one for binding to a Door Sensor and the other for binding to a Door Opener.

I expanded on Damon's idea and I created my own Composite Door, GarageDoor, and Window classes. They include more features (Annunciator and Reminder), a better UI, and they work with the Occupancy module (actually, they implement the Occupancy functionality and use it only if the Occupancy module is present). I gathered ideas for a "Smart Door" in this post (where you can also see the UI for a Composite Door).

The attached image shows a Composite Door. It has four "child objects":
  1. Sensor
    Detects if the door is open/closed.
  2. LockSensor
    Detects if the door's deadbolt is extended(locked)/retracted(unlocked)
  3. LockOpener
    Signals deadbolt to unlock.
  4. LockCloser
    Signals deadbolt to lock.
My home has four exterior doors. One has a powered deadbolt and its four child objects are bound to M1 Zones and Outputs. The other two doors do not have controllable locks so nothing is bound to "LockOpener" and "LockCloser". I simply uncheck their "ShowButtons" property and their UI does not display buttons for operating a lock.

I haven't released my "Composite" module because I haven't found the time to document it. Let me know if you're interested in rummaging through its code and I'll post it.
 

Attachments

  • Composite_Door_Class.png
    Composite_Door_Class.png
    23.7 KB · Views: 23
...more stuff, more questions.

The Composite Class module and the garage door example are very interesting. I'm having two problems though.

When I try to bind an Elk output to the garage door's GarageDoorOpener, it seems fine. But when I look at in the browser, I dont see the opener or any controls to activate the output. I tried adding just a GarageDoorOpener to the room and binding the Elk output to that.... nearly the same thing. The image shows up though and I can click on it but it does not activate the relay. Interesting enough, if I bind to an Elk task, it does work.

Second, I am having trouble figuring how to create a class like CompositeObjects derived from Tag and how to derive a new class from CompositeObjects, like GarageDoor. I cant seem to convince the wizard that my powers are strong enough to do such a thing. Is there a different way to create a class that I am missing or do I need to keep poking at the wizard?
 
... when I look at in the browser, I dont see the opener or any controls to activate the output. ... if I bind to an Elk task, it does work.
I don't believe the GarageDoorOpener object has much of a UI (other than showing its state). It doesn't even have an icon (just a big gray button). Not sure what they were thinking when they put this one together. Heck, I don't know why it works at all when you bind it to a task!
FWIW, I use a custom Composite object (the aforementioned GarageDoor) to trigger my garage door.

Second, I am having trouble figuring how to create a class like CompositeObjects ... Is there a different way to create a class that I am missing or do I need to keep poking at the wizard?
You need "Expert Mode". In Expert Mode, the Wizard is disabled and you get to define new classes, methods, and properties from scratch. Expert Mode is used in this video.
 

Attachments

  • How_To_Enter_Expert_Mode.png
    How_To_Enter_Expert_Mode.png
    34.4 KB · Views: 26
  • Composite_GarageDoor_UI.jpg
    Composite_GarageDoor_UI.jpg
    40.8 KB · Views: 26
Back
Top