www.homeseer.com

Go Back   HomeSeer Message Board > Developer Support > Scripts & Plug-Ins:Development and Libraries > Script & Plug-In Development

Script & Plug-In Development Discuss scripting for HomeSeer and general VBScript assistance. Use this forum to post incomplete scripts, script snippets or code samples.

Reply
 
Thread Tools Display Modes
  #1  
Old September 2nd, 2010, 02:24 PM
Alan's Avatar
Alan Alan is offline
Seer Plus
 
Join Date: Jan 2010
Location: CA
Posts: 80
Question Device Value's "Display Status" string access

Is there a way to access (via a script command) the string value "Display Status" that is associated with a particular device value?

My plan is to use virtual device to store door lock codes (in the Value field) and the related name of the person who is assigned that code in the Display Status field and then use the association to show who unloced the zwave door lock - in HS.Touch.

I am trying to avoid putting the assigned 'names' in script code.

Thanks,
Alan
Reply With Quote
  #2  
Old September 2nd, 2010, 02:32 PM
rmasonjr's Avatar
rmasonjr rmasonjr is offline
OverSeer
 
Join Date: May 2001
Location: Brookhaven, MS USA
Posts: 3,481
Default

Alan - would you mind sharing a screenshot? I'm after ideas on an HSTouch interface for my lock...
__________________
GearHouse Club Member
FoxConn D525 Atom 1.8Ghz / Win7 32 / 4G RAM /
HSPRO v2.5.0.78 / 2 Z-Trollers / 50 Z-Wave devices
WGL800 / RFXCOM / OS Sensors / X10 Motion Sensors / DS10a / Schlage Lock / Way2Call
Reply With Quote
  #3  
Old September 2nd, 2010, 02:39 PM
Alan's Avatar
Alan Alan is offline
Seer Plus
 
Join Date: Jan 2010
Location: CA
Posts: 80
Default

Quote:
Originally Posted by rmasonjr View Post
Alan - would you mind sharing a screenshot? I'm after ideas on an HSTouch interface for my lock...
As soon as I finish the program I'm working on (that stores the last 9 "unlocks" times and codes in virtual devices) I will complete the hs.touch screen for the doors. I'm almost there. Then I will post a screen shot.
Reply With Quote
  #4  
Old September 2nd, 2010, 03:33 PM
mwaite mwaite is offline
Seer Master
 
Join Date: Dec 2004
Location: Santa Rosa, CA
Posts: 911
Default

See the help file for:

SetDeviceString
SetDeviceStringByName

Get:
DeviceString
DeviceStringByName
__________________
Mike
Reply With Quote
  #5  
Old September 2nd, 2010, 04:13 PM
kenm kenm is offline
Seer Deluxe
 
Join Date: Jan 2001
Location: San Jose, CA
Posts: 459
Default

Alan,

What you are looking for is "DeviceValuesAdd". With this command you add the device value/pairs that set the device status string based on the value of the device. You only need to execute the command once since the pairs are stored with the device info in the database.


Ken
Reply With Quote
  #6  
Old September 2nd, 2010, 04:20 PM
Alan's Avatar
Alan Alan is offline
Seer Plus
 
Join Date: Jan 2010
Location: CA
Posts: 80
Default

Quote:
Originally Posted by mwaite View Post
See the help file for:

SetDeviceString
SetDeviceStringByName

Get:
DeviceString
DeviceStringByName
Mike, I'm not referring to he device string (I'm storing the 'time' in that field). I'm talking about the text values under the column heading of "Display Status". See attached image...

Ken, I saw your post as I was typing this.
From you comments - I can't use the device string AND the device Display Staus?

Thanks,
Alan
Attached Images
 
Reply With Quote
  #7  
Old September 2nd, 2010, 05:01 PM
kenm kenm is offline
Seer Deluxe
 
Join Date: Jan 2001
Location: San Jose, CA
Posts: 459
Default

Hi Alan,

This is many times a source of confusion. There are three main things associated with a device; device value, device status, and device string. Depending on the device the device value and device status are linked. Device string is independent of either of these. What DeviceValuesAdd does is allows you to set the association of device value and the device "status" string but does not affect the device string.

This should give you the same results as your screen capture without affecting device string.

Code:
hs.DeviceValuesAdd "A1","Alan" & chr(2) & "1" & chr(1) & _
                        "Anne" & chr(2) & "2" & chr(1) & _
                        "Heather" & chr(2) & "3" & chr(1) & _
                        "Michelle" & chr(2) & "4" & chr(1) & _
                        "Any Value" & chr(2) & "999", False
Let me know if you can't get it working.
Ken
Reply With Quote
  #8  
Old September 2nd, 2010, 05:16 PM
kenm kenm is offline
Seer Deluxe
 
Join Date: Jan 2001
Location: San Jose, CA
Posts: 459
Default

OK,

I just went back and re-read your first post and I was thinking about it wrong.

What you want to do is access the device value/pairs. These are held in the "values" property of the device class.

Code:
sub Main()

dim dvref
dim dv

