Announcement

Collapse
No announcement yet.

Minimum and maximum temperatures

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

    Minimum and maximum temperatures

    Is there any way to get mcsTemperature to display the minimum and maxiumum temperatures recorded (ever) in two HS devices?
    Malcolm

    #2
    When a Trend graph with a table is generated the Max and Min values appear for the period selected so the information is readily available already. Selecting specific sensors for min/max is better handled with a script that is run in a periodic event that has the same time interval as the mcsTemperature data collection interval. If you need help with such a script then I can provide it.

    Comment


      #3
      getting a value and displaying it in a device by script I could probably handle but i'd be lost getting the min and max - they're not stored anywhere corrrect? So i'd have to read through all the values stored to find the min and max?

      I wondered instead if this script - http://board.homeseer.com/showthread.php?t=100366 - might do the business. It would only build up the min and max over time and ignore all my hsitorical data but I think I could set them with some initial values...

      Agree?
      Malcolm

      Comment


        #4
        I think that that is overkill for what you need.

        You can find the min and max over the past of any sensor for which you have defined a chart group by showing the chart with a duration of 1 year using the table or lintab format.

        If you want real time update of high and low to be shown in virtual devices then create an event that run every 5 minutes or whatever you data collection interval is.

        Assume your devices are "[4" for the sensor and "V1" and "V2" for the min and max respectively and your event scripting action is
        MinMax.txt (Main/"[4;V1;V2")

        Contained in MinMax.txt is

        sub main(sDevices)

        Const CURRENT = 0
        Const MIN = 1
        Const MAX = 2
        arrDevices = split(sDevices,";")

        sMinDC = arrDevices(MIN)
        sMaxDC = arrDevices(MAX)
        sCurrentDC = arrDevices(CURRENT)

        iCurrent = hs.DeviceValue(sCurrentDC)

        if iCurrent < hs.DeviceValue(sMinDC) then
        hs.SetDeviceValue sMinDC,iCurrent
        hs.SetDeviceString sMinDC,iCurrent
        hs.SetDeviceLastChange sMinDC,now
        end if

        if iCurrent > hs.DeviceValue(sMaxDC) then
        hs.SetDeviceValue sMaxDC,iCurrent
        hs.SetDeviceString sMaxDC,iCurrent
        hs.SetDeviceLastChange sMaxDC,now
        end if

        end sub

        You can add as many events as you like for different temperatures for which you want to monitor min and max.

        Comment


          #5
          Thanks Michael that works a treat!

          I set it up for the sensors I wanted; let it run for a short while to test it and set some initial values and then ran a script to set the values to the min and max values from my database. Thanks again, appreciate your help.

          Roll on July!

          Malcolm

          Comment


            #6
            can someone point me in the right direction - how do I change the little radio button to the left of my temperatures to a more meaningful icon/picture? Is there a hs.set.... command for that?

            Thanks
            Malcolm

            Comment


              #7
              I believe you will need to use HTML tags to reference your desired graphic(s). Something like the following should give you want you want

              hs.SetDeviceString "A1", "@img source='\Images\Temperatures\" & round(Temperature) & ".gif@" & Temperature & " C"

              where Temperature is the numeric value that you want to display and the @ is replaced with < and >

              Comment

              Working...
              X