Author |
|
Viper Groupie
Joined: January 14 2007 Location: United States
Online Status: Offline Posts: 88
|
Posted: January 25 2007 at 12:01 | IP Logged
|
|
|
I'm trying to control an automatic bathroom fan that has a built in trigger mode that if you toggle the power to the fan from on to off and back on in less than a second, the fan will turn on and run it's normal 20 minutes. So I coded up several macro variations and most of them, even with no Delays between the off and on, would take 5 seconds. Too slow.... the fan didn't turn on.
Through trial and error I found that if I did the following:
Formula Immediate ph_insteon("MASTER BATH FAN", ifastoff, 0)
Delay 50
Formula Immediate ph_insteon("MASTER BATH FAN", ifaston, 0)
it worked. If I tried a delay of 40, I got 5 seconds. If I tried ioff, I got five seconds. If I tried no Delay, I got 5 seconds. The device is an In-LineLinc Relay.
Is there a better more reliable way to code this?
Thanks!
|
Back to Top |
|
|
dhoward Admin Group
Joined: June 29 2001 Location: United States
Online Status: Offline Posts: 4447
|
Posted: January 25 2007 at 12:40 | IP Logged
|
|
|
Viper,
The problem with the ph_insteon function (direct Insteon commands) is the acknowledgement. A direct Insteon command sends the command and then waits for a confirmation that the command worked. This wait for ACK slows the whole rapid switching process down.
However, you can get fairly rapid on/off control by instead controlling the fan as a group. Just create a PLC group with the fan as a member and then control the group using the ph_insteongroup function instead. You shouldnt need any delays of any sort and should be able do something like:
ph_insteongroup("BATHFAN",ifastoff,0) + ph_insteongroup("BATHFAN",ifaston,0)
HTH,
Dave.
|
Back to Top |
|
|
Viper Groupie
Joined: January 14 2007 Location: United States
Online Status: Offline Posts: 88
|
Posted: January 25 2007 at 13:22 | IP Logged
|
|
|
Dave,
Thanks,
Turns out I needed about a 1/2 second delay for the fan to sense the off/on sequence. I also discovered that I can't have PLC Group Cleanup on. Any other solutions that will allow me to keep the PLC Group Cleanup on?
|
Back to Top |
|
|
dhoward Admin Group
Joined: June 29 2001 Location: United States
Online Status: Offline Posts: 4447
|
Posted: January 25 2007 at 15:11 | IP Logged
|
|
|
Viper,
Hmmm...I know what you mean about the group cleanup. You send the Off, then on, it's done, and then group cleanup catches up and you get another off, then on, which Im sure destroys what you attempting to do. No real good way around this other than to turn group cleanup off. However, with a little bit more typing (and some caveats of it's own), it can be done.
We can talk directly to the Insteon DM controller and have it issue the group commands without having a group cleanup. We can do this by bypassing the PowerHome builtin functionality and communicating directly with the passthru function. By doing so, we also won't update any Status or triggers or other PowerHome built-in functions. We'll be just issuing a direct command to the Insteon DM without PowerHome effectively knowing about it. If you're still interested, read on.
The group on/off command you're looking for including a half second delay would be:
ph_ctlrcmd("INSTEON",5000,0,0,"!sendinsteonraw=00 00 00 00 00 01 CF 14 00","") + ph_rtne(ph_delay(500)) + ph_ctlrcmd("INSTEON",5000,0,0,"!sendinsteonraw=00 00 00 00 00 01 CF 12 00","")
This is controlling PLC group 1. To change to another PLC group number, change the 01 (before the CF) in each function to the appropriate (hexadecimal) group number. Also, change "INSTEON" to the ID of your Insteon DM Controller. This should send the group fastoff, faston command without a group cleanup being performed.
HTH,
Dave.
|
Back to Top |
|
|
twomble Groupie
Joined: January 07 2007 Location: United States
Online Status: Offline Posts: 45
|
Posted: January 25 2007 at 19:41 | IP Logged
|
|
|
Hey Dave,
Question...Could you use the ph_insteongroupcu command for this instead? If so, won't that update the Status and triggers in PowerHome?
|
Back to Top |
|
|
Viper Groupie
Joined: January 14 2007 Location: United States
Online Status: Offline Posts: 88
|
Posted: January 25 2007 at 19:45 | IP Logged
|
|
|
Twomble,
I think Dave would tell you that requires an ACK back from the device and the timing could be too long.
|
Back to Top |
|
|
Viper Groupie
Joined: January 14 2007 Location: United States
Online Status: Offline Posts: 88
|
Posted: January 25 2007 at 20:20 | IP Logged
|
|
|
Dave,
Sorry, the formula doesn't seem to do anything. I checked the SDM log and it doesn't seem to be getting there either. When I verify it, I get the "!"....
However, without the PLC Group Cleanup things are working, so please spend your time preparing the next beta!
Thanks! Tom
Edited by Viper - January 25 2007 at 20:28
|
Back to Top |
|
|
dhoward Admin Group
Joined: June 29 2001 Location: United States
Online Status: Offline Posts: 4447
|
Posted: January 26 2007 at 16:57 | IP Logged
|
|
|
Tom,
Im not sure why it wouldnt work. I copied and pasted from the message above (just to make sure nothing got lost in the posting...sometimes it does) into the PH Multi-Editor and it worked fine. It should return several 0's (returns a string) interspersed with Hex FF characters.
Anyways, I plan on adding an additional function or parameter so a group command can be made without a group cleanup being followed.
Dave.
|
Back to Top |
|
|
Viper Groupie
Joined: January 14 2007 Location: United States
Online Status: Offline Posts: 88
|
Posted: January 28 2007 at 20:13 | IP Logged
|
|
|
Dave,
Adding the the Group command without a group cleanup would be great.
I tried the formula again and this time I was getting back 0's and other characters. I don't know what I did the first time. I don't know if it will actually trigger the fan as I hadn't included all the steps required to do the trigger. I'll have to try that sometime when I have have the house to myself.
PH started acting strangely a little after my last test and I want to do some more isolation on that problem. By strangely, I mean it quit responding to signals coming in from the switches and the mouse pointer while in PH was the hour glass, but the GUI was still responding...
Thanks for future update.
Tom
|
Back to Top |
|
|
Viper Groupie
Joined: January 14 2007 Location: United States
Online Status: Offline Posts: 88
|
Posted: January 29 2007 at 10:57 | IP Logged
|
|
|
Well, more testing done.
I see "0ÿ0ÿÿ0ÿ0ÿÿ" coming back, but I see no activity in the SDM log and the fan doesn't come on.
I'll wait for your changes.
Thanks!
Tom
|
Back to Top |
|
|