By the way, is there any framework to tell boards/pins/devices what to do on Pharo restart or device restart (with or without power down) . For example, you might would want to restart in a safe state, or in the previous state.
There is very little support for this:
Devices implement #connect/#disconnect methods. They are called by system accordingly when pharo is restarted (see PotBoard class>>#startUp:/#shutDown:).