Hue light colors are not the same

I’m trying to save the state and then after the even (change color to tell me the kids door is open) go back to the color it was before. I have it working except the color it returns to is not exactly the same. Is there a better way to return back to the original color?

what hue attributes are you saving?

state.previousState = [ hue: bulb.currentHue, saturation: bulb.currentSaturation, level: bulb.currentLevel, status: bulb.currentSwitch ]

is the HUE being returned as a decimal or integer?
If it’s an integer, then that’s your problem.
Also as an FYI, you can set these colors in one shot using hueBulb.setColor( [hue:79.1666666667, saturation:100, level:100])