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

September 2nd, 2010, 02:24 PM
|
 |
Seer Plus
|
|
Join Date: Jan 2010
Location: CA
Posts: 78
|
|
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
|

September 2nd, 2010, 02:32 PM
|
 |
OverSeer
|
|
Join Date: May 2001
Location: Brookhaven, MS USA
Posts: 3,461
|
|
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
|

September 2nd, 2010, 02:39 PM
|
 |
Seer Plus
|
|
Join Date: Jan 2010
Location: CA
Posts: 78
|
|
Quote:
Originally Posted by rmasonjr
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.
|

September 2nd, 2010, 03:33 PM
|
|
Seer Master
|
|
Join Date: Dec 2004
Location: Santa Rosa, CA
Posts: 932
|
|
See the help file for:
SetDeviceString
SetDeviceStringByName
Get:
DeviceString
DeviceStringByName
__________________
Mike
|

September 2nd, 2010, 04:13 PM
|
|
Seer Master
|
|
Join Date: Jan 2001
Location: San Jose, CA
Posts: 515
|
|
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
|

September 2nd, 2010, 04:20 PM
|
 |
Seer Plus
|
|
Join Date: Jan 2010
Location: CA
Posts: 78
|
|
Quote:
Originally Posted by mwaite
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
|

September 2nd, 2010, 05:01 PM
|
|
Seer Master
|
|
Join Date: Jan 2001
Location: San Jose, CA
Posts: 515
|
|
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
|

September 2nd, 2010, 05:16 PM
|
|
Seer Master
|
|
Join Date: Jan 2001
Location: San Jose, CA
Posts: 515
|
|
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
|

September 2nd, 2010, 11:46 PM
|
 |
Seer Plus
|
|
Join Date: Jan 2010
Location: CA
Posts: 78
|
|
Quote:
Originally Posted by kenm
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
|

September 3rd, 2010, 12:27 PM
|
|
Seer Master
|
|
Join Date: Jan 2001
Location: San Jose, CA
Posts: 515
|
|
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
|

September 3rd, 2010, 12:42 PM
|
|
Seer Master
|
|
Join Date: Jan 2001
Location: San Jose, CA
Posts: 515
|
|
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
|

September 5th, 2010, 03:39 PM
|
 |
Seer Plus
|
|
Join Date: Jan 2010
Location: CA
Posts: 78
|
|
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
Last edited by Alan; September 6th, 2010 at 12:59 PM.
|

September 6th, 2010, 01:05 PM
|
 |
Seer Plus
|
|
Join Date: Jan 2010
Location: CA
Posts: 78
|
|
Quote:
Originally Posted by kenm
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. :-(
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is On
|
|
|
All times are GMT -4. The time now is 01:04 PM.
|