Announcement
Collapse
No announcement yet.
RCS variables for use in a script?
Collapse
X
-
Originally posted by mhog View PostTrying to understand how the script works and had a question about the following line of code. I understand that the GetTemp returns a double, but could someone explain the Convert Integer and Convert String and multiply by 10. This results in device V50 value being 710 if the temp is 71. Is that to be expected?
SetDevice("V50", CStr(CInt(RCS.GetTemp(1)) * 10))
Leave a comment:
-
Originally posted by jsteed View PostHere is an updated version of the script.
What used to be the "byName" functions listed above is in a separate sub now and is already commented out.
You should just have to change the addresses to work with your system.
Save the file and rename the file to have a .vb extension.
jim
SetDevice("V50", CStr(CInt(RCS.GetTemp(1)) * 10))
Leave a comment:
-
Here is an updated version of the script.
What used to be the "byName" functions listed above is in a separate sub now and is already commented out.
You should just have to change the addresses to work with your system.
Save the file and rename the file to have a .vb extension.
jimAttached Files
Leave a comment:
-
Now that I think about it - I had cleaned up some items in the script after I posted it (so that I could edit it under tenholde's scripting environment). I'll clean a couple of things up and post a revised version either tonight or tomorrow as there are probably some other similar little things that might bite.
jim
Leave a comment:
-
Jim,
Thanks. the content of the "sub" line was different than mine, so I changed it and it works!
Thanks again,
Ian
Leave a comment:
-
When you look at the HS status page for the devices is the "last change" column updating? It shoudl reflect the last time the device changed.
for reference this is how the current mode function would look
Code:Sub SetDeviceCurrentMode(ByVal devcode As String, ByVal value As Integer) Dim str As String Dim current As Integer current = hs.DeviceValue(devcode) If current <> value Then Select Case value Case 0 str = "Off" Case 1 str = "Heat" Case 2 str = "Cool" Case 3 str = "Auto" Case 4 str = "EMHT" Case Else str = "???" End Select hs.SetDeviceStatus(devcode, 2) 'make sure it's on hs.SetDeviceString(devcode, str) hs.SetDeviceValue(devcode, CInt(value)) End If End Sub
Leave a comment:
-
Jim,
I appologize for needing things spelled out so simply. I copied those three lines and pasted them into the part of the script you described (I think). I tried it for the current mode function and one other, but it didn't seem to have any affect on the device either way.
am i missing something in the implimentation?
Leave a comment:
-
Jack,
I think it should work. The script uses the calls from the Thermostat API, so as long as the plugin supports the Thermostat API, it seems that it should work. You'll have to edit the plugin name though to get the correct plugin object.
jim
Leave a comment:
-
Z-Wave Stat
Will any of this work with the RCS Z-wave stat? I have an RCS #43 and would like to use scripting also.
Jack
Leave a comment:
-
Ian,
I think this will get you what you want.
within each function near the end are two lines that set the value and the string - add a third line before those to set the status of the device. The three lines shoudl look like this
hs.SetDeviceStatus(devcode,2) 'turn it on and reset timer
hs.SetDeviceString(devcode, str)
hs.SetDeviceValue(devcode, CInt(value))
Turning it on each time will reset the timer - you can then trigger the event by condition 'has been ON for' AND value = x (where x is the mode you want to match- i.e. 0=off, 1=heat, etc.). You will probably want to use 'on for exactly' and 'can't retrigger for 1 minute' or the condition will just keep triggering.
See if that works - if not we can work on it some more.
jim
Leave a comment:
-
Ok, sorry to be a pest, but I think i need to modify the script, but I'm script challenged.
What I'm trying to do is be able to trigger an event IF the system has been in a certain mode for more than XX minutes. I don't see anyway to do that so far.
If i use the device ID's populated with this script, the event conditions are only the stock "on/off" variety (would need "changed to" not just "is" from what I understand of things.)
If I use the RCS triggers, it only says if the mode is XX, not if the mode has been XX for XX minutes. I even thought about using a flag virtual device that would turn on, then use that device for the timer, but again, there is nothing that would turn that device on ONCE with a change, but rather repeatedly whenever the event runs.
I suppose I could use the "can't retrigger for XX minutes" but that doesn't feel like the right way, my gut tells me something would go wrong.
thanks for all the help everyone!
Ian
Leave a comment:
-
Keep in mind, if you have a zone controller, then the 'get' statements will need two parameters. If you don't have a zone controller, then you only need to pass in one parameter.
Leave a comment:
-
Originally posted by completelyhis View PostI are there any areas I'm supposed to edit the device ID other than at the top?
You may need to add the zone to the function calls with your thermostat - in the other thread you were using GetXX(1,0) where in this script the calls are GetXX(1) form.
You can add some writelogs within the function to see what is getting passed through.
Leave a comment:
Leave a comment: