Hi there,
just a short following question - have you tried to change the value of your variable in the sketch and let then the relay switch? I have the same setup like you and all works, but when the the variable-value changes because of a sensor, then the OnChange-Method isn't called and the relay does not switch???