Existing code sets the activation flag, then finds out if it should be set or not. This means that for a relay configured as "continuous" it always lags behind by one activation. Swapping these over makes the relay work as expected each time it is activated.
Also simplifies the code slightly, there is no need to treat relay0 as special here; the previous code guarantees that it will already be ACCESS_GRANTED by the time it hits this loop.
Existing code sets the activation flag, then finds out if it should be set or not. This means that for a relay configured as "continuous" it always lags behind by one activation. Swapping these over makes the relay work as expected each time it is activated.
Also simplifies the code slightly, there is no need to treat relay0 as special here; the previous code guarantees that it will already be ACCESS_GRANTED by the time it hits this loop.