Fix crash when having no lights groups

- In this case params[:groups] is nil and .each is undefined
- Now using the final variable in any case