compare current value with prev value in computed attribute

I'm in the process of setting up Teltonika alarms, but I have a few concerns. Specifically, when there is a power cut and then the power is restored, the IO32 always gets reported by the device. My main question is how I can trigger a "power cut" alarm when the value changes from the previous state.

For example, I'm trying to check if the previous io32 value was 0 (which indicates the device was plugged in) and if the current value is 1. If this happens, it would mean that the device was unplugged. Here's the condition I have:

PREVio32 === 0 ? (io32 === 1 ? "powerCut" : null) : null

(i know this condition doesn't work , its just an exemple )
Can someone help me refine this logic or suggest a better way to implement this?

Anton Tananaev2 days ago

You need to enable processing.computedAttributes.lastAttributes first. Then you'll be able to access lastX where X is your attribute. It should be in camel case.

just testing it , i tried this
fixTime result was Sat Dec 21 02:39:44 CET 2024
lastFixTime result was Sat Dec 21 02:39:44 CET 2024
i always get the same result no matter what attribute i try it in
i tried it in and the attribute that i am sure there value changed from previous position
and i did enabled this processing.computedAttributes.lastAttributes