added write bulbStatesFile