How to deal with device command state that doesn't change back when in use (motion sensor)?

Links with instructions here…