Automatic Lights with Lux sensor not working

Hey all, could anyone please help with simple explanation thy this thing isn’t working ? ( code in url ) im new to this tuff and so far im just cutting and pasting stuff together to make automations, and most of them do work…
https://dpaste.org/Y1kAo

Could you check the automation trace?

sorry for the late response, there has been way to much wrong with it ( im still new to all this stuff ) and I just created new topic, asking for help to build the template from 0…