fixed wrong value check for closed state of contact sensor