add DISTINCT in sql command in function SendToAvlsEventColumnSetNegativeOneIfPowerOff