I'm trying to filter a tag based on its own values and the values of two others. The other two tags' time stamps are not necessarily in sync with the tag of interest. Here's what I have so far:
''SWITCH' = "OFF" AND 'REMOTE' = 0 AND 'SPEED' > 0
'SWITCH' is the tag being filtered by its own values. 'REMOTE' can be either 0 (off) or 1 (on), and 'SPEED' refers to how fast the asset is moving. So, I want to find when the switch was off, the remote was off, and the speed was greater than 0 km/h. The issue with this is in cases where one tag stops having values reported the filter keeps looking back at the last known value, resulting in false positives. Here's an example of the kind of data I'm talking about that leads to false positives:
The grey is speed, blue is the switch, and orange is the remote. You can see the point near 22:19 that is causing the issue. With the filter applied above, I'm told that the conditions I'm looking for were met from shortly after that grey point all the way up to when the blue SWITCH goes back to on.
Is there a way to have PI ignore the last known value if it wasn't within a short time span of the SWITCH time stamp (say 5 sec, since that's the interval that we get the values at)? Or is there a better way to go about finding the information I want?