www.homeseer.com    
 

Go Back   HomeSeer Message Board > HomeSeer Products & Services > HomeSeer General Discussion Area > Migrating to HomeSeer (From Another System)

Migrating to HomeSeer (From Another System) Are you migrating from another system to HomeSeer? Use this forum to connect with others who've done the same thing!

Reply
 
Thread Tools Display Modes
  #1  
Old November 22nd, 2016, 06:57 PM
Tomgru Tomgru is online now
Seer Deluxe
 
Join Date: Nov 2016
Location: Washington State
Posts: 445
Tracking uptime

hey Vera folks! What's the best way to track uptime on HS3, other than the listed number in Help?

Of course, assuming this is so much better than Vera... i want to watch it :-)
Reply With Quote
  #2  
Old November 22nd, 2016, 07:29 PM
bebaldin bebaldin is offline
Seer Deluxe
 
Join Date: Mar 2016
Location: Illinois
Posts: 350
Go to Plug-Ins and select Manage. From this screen, select Z-Wave. This will display the uptime.
Reply With Quote
  #3  
Old November 22nd, 2016, 08:55 PM
sparkman's Avatar
sparkman sparkman is offline
OverSeer
 
Join Date: Oct 2001
Location: Calgary, Alberta, Canada
Posts: 6,007
You could create a virtual device and run a one-line script through a recurring event:

Code:
&nhs.SetDeviceString(1234, "Uptime: " & hs.SystemUpTime, True)
Replace 1234 with the reference id of the virtual device that you create.

Cheers
Al
__________________
HS3Pro 3.0.0.318 on Jetway JBC501F9Q-Q87-B i7 8GB 1874 Devices, 955 Events, 28 Plugins
Z-Wave 3.0.1.131 Z-Net 105 nodes:Leviton Vizia,Kwikset,FortrezZ Valve/Sensors,Everspring Sensors/Modules/Outlets,CT30 Stats,MIMOLites,Aeotec Smart Switches
RFXCom W800,RFXrec433,RFXtrx433|APCUPSD|Pushover|Squeezebox|weatherXML|HS Phone W2C|APCUPSD|UltraLog
UltraGCIR GC-100|UltraNetcam|UltraPioneer|Ultra1Wire|DSC PC1832|BLLED|BLTVGuide|ImperiHome|jon00 Utilities|MySensors

PHLocation|X10 CM11A IOLinc,etc
Reply With Quote
  #4  
Old December 29th, 2016, 04:25 PM
Tomgru Tomgru is online now
Seer Deluxe
 
Join Date: Nov 2016
Location: Washington State
Posts: 445
Quote:
Originally Posted by sparkman View Post
You could create a virtual device and run a one-line script through a recurring event:

Code:
&nhs.SetDeviceString(1234, "Uptime: " & hs.SystemUpTime, True)
Replace 1234 with the reference id of the virtual device that you create.

Cheers
Al
Back at this (per the other thread on variables). If i just want to email an uptime stat every day as part of a report, would this be the easiest way, or is there just a replacement variable i can use?
Reply With Quote
  #5  
Old December 29th, 2016, 06:47 PM
sparkman's Avatar
sparkman sparkman is offline
OverSeer
 
Join Date: Oct 2001
Location: Calgary, Alberta, Canada
Posts: 6,007
There's no direct replacement variable for that, so you'd have to use the virtual device and the replacement variable for it.


Sent from my Phone using Tapatalk
Reply With Quote
  #6  
Old February 5th, 2017, 07:57 AM
abwyatt's Avatar
abwyatt abwyatt is offline
Seer Deluxe
 
Join Date: May 2016
Location: Ho Chi Minh City, Vietnam
Posts: 173
Quote:
Originally Posted by sparkman View Post
You could create a virtual device and run a one-line script through a recurring event:

Code:
&nhs.SetDeviceString(1234, "Uptime: " & hs.SystemUpTime, True)
Replace 1234 with the reference id of the virtual device that you create.

Cheers
Al
Thanks for this Al. The output for this script is in days, hours, minutes, and seconds. How can I modify the script so I just get days and hours?
Reply With Quote
  #7  
Old February 5th, 2017, 08:21 AM
sparkman's Avatar
sparkman sparkman is offline
OverSeer
 
Join Date: Oct 2001
Location: Calgary, Alberta, Canada
Posts: 6,007
Hi Andrew, because of the way HS returns the value, there's no easy way to do it in a one line script and a full script would be needed. There's an example in the HS3 help file using a related command: https://homeseer.com/support/homeseer...emuptimets.htm. I haven't used it myself, but will try it out later today and post a complete script.

Cheers
Al
Reply With Quote
  #8  
Old February 5th, 2017, 01:44 PM
sparkman's Avatar
sparkman sparkman is offline
OverSeer
 
Join Date: Oct 2001
Location: Calgary, Alberta, Canada
Posts: 6,007
Here's a script that provides more format options. Of course, I made it more complex than it needed to be .

You can specify both a "long" format and a "short" format which are customizable and could be saved into different virtual devices. If no format is specified, then it will default to the "long" format. You can also specify a prefix and suffix to be used in the script.

Save the script as uptime.vb in the \Scripts folder and run from an event as shown, specifying the reference id of the virtual device to populate and optionally "long" or "short". The device string of the virtual device will be updated with this value and the device value will be set to the up time in minutes. The value can be used to trigger an event (one example would be to send a reminder to restart HS, if it hits a certain number of minutes).

Cheers
Al

Code:
Sub Main(ByVal Parms as String)
 
	Dim Prefix As String = "" 
	Dim Suffix As String = ""

	Dim Debug as Boolean = False
	Dim logName As String = "HS3 Uptime"  

	Dim UptimeDevice, upper As Integer 
	Dim TS As TimeSpan = hs.SystemUpTimeTS
	If Debug Then hs.WriteLog(logname, TS.ToString)
	Dim Uptime As String = ""
	Dim FormatTime As String = ""
	Dim FormatStyle As String = ""
	Dim DF As String = ""
	Dim HF As String = ""
	Dim MF As String = ""

	If Parms.Length > 0 Then
		Dim ParmArray() as String
		ParmArray = Parms.split(",")			'split parameter into an array
		upper = ParmArray.GetUpperBound(0)
		If Debug Then hs.WriteLog(logname, upper.ToString)
		If upper = 1 Then
			UptimeDevice = CInt(ParmArray(0))
			FormatStyle = ParmArray(1).ToLower
		Else If upper = 0 Then
			UptimeDevice = CInt(ParmArray(0))
			FormatStyle = "long"
		End If

		If TS.Days <> 1 Then DF = "\s"
		If TS.Hours <> 1 Then HF = "\s"
		If TS.Minutes <> 1 Then MF = "\s"

		'The FormatTime strings need to be in the format specified here: https://msdn.microsoft.com/en-us/library/ee372287(v=vs.110).aspx
		'regular letters and characters that you want to have in the format need to be preceeded with a \ (backslash)
		Select Case FormatStyle  
			Case "short"
				FormatTime = "dd\.hh\:mm"
			Case "long"
				FormatTime = "d\ \d\a\y" & DF & "\,\ h\ \h\o\u\r" & HF & "\,\ m\ \m\i\n\u\t\e" & MF 
			'Case "medium"
				'FormatTime = ""
		End Select
		If Debug Then hs.WriteLog(logname, FormatTime)

		Try
			Uptime = Prefix & TS.ToString(FormatTime) & Suffix
			If Debug Then hs.WriteLog(logname, Uptime)
			hs.SetDeviceValuebyRef(UptimeDevice, TS.TotalMinutes, True)
			hs.SetDeviceString(UptimeDevice, Uptime, False)
		Catch ex As Exception 
			hs.WriteLog(logName, ex.Message)
		End Try 
		
	Else
		hs.writelog(logName,"No Parameter Specified.  Device not Set.")
	End If
	

End Sub
Name:  Capture.PNG
Views: 92
Size:  24.8 KB

Name:  Capture2.PNG
Views: 92
Size:  15.3 KB

Cheers
Al

Last edited by sparkman; February 5th, 2017 at 02:14 PM.
Reply With Quote
  #9  
Old February 6th, 2017, 11:16 AM
abwyatt's Avatar
abwyatt abwyatt is offline
Seer Deluxe
 
Join Date: May 2016
Location: Ho Chi Minh City, Vietnam
Posts: 173
Thanks so much for your generosity with your time and expertise Al. Works perfectly and you've made it so flexible and easy to setup. I had it up and running in just a few minutes.

Cheers
Andrew
Reply With Quote
  #10  
Old February 6th, 2017, 04:04 PM
sparkman's Avatar
sparkman sparkman is offline
OverSeer
 
Join Date: Oct 2001
Location: Calgary, Alberta, Canada
Posts: 6,007
Quote:
Originally Posted by abwyatt View Post
Thanks so much for your generosity with your time and expertise Al. Works perfectly and you've made it so flexible and easy to setup. I had it up and running in just a few minutes.

Cheers
Andrew
You're welcome Andrew and glad that worked for you!

