Active TopicsActive Topics  Display List of Forum MembersMemberlist  Search The ForumSearch  HelpHelp
  RegisterRegister  LoginLogin
PowerHome Programming
 PowerHome Messageboard : PowerHome Programming
Subject Topic: Programming For My Drapes Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
ibscas
Groupie
Groupie


Joined: October 18 2008
Location: United States
Online Status: Offline
Posts: 46
Posted: July 19 2009 at 12:12 | IP Logged Quote ibscas

So, I've been a bad boy . I defected to mControl about three months after buying PH because I was having so many problems with PH. So, now that I've built a new home automation server, I'm ready to give it another shot! I think that both programs have their flaws, and the solution is not one or the other, but rather a mix of both.

In my case I have two things that PH was built for, my garage door and my drapes. It was built for it because there is so much programming than can be done for the status of these devices.

My question today is, now that I have forgotten most of what I learned about PH, is ...

I have some curtains that are powered by a drape controller I got from SmartHome. It's a dumb device, if the wall socket is ON, then the motor runs, and it stops when the device is OFF. There is a switch on the motor that detects when it's either opened or closed all the way, then reverses the motor the next time it gets an ON signal.

I would like to set up some variables in PH that I can set to "OPEN" or "CLOSED", etc. I just don't know how to do that. I'll start with a variable value of "CLOSED" and when I send PH the command to power cycle the drapes, it will flag it as OPEN. I'll take this a step further and build macros that say "power on for 5 seconds", this equates to 1/2 open.

My question is how do I fire a device and set a variable as a result?

Thank you!
Back to Top View ibscas's Profile Search for other posts by ibscas
 
nadler
Super User
Super User


Joined: February 25 2006
Location: United States
Online Status: Offline
Posts: 354
Posted: July 20 2009 at 11:20 | IP Logged Quote nadler

Welcome back!

I have the same drape controller. I've used it for about
2 years to open and close vertical blinds in my home
office. I use 2 Timed Events - one to open the blinds 45
minutes after Sunrise and another to close the blinds 75
minutes after sunset. I also have several buttons on
several PH Control Center screens to open and close the
blinds and keep track of their status. I'll walk you
through what I have and you should be able to adapt it to
your needs.

First, assuming you have this drape controller
http://www.smarthome.com/3142/Motorized-Drape-
controller/p.aspx then the five seconds to half open
won't work very well. This controller is either on or
off and altho you may be able to cut power to it in the
middle of the cycle, I think on the next cycle it will
continue the first cycle and you could have the drape
closed when you want it open etc. What I mean by this is
that it won't reverse until it physically hits the end
stop when it clicks and reverses mechanically (sort of
like an underground sprinkler head).

The other challenge with this device is, as you say, it
is a dumb device. You have to find a way to keep track
of whether your drapes are open or closed.

This is what I do:

1. Create a global variable. I call mine BLIND OPEN FLAG
- but I urge you to be more creative. The global
variable is set to either OPEN or CLOSED by the macros
which are run when the Timed Events are run.

2. Create 2 macros. I call mine BLINDS OPEN and BLINDS
CLOSED. I'll describe them below.

3. Create 2 Timed Events. Mine are called BLINDS_OPEN
and BLINDS_CLOSED. You can set them up as you wish but
have them both run their respective macros. By the way
if you don't want to set up a timed event and just want
to have a controlinc or switchlinc open or close the
drapes then eliminate this step and create a group with
the switch and your PLM/PLC and drape controller and
setup the following macros to run the Insteon group.

4. Create the macros.

The BLINDS OPEN macro is a 7 line macro:
The first line checks to see if the blinds are CLOSED by
checking the BLIND OPEN FLAG. If they're closed the
macro goes to the next line. Otherwise the macro ends by
going to line 999.
JUMP    if (ph_getglobal_s("BLIND OPEN
FLAG")="CLOSED",1,999)

The second line sets the BLIND OPEN FLAG to OPEN.
SET GLOBAL   BLIND OPEN FLAG   "OPEN"

The third line is just for fun. It announces that the
blinds will be open.

TTS "Good morning! I am going to open the blinds now."

The fourth line is important. It sends an INSTEON OFF
command to my INSTEON APPLIANCE Linc making sure it is
off. This is the Insteon Device that the drape
controller is plugged into. If you didn't send this
command first then there is the possibility that the
Insteon Switch would be ON and the drape controller would
not respond to the commands.
INSTEON LIBRARY BLIND   Fast Off
(My Insteon Appliance Linc name is LIBRARY BLIND)

The fifth line is a WAIT command which just makes sure
that the next INSTEON command sent will not interfer with
the previous command. It's probably not necessary
WAIT   2

The sixth line actually sends the Insteon On command

INSTEON   LIBRARY BLIND   Fast On

The seventh line just ends the macro and is probably not
necessary
JUMP   999

The BLINDS CLOSED macro has similar logic.
JUMP      if (ph_getglobal_s("BLIND OPEN
FLAG")="OPEN",1,999)
TTS        "I am going to close the blinds now."
WAIT       2
INSTEON    LIBRARY BLIND     Fast off (Just to be sure)
WAIT       2
INSTEON    LIBRARY BLIND     Fast On
Wait       2
INSTEON    LIBRARY BLIND     Fast Off (Just to be
prepared for next time)
SET GLOBAL BLIND OPEN FLAG "CLOSED"

I then make some announcements about the time and weather
which I will leave out here.

This is just one way of opening and closing the drapes.
There are many others that are no doubt more elegant.
For example you can combine the logic into one macro
instead of two. Or you can just use a formula instead of
calling a macro from the timed events.

Anyway, hope this gets you a little further.

Noel
Back to Top View nadler's Profile Search for other posts by nadler
 
ibscas
Groupie
Groupie


Joined: October 18 2008
Location: United States
Online Status: Offline
Posts: 46
Posted: July 21 2009 at 09:44 | IP Logged Quote ibscas

Thank you, that gives me a great jumping off point!
Back to Top View ibscas's Profile Search for other posts by ibscas
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum