Gateway tag change script is getting triggered at random intervals

I have a gateway tag change event configured to a remote provider's tag that is getting triggered at random times. Digging through the logs, this appears to happen when the connection between the remote and local gateway drops and is then re-established. See the log below:

The script it triggers generates and distributes a report. Now, I though that putting in some basic logic into the script would help weed out these accidental triggerings, but the report is still getting distributed regardless. See the event script below:

date = system.date.now()
day = system.date.getDayOfWeek(date)

if not initialChange and newValue.getValue() == False and newValue.getValue() != previousValue.getValue() and (day > 1 and day < 7):
	#Script that executes and distributes the report went here

Anyone have any recommendations on fixing this? I figures that newValue.getValue() != previousValue.getValue() would fix this, since the tag doesn't change during these events.

What Change Triggers do you have it watching?

image

2 Likes

Just value

image

Log the previous value and current value. I'd put money down that previous value is coming in as null when you see extra triggers.

3 Likes