Beginner advice - Light colour based on doors opened

I have been building up my HA with sensors and devices over the last 8 months. I’ve been taking a slow and steady approach, until now. I have a few crude automations in place, but would now like to start ramping them up.

I would like to ask for some direction on the following scenario:

  • The doors have binary sensors. They are regular doors, and a garage door.
  • I have an RGB night light in the middle of the house.
  • I would like the light to change colour based on: if the garage door is open regardless of other door states, and a different colour if any other door is open.

I already have a template sensor for each door. But, would it be best practice to create another template sensor (or group) to check if any door (except the garage) is open?
Then do I need one automation for each light colour, or can a single automation control different colours.

I’m just a little confused and need some direction. I think once I understand this scenario, it will make it clearer for others I have in mind. Thanks for any guidance.

This thread may help, where the poster changes the colour based upon the train status.

You’ll basically be creating an automation with a template, that sets the light colour based upon the logic you write. I’d suggest you create a group of internal doors, and another for your external doors, then one for all doors. Then you can have a sensor that’s roughly:

{% if is_state("sensor.garage_door", "on" ) %}
 "red"
{% elif is_state ("group.external_doors", "on" ) %}
 "blue"
{% else %}
"green"
{% endif %}

You’ll then need an automation that if group.all_doors is on, turns the light on with the color_name from the sensor value.

1 Like

Thank you for the prompt reply.
I will take your comments and from the link on board and spend some time over the course of the next week to give this a go.