Active TopicsActive Topics  Display List of Forum MembersMemberlist  Search The ForumSearch  HelpHelp
  RegisterRegister  LoginLogin
PowerHome General
 PowerHome Messageboard : PowerHome General
Subject Topic: Elk GPIO Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
MrGibbage
Super User
Super User
Avatar

Joined: October 23 2006
Location: United States
Online Status: Offline
Posts: 513
Posted: May 15 2007 at 20:21 | IP Logged Quote MrGibbage

Hey guys, could I please get a little help? How do I get the device status window to show the arm status of the elk? I know it has something to do with
ph_ctlrcmd1("ELKID",120,0,0,"","",1)
And I know this needs to go in the formula section of the PH Explorer, but I don't know how to tie the output of the formula to something that shows up in the device status window.

And I could still use some help with figuring out why the device status window shows incorrect lighting and doesn't work to change my lighting.

Dave???
Back to Top View MrGibbage's Profile Search for other posts by MrGibbage
 
smarty
Super User
Super User
Avatar

Joined: May 21 2006
Location: United States
Online Status: Offline
Posts: 728
Posted: May 15 2007 at 21:29 | IP Logged Quote smarty

Sorry, i will be of no new help....my system is down. I am moving it from the bench testing mode into the new house (which is still under construction).

__________________
Elk - Insteon - BlueIris - DMC1 - PowerHome - XLobby - HA_Bridge w/Dots - Brultech
Back to Top View smarty's Profile Search for other posts by smarty
 
MrGibbage
Super User
Super User
Avatar

Joined: October 23 2006
Location: United States
Online Status: Offline
Posts: 513
Posted: May 19 2007 at 09:55 | IP Logged Quote MrGibbage

an ever so polite "bump" :)
Back to Top View MrGibbage's Profile Search for other posts by MrGibbage
 
dhoward
Admin Group
Admin Group
Avatar

Joined: June 29 2001
Location: United States
Online Status: Offline
Posts: 4447
Posted: May 19 2007 at 21:57 | IP Logged Quote dhoward

MrGibbage,

You're real close. The next version of PowerHome will (should) fire a generic controller trigger when the status changes, but for now, we need to poll for this data.

The first thing I would do is create a macro to retrieve this data. I'll use the ID "ELKARMSTATUS".

The first line should be an immediate formula containing: ph_ctlrcmd1("YOURELKID",120,0,0,"","",1). Be sure and change the "YOURELKID" to the controller ID of your ELK.

This will return data in [LOCAL1] and [LOCAL3]. Depending upon your setup, you may have to change the code below slightly. The [LOCAL3] variable will contain 24 characters. The first 8 will be the arm status of partitions 1 - 8, the second 8 will be the arm-up state of partitions 1 - 8, and the last 8 will be the alarm state of partitions 1 - 8. This information is contained in the Elk RS-232 programming manual under the AS command.

If I understand your post correctly, you're interested in the arm status (the first 8 characters of [LOCAL3]). Below, I'll show you how to get the arm status of partition 1 (the very 1st character of [LOCAL3]).

