Detecting a Fill Operation with Trigger

In this code, an asset named Machine is monitored for a change in its weight. If it rises, it is marked as in 'filling' mode and an event is logged.

@at.trigger
@at.data('Machine.Weight')
@at.when(lambda o: o.IsRising(0))
def FillRecord(o):
    if o.Condition() == True:
        o.LogEvent("Machine Filling")
        o.Output("Machine/Filling",1)
        o.Output("Machine/Mode",1)
    else:
        o.Output("Machine/Filling",0)
        o.Output("Machine/Mode",0)