Announcement

Collapse
No announcement yet.

Is there a way to monitor a laptop going off AC supply?

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

    Is there a way to monitor a laptop going off AC supply?

    Hey all,

    I am slowly putting together a automation system, and my next step is power outage detection.

    I have opted to use an old Laptop as my HS server. This means my tiny UPS can be specifically to hold up my router and the battery in the Laptop will hold up HomeSeer long enough to send me an alert of the power outage.

    What I want to know is, how can I get HS to detect when the laptop moves from AC to battery? Is there a way this can be done via a plug in, or will a script of some sort be required?

    Thanks for the help.

    #2
    Jon00 Battery Monitor:
    http://forums.homeseer.com/showthread.php?t=175564

    I use this on my Win 8.1 tablet and it works great.

    Comment


      #3
      You can also use Windows built-in functions in a script. This is one that I use. It queries the power status, which returns 'Online' if the battery is charging. I then set the string of a device and set device value to match.
      Code:
      Public Sub Main(ByVal parm As Object)
      
          Dim strPower As String
          Dim power As Type = GetType(System.Windows.Forms.PowerStatus)
          Dim pi As System.Reflection.PropertyInfo() = power.GetProperties()
      
          Dim objPropval As Object = pi(0).GetValue(System.Windows.Forms.SystemInformation.PowerStatus, Nothing)
      
          strPower = objPropval.ToString
          hs.SetDeviceString("U80", strPower)
      
          If strPower = "Online" Then 
                  hs.SetDeviceValue("U80", 100)
          Else
                  hs.SetDeviceValue("U80", 0)
          End If
      
           objPropval = Nothing
           pi = Nothing
           power = Nothing
      
      End Sub
      Mike____________________________________________________________ __________________
      HS3 Pro Edition 3.0.0.548, NUC i3

      HW: Stargate | NX8e | CAV6.6 | Squeezebox | PCS | WGL 800RF | RFXCOM | Vantage Pro | Green-Eye | Edgeport/8 | Way2Call | Ecobee3 | EtherRain | Ubiquiti

      Comment


        #4
        Originally posted by JimBob View Post
        Jon00 Battery Monitor:
        http://forums.homeseer.com/showthread.php?t=175564

        I use this on my Win 8.1 tablet and it works great.
        Thanks JimBob - this worked a treat!

        Comment

        Working...
        X