Announcement

Collapse
No announcement yet.

Virtual field without graphic

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

    Virtual field without graphic

    I would like to create a couple virtual devices that have only the text portion of another device. In other words I want to strip the icon that is part of the device contents.

    As an example the DooMotion devices all have an icon displayed in addition to the text. I suspect it is pretty simple but it's got me stumped.

    Thanks.

    #2
    If you run mcsTemperature then you can do it with &hs.SetDeviceString("V1",hs.GetPlugin("mcsTemperature").Remo veHTMLTags(hs.DeviceString("A1")))

    You can also do it with scripting where you parse the string looking for what is not embedded as HTML tags.

    mcsTemperature also has a .GetNumber function that does similiar and returns only the numeric portion of the data in a DeviceString.

    Comment


      #3
      What happens when you store a text string? ie
      hs.setDeviceString "A1","This is a test"

      This should store the string without an embeded icon. The default icon will show in the status view but it's not part of the string.

      I just tried this and it works as I belive you want.
      hs.setDeviceString "A1","This is a test"
      then when I use
      messagebox(hs.deviceString("A1"))
      returned "This is a test"
      -Rupp
      sigpic

      Comment


        #4
        Thanks for the responses, but I still need a little help...


        Hallways Motion DooMotion Plugin Last Motion [2

        Currently device "[2" is the DooMotion Plugin "Last Motion". The device status reflects an icon and the text "Hallways Motion" in it.

        If I wanted a virtual field that just shows the most recent motion, how would I script it if say the virtual field was "v1"?

        Comment


          #5
          If you have mcsTemperature then you define an event with some appropriate trigger with the event action being a one line script that contains &hs.SetDeviceString("V1",hs.GetPlugin("mcsTemperature").R emo veHTMLTags(hs.DeviceString("[2")))

          If you do not have mcsTemperature then the event action will be a call to a script that contains logic to remove the HTML-tagged content and that will leave only the textual portion.

          Comment


            #6
            Thanks Mike for the quick response. I do not have your plug-in installed. I was hoping to be able to strip the icon with a simple script. If there is no way to do that I will try your plug-in as I'm sure that will work.

            Bill

            Comment


              #7
              Originally posted by gelessor View Post
              Thanks for the responses, but I still need a little help...


              Hallways Motion DooMotion Plugin Last Motion [2

              Currently device "[2" is the DooMotion Plugin "Last Motion". The device status reflects an icon and the text "Hallways Motion" in it.

              If I wanted a virtual field that just shows the most recent motion, how would I script it if say the virtual field was "v1"?
              Go to the control tab and run this:
              &hs.writelog "test", hs.deviceString("[2")

              Then cut and past the string here that includes the graphic path and we can show you how to parse it out.
              -Rupp
              sigpic

              Comment


                #8
                Thanks for the help Rupp

                See the attached....
                Attached Files

                Comment


                  #9
                  Having trouble getting the icon to show when I do a cut and paste. See the attached icon. It appears in front of the text "Kitchen Motion"
                  Attached Files

                  Comment


                    #10
                    Try this command. I need to see the actual html and not the image
                    Go to the control tab and run this:
                    &msgbox(hs.deviceString("[2"))
                    -Rupp
                    sigpic

                    Comment


                      #11
                      OK. Here you go...

                      <img alt=""src="/Images/DooMotion/hspi_doomotion.gif align="absmiddle">Kitchen Motion

                      Comment


                        #12
                        Try this.

                        Code:
                        Sub Main(parm as object)
                        dim aVal() as string
                        dim sVal as string
                        
                        sVal = hs.deviceString("[2")
                        aVal = split(sVal, ">")
                        hs.writelog ("Test",aVal(1))
                        ' You can assign the aVal(1) to a virtual device
                        hs.setDeviceString "V1", aVal(1)
                        
                        End Sub
                        Try this as it is untested but should be close
                        -Rupp
                        sigpic

                        Comment


                          #13
                          Getting this error in the log....

                          1/10/2010 6:17:03 PM Event Event Trigger "Last Motion"
                          1/10/2010 6:17:03 PM Event Running script in background: xLobby Last Motion
                          1/10/2010 6:17:03 PM Error Running script, script run or compile error in file: xLobby Last Motion1006:Expected ')' in line 1 More info: Expected ')'
                          1

                          Comment


                            #14
                            Did you make this a .vb script?
                            -Rupp
                            sigpic

                            Comment


                              #15
                              oops...

                              I have attached the scrip (.txt was added to load into message board)


                              OK changed to .vb and get the following in the log....

                              Event Trigger "Last Motion"
                              1/10/2010 8:30:16 PM Event Running script in background: xLobby Last Motion.vb
                              1/10/2010 8:30:16 PM Error Script compile error: Method arguments must be enclosed in parentheses.on line 22
                              1/10/2010 8:30:16 PM SCR Option Strict Offimports Schedulerimports SystemPublic Module scriptcode7#Region "Automatically generated code, do not modify"'Automatically generated code, do not modify'Event Sources Begin Public WithEvents hs As Scheduler.hsapplication Public WithEvents hsp As scheduler.hsp Public WithEvents hssystem As scheduler.phone0'Event Sources End'End of automatically generated code#End RegionSub Main(parm as object)dim aVal() as stringdim sVal as stringsVal = hs.deviceString("[2")aVal = split(sVal, ">")hs.writelog ("Test",aVal(1))' You can assign the aVal(1) to a virtual devicehs.setDeviceString "x20", aVal(1)End SubEnd Module
                              Attached Files
                              Last edited by gelessor; January 10, 2010, 08:48 PM.

                              Comment

                              Working...
                              X