Room automation light control - programming problem

An error easily avoided if the OP followed PaulS's suggestions about variable names...