Add localconfig to all state functions

Abstract the opts loading to a seperate function, and check a specific kwarg

Continuation of #15758