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

**URL:** https://discourse.nodered.org/t/using-nr-with-ha-how-can-i-control-multiple-lights-with-a-button-and-an-event-like-sunset/37854
**Category:** General
**Created:** [21 December 2020 17:25 UTC](https://discourse.nodered.org/t/using-nr-with-ha-how-can-i-control-multiple-lights-with-a-button-and-an-event-like-sunset/37854 "2020-12-21T17:25:19Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![ghurty](https://avatars.discourse-cdn.com/v4/letter/g/49beb7/32.png) [@ghurty](https://discourse.nodered.org/u/ghurty)
#### Post date: [21 December 2020 17:25 UTC](https://discourse.nodered.org/t/using-nr-with-ha-how-can-i-control-multiple-lights-with-a-button-and-an-event-like-sunset/37854/1 "2020-12-21T17:25:19Z")

</div>

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

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [19 February 2021 17:25 UTC](https://discourse.nodered.org/t/using-nr-with-ha-how-can-i-control-multiple-lights-with-a-button-and-an-event-like-sunset/37854/2 "2021-02-19T17:25:28Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
