Announcement

Collapse
No announcement yet.

Using decimals in calculations

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

    Using decimals in calculations

    I need a simple method to extract a temperature value as a number from the device strings produced by mcstemp. I use Temperature, Humidity and Windspeed in calculations to derive Windchill, Humidex and Dew Point.
    Using the device values only returns the whole part of the numbers and results in somewhat inaccurate results.
    I've tried various VB methods without success as the structure of these strings is a bit difficult to decypher.
    Thanks in advance.
    Real courage is not securing your Wi-Fi network.

    #2
    mcsTemperature provides scripting functions to assist with this. The one most likely to suit your needs is GetDeviceNumber(DC). It will look in the DeviceString and if not null then it will strip the HTML stuff and return the numeric portion. If the DeviceString is null then it will return the DeviceValue.

    For example if your temperature with a decimal is stored in DC [5 then
    ValueWithDecimals = hs.GetPlugins("mcsTemperature").GetDeviceNumber("[5")

    There are also functions if you want lower-level functionality
    WithoutHTMLString = RemoveHTMLTags(sString)
    NumericPortion = MakeNumber(sString)

    Comment


      #3
      hmmm... Perhaps I ought to have re-read the manual. That's exactly what I need. Thanks for the super fast response, Michael.
      Real courage is not securing your Wi-Fi network.

      Comment

      Working...
      X