added state check before brightness updates