This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Setting a trend back to nil
#1
I have a trend that I only want to plot some of the time.  This is for an A/C's set point, which I only want to plot when the A/C is actually turned on.   I'd rather not plot it as zero when it's off because that affects the Y-axis scaling.  To achieve this I'm trying to clear or nil the object's value, similar to when it's first created.

Note, this is for a C-Bus Automation Controller.  The SetCBusMeasurement function doesn't accept a nil value, but can this be achieved through the standard LM libraries?

Here is my (non-working) code. The grp.find call successfully retrieves an object, but I cannot get it to clear the value:


Code:
    if ( ac["SystemOn"] == true ) then
        SetCBusMeasurement(0, CBUS_MEASUREMENT_DEVICE, CBUS_MEASUREMENT_CHANNEL_SETPOINTACTIVE, ac["Setpoint"], CBUS_MEASUREMENT_UNIT_CELSIUS) 
    else
      log("Setpoint Active : trying to set set to nil so it doesn't plot on trend")
      local obj = grp.find("0/"..CBUS_MEASUREMENT_APP.."/"..CBUS_MEASUREMENT_DEVICE.."/"..CBUS_MEASUREMENT_CHANNEL_SETPOINTACTIVE)
      if ( obj ~= nil ) then
        obj.value = nil        
        obj.data = nil   
        obj.datahex = ""
      end
    end
Reply


Messages In This Thread
Setting a trend back to nil - by mykro - 05.02.2018, 22:55
RE: Setting a trend back to nil - by admin - 06.02.2018, 10:35
RE: Setting a trend back to nil - by mykro - 12.02.2018, 02:39

Forum Jump: