Announcement

Collapse
No announcement yet.

How can I store high/low in a virtual device ?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How can I store high/low in a virtual device ?

    I have 2 devices which show wind speed, gust and average. (Via Rfxcom)
    I would like to create 2 virtual devices (or 4) to store the high and low for the day.
    How can I do that ?
    Attached Files

  • #2
    Create 2 virtual devices, 1 for min, 1 for max and use a script like below. The script is triggered, every time when the main device is changing values.

    Code:
    Sub Main(ByVal parms as Object)
    	Dim eye_temp = hs.devicevalueEx(878)
    	Dim min_temp = hs.devicevalueEx(1426)
    	Dim max_temp = hs.devicevalueEx(1427)
    	
    	Dim Debug = 0	'0/1
    	
    	If Debug > 0 Then
    		hs.writelog("Temp-eye", eye_temp)
    		hs.writelog("Temp-min", min_temp)
    		hs.writelog("Temp-max", min_temp)
    	End If
    	
    	If eye_temp < min_temp
    		hs.setdevicevaluebyref(1426, eye_temp, true)
    		hs.setdevicestring(1426, eye_temp, true)
    	End If
    	If eye_temp > max_temp
    		hs.setdevicevaluebyref(1427, eye_temp, true)
    		hs.setdevicestring(1427, eye_temp, true)
    	End If
    End Sub

    Comment


    • #3
      That is exactly what I needed. Thanks.

      Comment

      Working...
      X