Cheers
Al
Reply With Quote
  #11  
Old February 7th, 2017, 12:41 PM
abwyatt's Avatar
abwyatt abwyatt is offline
Seer Deluxe
 
Join Date: May 2016
Location: Ho Chi Minh City, Vietnam
Posts: 173
Hmmm, this is strange. My success with your script was in relation to my HT SEL.

But when I install the same script in my Zee S2 and run it I get the following error. Any idea why?

Feb-07 11:35:03 PM Error Compiling script /usr/local/HomeSeer/scripts/SystemUptime.vb: Split (System.String[], System.Int32, System.StringSplitOptions)
Feb-07 11:35:03 PM Error Compiling script /usr/local/HomeSeer/scripts/SystemUptime.vb: Split (System.String[], System.StringSplitOptions)
Feb-07 11:35:03 PM Error Compiling script /usr/local/HomeSeer/scripts/SystemUptime.vb: Split (System.Char[], System.Int32, System.StringSplitOptions)
Feb-07 11:35:03 PM Error Compiling script /usr/local/HomeSeer/scripts/SystemUptime.vb: Split (System.Char[], System.StringSplitOptions)
Feb-07 11:35:03 PM Error Compiling script /usr/local/HomeSeer/scripts/SystemUptime.vb: Split (System.Char[], System.Int32)
Feb-07 11:35:03 PM Error Compiling script /usr/local/HomeSeer/scripts/SystemUptime.vb: Split (ParamArray System.Char[])
Feb-07 11:35:03 PM Error Compiling script /usr/local/HomeSeer/scripts/SystemUptime.vb: '(System.String)' of 6 initial candidates
Feb-07 11:35:03 PM Error Compiling script /usr/local/HomeSeer/scripts/SystemUptime.vb: After removing narrowing (except object) candidates for method 'Split', nothing was found
Feb-07 11:35:03 PM Error Compiling script /usr/local/HomeSeer/scripts/SystemUptime.vb: The import 'System.Core' could not be found.
Feb-07 11:34:58 PM Event Running script in background: /usr/local/HomeSeer/scripts/SystemUptime.vb("Main","699,short")
Reply With Quote
  #12  
Old February 7th, 2017, 01:32 PM
sparkman's Avatar
sparkman sparkman is offline
OverSeer
 
Join Date: Oct 2001
Location: Calgary, Alberta, Canada
Posts: 6,007
Quote:
Originally Posted by abwyatt View Post
Hmmm, this is strange. My success with your script was in relation to my HT SEL.

But when I install the same script in my Zee S2 and run it I get the following error. Any idea why?
Hi Andrew,

Not quite sure as Split is a standard vb.net command. Let me do some digging.

Cheers
Al
Reply With Quote
  #13  
Old February 7th, 2017, 01:46 PM
sparkman's Avatar
sparkman sparkman is offline
OverSeer
 
Join Date: Oct 2001
Location: Calgary, Alberta, Canada
Posts: 6,007
Found this thread with a similar issue: https://forums.homeseer.com/showthread.php?t=175822. Try changing the line

Code:
ParmArray = Parms.Split(",")			'split parameter into an array
to

Code:
ParmArray = Split(Parms,",")			'split parameter into an array
Looks like Mono on the PI wants the VisualBasic format, not the VB.NET one which is strange.

Let me know if that fixes it.

Cheers
Al
Reply With Quote
  #14  
Old February 11th, 2017, 05:31 AM
abwyatt's Avatar
abwyatt abwyatt is offline
Seer Deluxe
 
Join Date: May 2016
Location: Ho Chi Minh City, Vietnam
Posts: 173
Quote:
Originally Posted by sparkman View Post
Let me know if that fixes it.

Cheers
Al
You're a star Al! Thanks for digging into this. It did fix the problem on the Zee S2.
Reply With Quote
Reply

Bookmarks

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 Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Tracking UpTime itanic DooNetwork 7 January 5th, 2009 08:22 PM
[VBScript] Max Uptime MeSteve Script & Plug-In Library Discussion 24 January 3rd, 2007 03:40 PM
Max uptime MeSteve HomeSeer General Discussion Area 26 December 19th, 2006 05:49 PM
Uptime goes 3-digits Stevech General Home Automation Hardware Discussion 11 March 1st, 2004 06:58 AM
Looking for PC-Uptime (not hs.systemuptime) bennyb Script & Plug-In Library Discussion 2 October 29th, 2002 07:16 AM


All times are GMT -4. The time now is 01:25 AM.


Copyright HomeSeer Technologies, LLC