Announcement

Collapse
No announcement yet.

How can I tell if another network PC is turned on?

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

    #16
    Tim,
    That's looks familiar

    PHP Code:
    sub main()
    'IP address | virtual device code ...
    CompaqLaptop = "192.168.0.202" & "|" & "N21"
    WeatherServer = "192.168.0.201" & "|" & "N17"
    SonyPlayStation = "192.168.0.102" & "|" & "N19"
    HomeSeerServer = "192.168.0.200" & "|" & "N24"
    MegansPC = "192.168.0.103" & "|" & "N18"
    CF01 = "192.168.0.186" & "|" & "N20"
    DellLaptop = "192.168.0.198" & "|" & "N22"
    AudryKitchen = "192.168.0.101" & "|" & "N23"

    GoPing CompaqLaptop
    GoPing WeatherServer
    GoPing SonyPlayStation
    GoPing HomeSeerServer
    GoPing MegansPC
    GoPing CF01
    GoPing DellLaptop
    GoPing AudryKitchen

    end sub

    Private Sub GoPing(strData)
        splVals = Split(strData, "|")
      
        strVar = hs.ping(cstr(splVals(0)) , 2)
        If strVar = 0 Then
            Status = "<font color='
    lime'> OnLine @ " & Time & "</font>"
        Else
            Status = "<font color='
    red'> OffLine @ " & Time & "</font>"
            if splVals(0) = "192.168.0.201" then
        hs.SendEmail "3995542@skytel.com", "grhughes@ruppworld.com", "WeatherServer is offline", "WeatherServer is off line"
            end if
        End If
        hs.SetDeviceString splVals(1), Status, True
    End Sub 
    💁‍♂️ Support & Customer Service 🙋‍♂️ Sales Questions 🛒 Shop HomeSeer Products

    Comment


      #17
      how do you run a Php script? Does Php have to be the file extension for the above script?

      Comment


        #18
        Jeff,
        These aren't php scripts that is just the tag this BB uses to wrap vbscript and asp scripts to get them to display correctly without rendering the code. They really need to change that to a much more generic term like script or something like that.

        The script I posted is just a simple vbscript that ends in a .txt extension.
        💁‍♂️ Support & Customer Service 🙋‍♂️ Sales Questions 🛒 Shop HomeSeer Products

        Comment


          #19
          of course....always simpler than what I think!

          Comment


            #20
            can this technique be used to ping external sites as well? I tried it with my dns2go site, but it returns an "unknown".


            Also, how do you detect all the devices on the network? My son has an Xbox I would like to determine what the IP address is?

            Comment


              #21
              Rupp, you sent that to me many moons ago
              And still works perfect
              Thanx
              Tim
              FB Page - https://www.facebook.com/pages/Capt-Tim/209398425902188

              HSTouch Layouts - https://www.facebook.com/media/set/?...5902188&type=3

              Comment


                #22
                Depending on whose router you have, it should be able to tell you what IP address it assigned via DHCP. You can then try them with a ping to see which ones respond, and by turning things on and off which is the Xbox. I would be surprised if there was not a way for the Xbox to just tell you its IP address though.

                Comment


                  #23
                  Thanks Barry, I found the listing in the DHCP listing on the router (an SMC Barricade) and then muddled my way through my son's XBOX to find an IP screen which verified it. Thanks

                  Comment


                    #24
                    Monitoring Game Time

                    I use the XBox Online/Offline ping to determine amount of time my kids are playing games. I ping it every 5 minutes. I give them 3 hours on Wed., Friday and 6 hours on Saturday. They owe me $$ if they go over their allowed time. They have not figured out how I'm tracking their time, yet.

                    BTW: I don't count in the time the first 5 minutes or last 5 minutes that I see the unit on, so they are actually getting upto 10 free minutes. And it is saved in a database so if and when the argue I have proof.

                    Comment


                      #25
                      AlbuquTurkey, I would love to see how this is done. Could you share your methods/scripts?
                      Thanx
                      Tim
                      FB Page - https://www.facebook.com/pages/Capt-Tim/209398425902188

                      HSTouch Layouts - https://www.facebook.com/media/set/?...5902188&type=3

                      Comment


                        #26
                        Tracking XBox usage

                        I just looked at the code and it is a mess - hard for me to follow and I've been modifiing it from work after Rupp's Ping posting - since that looked really neat. Let me clean it up tonight and give credit where credit is due and I'll post it. Look back in about 4 hours.

                        Comment


                          #27
                          Great!

                          I'd be very interested in that also.

                          Steve C.

                          Comment


                            #28
                            IP Status Monitoring

                            XBox OnLine Monitoring

                            PHP Code:
                            ' database adopted from hvac_logging.txt
                            Chuck Preecs 5/18/2003

                            ' ping adopted from Rupp's posting 
                            ' Homeseer Board 5/19/2005


                            Const debugFlag = 0
                            Const scriptName = "IP_Monitor.txt"

                            Sub Main()
                              
                              if debugFlag = 1 then hs.writelog scriptName, "============START (" & Now & ")============" end if

                             '
                            IP address virtual device code ...
                            XBox "192.168.1.45" "|" "Z5"


                            Call GoPing (Xbox)

                            if (
                            hs.DeviceString("Z5")="<font color='lime'>OnLine</font>"then 
                                
                            if debugFlag 1 Then hs.writelog scriptName"Xbox is on" end If
                                
                            Call LogData ("XBox",1)
                              else 
                                if 
                            debugFlag 1 Then hs.writelog scriptName"Xbox is off" end If
                                
                            Call LogData ("XBox",0)
                            end if

                              
                              if 
                            debugFlag 1 then hs.writelog scriptName"============END (" Now ")============" end if
                              
                            End Sub 'main

                            sub LogData(unit,status)
                            '
                            *****************************************************************************
                            ' Log to a database
                            '
                            *****************************************************************************

                            '* Declare and set objects/variables

                            name of Access database file
                            Const strDatabaseName "OnLine.mdb"
                            Dim objConn
                            Dim strConnectionString
                            strDatabasestrSQL
                            strDatabase 
                            hs.GetAppPath "/" strDatabaseName
                            strConnectionString 
                            "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" strDatabase

                            ' Open database connection
                            Set objConn = CreateObject("ADODB.Connection")
                            objConn.Open(strConnectionString)

                            Insert row
                            strSQL 
                            "INSERT INTO tblIpStatus (DTS, Unit, Status) VALUES ('"Now "', '" unit "', " status ")"
                            if debugFlag 1 Then hs.writelog scriptNamestrSQL End If
                            objConn.Execute strSQL

                            ' Close database
                            objConn.Close
                            Set objConn = Nothing

                            end sub '
                            *** end LogTemp()



                            Private 
                            Sub GoPing(strData)
                                
                            dim splValsstrVar

                                splVals 
                            Split(strData"|")
                              
                                
                            strVar hs.ping(cstr(splVals(0)) , 2)
                                If 
                            strVar 0 Then
                                    Status 
                            "<font color='lime'>OnLine</font>"
                                
                            Else
                                    
                            Status "<font color='red'>OffLine</font>"
                            '   keeping for future use  5/19/05 ea
                            '        
                            if splVals(0) = "192.168.1.40" then
                            '    hs.SendEmail "eric.albright@dalsemi.com","lalbright34@sprintpcs.com","Phone System Down","Phone System Down"
                            '        
                            end if
                                
                            End If
                                
                            hs.SetDeviceString splVals(1), StatusTrue
                            End Sub  
                            'end GoPing() 
                            There are a couple of ways to figure the time with this.
                            1) the actual times are posted in the database
                            2) know the interval that you are running the event and sum the status column for the time range your looking for then multiply by the interval giving you the number of minutes that the item was on.

                            I cut out the monitoring of the phone system and other computers which use the same event hopefully I didn't cut anything that was needed. If it doesn't work let me know and I will help figure out what is missing.

                            I noticed in that my notes on this that it works only while online since the xbox does activate the lan unless it is using it. In my case my son is either online with it or not using it, so it works for me right now.

                            Comment


                              #29
                              Rupp

                              I am using your script... Which is great!

                              Is there an easy way for it to write the machine name with "Is Offline" to a device code like v1? And comma seperate them if there is more then one?

                              Thanks

                              Comment


                                #30
                                AlbuquTurkey,
                                Thanx much
                                Tim
                                FB Page - https://www.facebook.com/pages/Capt-Tim/209398425902188

                                HSTouch Layouts - https://www.facebook.com/media/set/?...5902188&type=3

                                Comment

                                Working...
                                X