dvref = hs.GetDeviceRef("A1")

if dvRef > 0 then
    dv = hs.GetDeviceByRef(dvRef)
else
    hs.WriteLog "Error","Could not find the reference for the device specified."
    exit Sub
end if

' dv.values now contains the value/status pairs as a string
'
' See DeviceValuesAdd for the delimiters to parse the string


End Sub
Reply With Quote
  #9  
Old September 2nd, 2010, 11:46 PM
Alan's Avatar
Alan Alan is offline
Seer Plus
 
Join Date: Jan 2010
Location: CA
Posts: 80
Default

Quote:
Originally Posted by kenm View Post
OK,

I just went back and re-read your first post and I was thinking about it wrong.

What you want to do is access the device value/pairs. These are held in the "values" property of the device class.

Code:
sub Main()

dim dvref
dim dv

dvref = hs.GetDeviceRef("A1")

if dvRef > 0 then
    dv = hs.GetDeviceByRef(dvRef)
else
    hs.WriteLog "Error","Could not find the reference for the device specified."
    exit Sub
end if

' dv.values now contains the value/status pairs as a string
'
' See DeviceValuesAdd for the delimiters to parse the string


End Sub
Ken,
Thanks for your help. However, I am not sure we are on the same page. Your example allows me to get the complete list (as in my screen capture).
What I'm trying to do is access (from HS.Touch) the string value associated with the integer value of the single code that is active.

In other words I can asscess and display the 'value' (1, 2..) but I want to display the name (Alan, Anne...).

Is that what you understood and are suggesting that I have to write script to match the current value to the text by searching the dv.values string?

Alan
Reply With Quote
  #10  
Old September 3rd, 2010, 12:27 PM
kenm kenm is offline
Seer Deluxe
 
Join Date: Jan 2001
Location: San Jose, CA
Posts: 459
Default

Hi Alan,

I don't know of any way to access this info from HS Touch directly. There might be but I just don't know.

I would write a function that is called based on a device value change for your lock device. What the function would do is get the device value from the lock device, parse the "values" string, and store the name associated with the device value in a virtual device called something like "last accessed by" or something similar.

Let me know if you need a hand writing the code.

Ken
Reply With Quote
  #11  
Old September 3rd, 2010, 12:42 PM
kenm kenm is offline
Seer Deluxe
 
Join Date: Jan 2001
Location: San Jose, CA
Posts: 459
Default Wait a minute...

Alan,

This can be done with a Text Box using Status Tracking. Add a Text Box to your project and click on StatusTrackingNormal in the Element Properties. Select your lock device and select the "Use Status Text" radio button. This will display the status text (in this case the name) associated with the device value. I just tested in on one of my devices and it seems to work.

If you only want to display this info in HS Touch then this will work, however if you need to do something with the device status string in a script you'll still need to do it the way I've outlined above.

Ken
Reply With Quote
  #12  
Old September 5th, 2010, 03:39 PM
Alan's Avatar
Alan Alan is offline
Seer Plus
 
Join Date: Jan 2010
Location: CA
Posts: 80
Default

rmasonjr,

Here is a screen shot of my Door Status screen for my iPhone.
I'm still trying to work a few kinks out...
Before reading Ken's latest email I switched gears I used the Device string to store the User Name via a script subroutine and also update the DeviceLastChange to the actual time of the door being unlocked (used a global array to hold the last eight times, names, value codes).

It works but I can't get a single Event to run the script based on 'any' user entering their code.

I'm going to look at Ken's idea to see if that is another way to skin this cat :-) (I really do like cats).

Let me know if you have any suggestions or comments.

Alan
Attached Images
 

Last edited by Alan; September 6th, 2010 at 12:59 PM.
Reply With Quote
  #13  
Old September 6th, 2010, 01:05 PM
Alan's Avatar
Alan Alan is offline
Seer Plus
 
Join Date: Jan 2010
Location: CA
Posts: 80
Default

Quote:
Originally Posted by kenm View Post
Alan,

This can be done with a Text Box using Status Tracking. Add a Text Box to your project and click on StatusTrackingNormal in the Element Properties. Select your lock device and select the "Use Status Text" radio button. This will display the status text (in this case the name) associated with the device value. I just tested in on one of my devices and it seems to work.

If you only want to display this info in HS Touch then this will work, however if you need to do something with the device status string in a script you'll still need to do it the way I've outlined above.

Ken
Ken,
My status screen displays list of the last eight user codes entered (the screen shot above shows the same entry multiple times because I was testing the script manually). Thus, I'm forced to run a script to update the array (that moves data down the list each time the script is run).
I can't seem to make 'one' event run that is triggered by any user entering their unlock code. I'm stumped at this point. :-(
Reply With Quote
Reply

Bookmarks

Tags
devicevalue, displaystatus, doorlock

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT -4. The time now is 06:00 AM.

Untitled Document
NEW!
New How-To's
New Products

HomeSeer Z-Troller"
MyHomeSeer-Connect Service

Copyright HomeSeer Technologies, LLC