Announcement

Collapse
No announcement yet.

How to pull/extra a number from a string and send it to a device? as a value

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

    How to pull/extra a number from a string and send it to a device? as a value

    If you read this thread you will understand : https://forums.homeseer.com/showthre...=195312&page=2



    I am not sure i can do this with events ( i have the easy trigger plugin)... so is there anyone wiich already have done this with a small script?

    I would just copy paste the code ( and changing my device number , id code or wtv) and use it as an action .


    thank you.

    #2
    Are you asking for a general solution or is the string likely to be constrained to 'nnnnnG', where 'n' can be be present or absent, but will be a sign, a digit or comma if present, and G is always the only letter and always the last character? Or, at least, 'nnnnnccccc', where c is a letter?
    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


      #3
      This may be easier that I originally thought. If the string is just a number mixed with non-numeric characters, this script should work. (I had to change the comma to a decimal point first, but if your local settings are set to use a comma, you can delete that line, I would think.)
      Code:
      Sub Main(ByVal strData As String)
      
          strData = Replace(strData, ",", ".") 
          Dim dblNumber As Double = Val(strData)
          hs.SetDeviceValueByRef(1612, dblNumber, True)    
              
          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

      Working...
      X