First, whenever you post YAML code or logs, please follow the instructions at the top of the page so it is formatted correctly. If you don’t it’s very difficult to read, and especially difficult to spot common problems like indentation issues.
But to answer your question, add a sun condition like the following:
condition:
condition: state
entity_id: sun.sun
state: 'below_horizon'