Hi,
First step for you to get helpful reactions is to correctly format the code in you post.
See: How to help us help you - or How to ask a good question and specifically Format it properly.
What I don’t understand from your automation code is that there only is a Trigger defined, and no Action?