Premise When you're a hammer, everything looks like a nail.

Motorola Premise

123

Senior Member
After spending a great deal of time with scripting, I thought I'd never need to stoop to using Macros or Logic Diagrams. I'd become a "scripting hammer" where every problem must be solved through coding. If you can write code, you've mastered the Premise universe, right? Wrong, silly rabbit! After spending a little time with Logic Diagrams, I realized that they can solve some problems with less effort than scripting.

Light and Auto-On/Off Fan
Here's an example straight out of the manual:
  • Turn on a bathroom light.
  • Two minutes later the ventilation fan turns on.
  • Turn off the bathroom light and ten minutes later the fan turns off.
Drag four blocks (Vanity light, OnDelay, OffDelay, Fan) into a new Object Diagram and link them together as shown in diagram #1 (below). Set the OnDelay timer to 2 minutes and the OffDelay timer to 10 minutes and you're done. Now that's easier than scripting!

Variable-Brightness Light and Auto-On/Off Fan
Think we're limited to Boolean logic? Not at all. Here's an example, a slight variation of the one in the manual, that uses a Multiplexer block:
  • Light's default brightness is 75% during the Day.
  • Light's default brightness is 100% during the Evening.
  • Light's default brightness is 50% during the Night
Drag two more blocks into the diagram (a Variable called CurrentDayMode and a Multiplexer) and link them as shown in the second diagram. Adjust the brightness levels in the Multiplexer according to the list above. Now the light's default brightness level will be set according to the time of day.

Auto-On/Off Variable-Brightness Light and Auto-On/Off Fan
Rather than turn the light on manually, we can trigger it by sensing motion or pressure:
  • Turn the light on if there's Motion
  • Turn the light on if there's weight on a pressure-sensitive mat.
  • Turn the light off after 1 minute of inactivity.
Drag in four more blocks (MotionSensor, FloorSensor, OR, Pulse) and connect them as shown in the third diagram. Adjust the Pulse block's Duration to 1 minute. Now the light will be turned on by either motion or pressure. The Pulse block ensures there's at least 1 minute of inactivity before the light is turned off.

If you have a RadioTuner in the bathroom, well, drag that into the diagram as well and activate it along with the light!

Without writing a single line of script, we've programmed the light and fan (and radio). As an added bonus, this logic diagram remains valid even if you change the Vanity light from Insteon to UPB and the Fan from X10 to a hard-wired relay. All logic resides on a "separate layer" from device drivers so it remains effective regardless of the device's technology.

You can also create custom Logic Blocks but that requires scripting. There are several examples in the manual including how to create an Emailer block.
 

Attachments

  • 1__Bathroom_Fan_Timer.png
    1__Bathroom_Fan_Timer.png
    10.1 KB · Views: 82
  • 2__Bathroom_Light_Level.png
    2__Bathroom_Light_Level.png
    14.2 KB · Views: 65
  • 3___Bathroom_Light_Motion.png
    3___Bathroom_Light_Motion.png
    23.4 KB · Views: 56
... without the need to understand Ladder Logic. :)

Creating Logic Diagrams was similar to using Visio plus you can run it on-screen and watch it work.
 
The Sys 103 Introductory Programming training video also covers this, it is toward the end of the video (last 15-20mins).
Premise still has a lot of very cool features for an old program. It is a shame Motorola never brought out version 3.0.
 
nov0798,

You're viewing a topic posted in the Premise Home Control forum dedicated to the usage, and application, of the free Home Automation software known as Premise. I thought you were aware of that so that's why I asked if you were kidding about the software I was discussing. For more information about Premise, you can view the "sticky topic" posted at the top of the forum.

Best regards,
123
 
Sorry to bring up an old topic - but the "CurrentDayMode" variable - what do you have in it? I don't have that variable, and was going to create it manually, but, if it's already working for you, why reinvent the wheel?
 
The "CurrentDayMode" variable comes from the "DayMode Calculation Example" found in Premise Builder's Help. Search for "DayMode" and you'll get three matches. The first two point to the same topic: how to use an Object Diagram to calculate the current day mode. The third one shows how to do the same thing but with a VBScript function called DayMode().

Personally, I prefer the VBScript method; a Timer would periodically execute the DayMode function. There I go thinking like a hammer again ...

BTW mjpcomp,
I don't believe I've seen you post in this forum before. Are you a new or experienced Premise user? I ask because the circle of Premise users is quite small and every new (or old) user is a valued addition to our little cult. :)
 
