Using NR with HA, how can I control multiple lights with a button and an event like sunset?

I am trying to use Node Red with HA to control lights and the alarm.

I want to be able to control it based on a button as well as based on a timed event.

  1. How can I make it that a button is pressed in HA will write to a few lights setting them off (I also want to write to my elk panel to arm it)?

  2. Can I have it that an hour before sunset on a set day, an event will be triggered (such as lights turning on)?

Thank you