Binding development - Initalise to previous state on restart and query state when handling command


So i’m working on a binding that when a handleCommand comes in it needs to check the state of other channels to decide how to handle that command. How can I do this?

Also for initialisation I need to initalise to the same state Openhab2 was before shutdown - how can I do that?