123:

Thanks for the pointer - I ended up figuring out what was missing when I was looking at the picture in the Wiki (the full diagram, not the portions in the forum post) and noticed the "SetDayMode" logic block.

I tried using Premise quite some time ago, but because of the UPB driver issue, I never got anywhere. Then I found that SamGreco tried what I was going to do - just hex edit the driver and add the missing stuff (I was actually going to change the read-only property on the model/id to false and add them that way)... So I reinstalled everything last night.

As far as the Premise software, I've pretty much figured out everything already (working on the computer industry for 15+ years, I have to know how to use random software thrown at me), I was just looking at some various techniques, and when I saw the variable representing the time section of the day, I thought something was missing...

Anyway, this definitely beats programming everything via UPB links and trying to script things on the computer to accomplish what the software can do.

I'm just trying to figure out what I can do - whether this will need a custom driver or not - to get "audio pressure" in the logic blocks. Essentially it would be used to trigger lights based on the current audio reading (e.g. make lights flicker based on music). Something just for fun...
 
...I'm just trying to figure out what I can do - whether this will need a custom driver or not - to get "audio pressure" in the logic blocks. Essentially it would be used to trigger lights based on the current audio reading (e.g. make lights flicker based on music). Something just for fun...

Welcome aboard, mjpcomp. I hope Premise will meet your needs.

You can get an A/V device's Volume level ("audio pressure"?) into an object diagram. In addition to Function Blocks, you can drag 'n drop almost any Home object, Driver, Scene, Timer, Variable, etc into the diagram from the Palette. The attached image shows a Media Zone, Receiver, SecurityPanel, and a HAI OmniPro in a diagram ready to become part of some interesting (convoluted?) logic combining music content, volume, and security status! :)
 

Attachments

  • ObjectDiagram.PNG
    ObjectDiagram.PNG
    28.9 KB · Views: 36
I tried the volume level, but it literally is the volume (Fixed/set), not the dB reading of the music..

For example, if the music is heavy metal, I want the lights to turn on/off anytime the audio peaks above 0dB. If I'm watching a movie, for example, I'd want to tie that into some other items (makeshift 4-D experience).

On a side note, I can't get the "Preset Dim" levels to work properly (assuming I am reading the description correctly). I have set a couple of lights to a preset dim level of 25%, yet anytime I turn them on, they go straight to 100%. Any idea on what to check for? I am using the UPB driver (with modifications by SamGreco to allow the use of the newer models of UPB equipment).
 
I believe a sound meter would be needed to report the actual sound pressure in the room. A cheap workaround would be to monitor the audio device's Volume (> 90%) and the current track's Genre (Metal, Rock, etc) to determine if something should be turned on/off. The glitch here is that I don't believe you can expose the track's Genre in an Object Diagram (but it is accessible via scripting). There's probably a way of using script to assign the current track's Genre to a Variable and then use that Variable in the Object Diagram.

Preset Dim didn't work the way I expected either and I use X10 lighting. When a light is turned on (via Builder, Browser, or programmatically), it goes to 100% and then dims to its Preset Dim level. I always assumed this was a hackneyed way to handle the original X10 devices because they couldn't be turned on to a specific brightness level. I use the slightly more sophisticated X10 Switchlincs and I can turn them on to a specific brightness (programmatically with Premise) but not if I try to use the Preset Dim property. Your experience suggests that the Preset Dim feature is wonky under UPB as well. Maybe other Premise users have figured out how to make it work properly.
 
I'll go ahead and start up a separate topic on the Preset issue... It's highly possible that the driver we're using doesn't even support that (maybe it's in the interface, but was never coded to be taken advantage of). Or it could be how UPB works - the dimmers are internally defaulted to be 100% - maybe they should default to 1%... I'll try that with one light and see if that works.

For the sound pressure, I'm going to have to figure something out... I'm probably going to have to start coding again (thought it's been years) - something to monitor the sound level and when it peaks above a certain level, set a bit/variable high, and the light will turn on/off based on that.

Or, do what I did a long time ago - setup an input that will read a text file which has been matched to the sound/music being played... Though that gets pretty annoying to have to create that file. Stream the text file, and whenever a "1" is encountered, that's when the music has spiked, so do the action.. if 0, reset.

But thanks again for helping everyone here with the Premise software - you're definitely going above and beyond.
 
Back
Top