Announcement

Collapse
No announcement yet.

xml to device (how)

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

    xml to device (how)

    Hi all , how can i put this into a device

    lets say i want baby tv in an device (T1)
    how can i do that ?

    the url is this one
    http://192.168.0.35/web/subservices

    this is the response from above url
    Code:
    <e2servicelist>
    <e2service>
    <e2servicereference>1:0:1:15BC:7ED:2:11A0000:0:0:0:</e2servicereference>
    <e2servicename>BabyTV</e2servicename>
    </e2service>
    </e2servicelist>

    i found a script on another topic but it doesnt write to the device
    i get an error

    PHP Code:
        Error 1    Running script C:\Program Files (x86)\HomeSeer HS3\scripts\skype_unknown.vb :Exception has been thrown by the target of an invocation.Conversion from string "t1" to type 'Integer' is not valid
    Code:
    Sub Main(parms As Object) 
    Dim Is_URL As String 
    Dim Is_page As String 
    Dim Is_start As String 
    Dim Is_eind As String 
    Dim Is_MyPos As Integer 
    Dim Is_lengte As Integer 
    Dim Is_script As String 
    Dim debug As Integer 
    Dim Is_DS As String 
    
    debug = 0 
    Is_script = "dbtest" 
    Is_URL = "192.168.0.35" 
    Is_page = "/web/subservices" 
    Is_start = "<e2servicename>" 
    Is_eind = "</e2servicename>" 
    Is_DS = "T1" 
    
    Is_page = hs.GetURL(Is_URL, Is_page, False, 80) 
    If debug = 1 Then hs.SaveINISetting(Is_script, "XXXXXXXXfull page", Is_page, "my_gets.ini") 
    Is_lengte = len(Is_start) 
    If debug = 1 Then hs.writelog("Is_lengte:", Is_lengte) 
    Is_MyPos = Instr(Is_page, Is_start) 
    Is_MyPos = Is_MyPos + Is_lengte 
    If debug = 1 Then hs.writelog("Is_MyPos:", Is_MyPos) 
    Is_page = mid(Is_page, Is_MyPos) 
    If debug = 1 Then hs.SaveINISetting(Is_script, "XXXXXXXXright page length", Is_MyPos, "my_gets.ini") 
    If debug = 1 Then hs.SaveINISetting(Is_script, "XXXXXXXXright page", Is_page, "my_gets.ini") 
    Is_MyPos = Instr(Is_Page, Is_eind) 'Returns the position of the first occurrence of one string within another. 
    If debug = 1 Then hs.writelog("Is_MyPos end:", Is_MyPos) 
    Is_page = mid(Is_page, 1, Is_MyPos - 1) 
    If debug = 1 Then hs.SaveINISetting(Is_script, "XXXXXXXXfinal page right", Is_MyPos, "my_gets.ini") 
    If debug = 1 Then hs.SaveINISetting(Is_script, "XXXXXXXXfinal page", Is_page, "my_gets.ini") 
    If Is_page <> hs.DeviceString(Is_DS) Then 
    hs.SetDeviceString(Is_DS, Is_page, True) 
    End If 
    end sub
    Preferred -> Jon's Plugins, Pushover, Phlocation, Easy-trigger,
    Rfxcom, Blade Plugins, Pushbullet, homekit, Malosa Scripts




    HS3Pro 4.1.14.0 on windows 10 enterprise X64 on hp quadcore laptop 8 GB.

    #2
    Look here for some similar ideas - http://forums.homeseer.com/showthread.php?t=177563

    Comment


      #3
      hi Adam thanks for the reply ,

      i know that topic , but there is nothing i can use , if i could fix the script from above than its ok , but only 1 line is wrong and i cant get it to work .

      regards
      Preferred -> Jon's Plugins, Pushover, Phlocation, Easy-trigger,
      Rfxcom, Blade Plugins, Pushbullet, homekit, Malosa Scripts




      HS3Pro 4.1.14.0 on windows 10 enterprise X64 on hp quadcore laptop 8 GB.

      Comment


        #4
        As you use my datascraper script already, why not just use that?
        Jon

        Comment


          #5
          yeah right ! i check it out now

          do you think it works also ?


          Originally posted by jon00 View Post
          As you use my datascraper script already, why not just use that?
          Preferred -> Jon's Plugins, Pushover, Phlocation, Easy-trigger,
          Rfxcom, Blade Plugins, Pushbullet, homekit, Malosa Scripts




          HS3Pro 4.1.14.0 on windows 10 enterprise X64 on hp quadcore laptop 8 GB.

          Comment


            #6
            I don't see why not:

            Pattern1=(?s)<e2servicename>(.*?)</e2servicename>
            Jon

            Comment


              #7
              thanks JON

              it works , but my string returns as text (false) , can i say if its false then change to on ? like replace the word false to the word on and if it returns true replace to off ,can your script do that or can i better use easytrigger with it ?

              Originally posted by jon00 View Post
              I don't see why not:

              Pattern1=(?s)<e2servicename>(.*?)</e2servicename>
              Preferred -> Jon's Plugins, Pushover, Phlocation, Easy-trigger,
              Rfxcom, Blade Plugins, Pushbullet, homekit, Malosa Scripts




              HS3Pro 4.1.14.0 on windows 10 enterprise X64 on hp quadcore laptop 8 GB.

              Comment


                #8
                You could try:

                DeviceText1=[0] [replace "false","on"] [replace "true","off"]
                Jon

                Comment


                  #9
                  yes it works

                  many thanks !

                  Originally posted by jon00 View Post
                  You could try:

                  DeviceText1=[0] [replace "false","on"] [replace "true","off"]
                  Preferred -> Jon's Plugins, Pushover, Phlocation, Easy-trigger,
                  Rfxcom, Blade Plugins, Pushbullet, homekit, Malosa Scripts




                  HS3Pro 4.1.14.0 on windows 10 enterprise X64 on hp quadcore laptop 8 GB.

                  Comment


                    #10
                    Remember this also works with the device value setting:

                    DeviceValue1=[0] [replace "false","1"] [replace "true","0"]
                    Jon

                    Comment

                    Working...
                    X