Since PowerHome doesnt currently have a method to display global variables on the Device Status screen (I know, I know...it'll be coming soon ), we'll use a little trickery and the next best thing...the analogio table. Before we go any further, save your ELKARMSTATUS macro and go to the Analog I/O screen. It's under PowerHome|Devices|Analog I/O in the PowerHome Explorer. Create a new line and use an ID of ELKARMSTATUS, an appropriate description, Input. You can leave the controller, unit, and point at their defaults (blank, 0, 0). Save your changes.

Go back to your ELKARMSTATUS macro. Make your second line: Set System, [LOCAL4], case(left("[LOCAL3]",1) when "0" then "Disarmed" when "1" then "Armed Away" when "2" then "Armed Stay" when "3" then "Armed Stay Instant" when "4" then "Armed to Night" when "5" then "Armed to Night Instant" when "6" then "Armed to Vacation")

Your third line should be: Formula, Immediate, ph_directsql("update analogio set calcvalue = '[LOCAL4]' where id = 'ELKARMSTATUS'")

Your fourth line should be: Formula, Immediate, ph_devicerefreshstat()

Thats it. You can enhance this a little with an additional code using ph_setanalogdisplay to change graphics and colors of the analogio as you like.

The last thing you should do is create a timed event to run this macro. Once a minute should be sufficient but you can go faster or slower as you like.

Hope this helps,

Dave.
Back to Top View dhoward's Profile Search for other posts by dhoward Visit dhoward's Homepage
 
sharby
Groupie
Groupie


Joined: May 13 2007
Location: United States
Online Status: Offline
Posts: 50
Posted: May 20 2007 at 02:14 | IP Logged Quote sharby

I got the Correct response to work for the 3rd line of code. However, after the ph_devicerefreshstat() is done, I still do not see any Updates/text under Device Status. What am I doing wrong?

-=*Sharby*=-
Back to Top View sharby's Profile Search for other posts by sharby
 
MrGibbage
Super User
Super User
Avatar

Joined: October 23 2006
Location: United States
Online Status: Offline
Posts: 513
Posted: May 22 2007 at 13:03 | IP Logged Quote MrGibbage

Thanks, Dave. I hope to play with this a little tonight. Do you have any ideas why my lighting indications are all FUBAR'ed on my device status page? Most of the indications are wrong, and none of the buttons to turn the lights on and off work.

Skip
Back to Top View MrGibbage's Profile Search for other posts by MrGibbage
 
MrGibbage
Super User
Super User
Avatar

Joined: October 23 2006
Location: United States
Online Status: Offline
Posts: 513
Posted: May 27 2007 at 21:24 | IP Logged Quote MrGibbage

Awesome! I'm getting somewhere now. I have written a trigger to automagically arm my burglar alarm when I push the "All Off" button on a ContrLinc.

For my next trick I want to turn all of my interior lights off when I arm my burglar alarm to away mode (kinda the reverse of my first trick). I get that PH won't detect the arming/disarming and that I will have to poll for the status. No problem. I'll use the same first line Dave mentioned above:
ph_ctlrcmd1("YOURELKID",120,0,0,"","",1)
And then the next line would be
if ((left("[LOCAL3]",1) = 1 and ph_getinsteonstat("FAMILY_ROOM")=1, ph_devicebtn(5, "MYCONTROLINC", ioff)

I'll just put this on a timer and run it every two minutes or so.

I chose to check for the family room light because it is my most used light, but there must a better way to do this. I don't want to macro firing every x minutes--it should only fire once. I kind like the idea of checking the status of individual lights. Anyone have a better way of doing this?

Edited by MrGibbage - May 27 2007 at 21:25
Back to Top View MrGibbage's Profile Search for other posts by MrGibbage
 
MrGibbage
Super User
Super User
Avatar

Joined: October 23 2006
Location: United States
Online Status: Offline
Posts: 513
Posted: May 30 2007 at 22:23 | IP Logged Quote MrGibbage

Dave, this isn't working at all for me. Do you have any ideas for how to turn my lights off after arming my burglar alarm to the away mode?

Skip
Back to Top View MrGibbage's Profile Search for other posts by MrGibbage
 
MrGibbage
Super User
Super User
Avatar

Joined: October 23 2006
Location: United States
Online Status: Offline
Posts: 513
Posted: June 09 2007 at 08:01 | IP Logged Quote MrGibbage

Tony? Dave? Anyone? How can I have PH turn off all of my lights after arming my Elk to away mode?
Back to Top View MrGibbage's Profile Search for other posts by MrGibbage
 
mustangcoupe
Super User
Super User
Avatar

Joined: August 08 2003
Location: United States
Online Status: Offline
Posts: 308
Posted: June 09 2007 at 08:08 | IP Logged Quote mustangcoupe

I am just playing with my elk and PH (but I think my PLC just went bad) but can you correctly view the arm/disarm status of the elk?



__________________
Todd Hannemann

HA newbie

   PowerHome - UPB - ELK    
Back to Top View mustangcoupe's Profile Search for other posts by mustangcoupe Visit mustangcoupe's Homepage
 
MrGibbage
Super User
Super User
Avatar

Joined: October 23 2006
Location: United States
Online Status: Offline
Posts: 513
Posted: June 10 2007 at 16:53 | IP Logged Quote MrGibbage

Strangely enough, no, the instructions that Dave posted above do not work for me. My Device Status page shows a yellow box with no text to indicate the arming status of the Elk. I looked at the event log, and I get the following log entry when the macro fires:
Direct SQL: update analogio set calcvalue = '' where id = 'ELKARMSTATUS'

So, it would appear the LOCAL4 variable is not getting set.

Here's my macro, cut&pasted (all are formula, immediate)

10 ph_ctrlcmd1("ELK",120,0,0,"","",1)
20 Set System, [LOCAL4], case(left("[LOCAL3]",1) when "0" then "Disarmed" when "1" then "Armed Away" when "2" then "Armed Stay" when "3" then "Armed Stay Instant" when "4" then "Armed to Night" when "5" then "Armed to Night Instant" when "6" then "Armed to Vacation")
30 ph_directsql("update analogio set calcvalue = '[LOCAL4]' where id = 'ELKARMSTATUS'")
40 ph_devicerefreshstat()
Back to Top View MrGibbage's Profile Search for other posts by MrGibbage
 
MrGibbage
Super User
Super User
Avatar

Joined: October 23 2006
Location: United States
Online Status: Offline
Posts: 513
Posted: June 17 2007 at 22:29 | IP Logged Quote MrGibbage

Is this something that is just plain hard to do? I would think that a macro to turn off all lights when leaving (that is, arming in away mode) would be very popular. Does anyone have a working solution for this?

Skip
Back to Top View MrGibbage's Profile Search for other posts by MrGibbage
 
MrGibbage
Super User
Super User
Avatar

Joined: October 23 2006
Location: United States
Online Status: Offline
Posts: 513
Posted: June 23 2007 at 21:03 | IP Logged Quote MrGibbage

Got it working. line 10 should be ph_ctlrcmd1.... not ph_ctrlcmd1. **sigh**

What's a good way to set up a repeating timed event with a one minute periodicity? For the frequency on the timed events table, I see "hourly". Please tell me I don't have to set up 60 timed events, each one minute apart with an hourly repeating periodicity.

Of course, I probably won't need any of this when the new version comes out, but the one minute periodicity is still interesting to me.

Skip
Back to Top View MrGibbage's Profile Search for other posts by MrGibbage
 
TonyNo
Moderator Group
Moderator Group
Avatar

Joined: December 05 2001
Location: United States
Online Status: Offline
Posts: 2889
Posted: June 23 2007 at 21:36 | IP Logged Quote TonyNo

Enter a "1". That'll be one minute.
Back to Top View TonyNo's Profile Search for other posts by TonyNo Visit TonyNo's Homepage
 
MrGibbage
Super User
Super User
Avatar

Joined: October 23 2006
Location: United States
Online Status: Offline
Posts: 513
Posted: June 23 2007 at 22:28 | IP Logged Quote MrGibbage

Doh!! I thought I was limited to choosing the items in the drop down list. **sigh** **sigh**
Back to Top View MrGibbage's Profile Search for other posts by MrGibbage
 

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

<< Prev Page of 2
  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