Room Light Control: A presence based light control for your rooms [Custom Component]

Hello everyone

I would like to share my new Home Assistant integration, called “Room Light Control”. RLC is designed to automatically control the lights in a specific room of your house, using the most available sensors possible to create a natural experience when you enter and exit the room.

With RLC, you can automate the control of your lights in a way that’s easy to set up and customize, courtesy also of the auto-discovery based on a room aka area.The integration supports a variety of sensors, including motion and human presence sensors like the Aqara FP1.

The main features are:

  • Automated control of lights in a specific room
  • Support for human presence sensors like Aqara FP1 (mmwave sensors)
  • Lights triggered by motion or occupancy sensors
  • Lights turn off based on a timer or occupancy sensor
  • Timer restarts when motion is detected again
  • Turning on the lights can be constrained by an illuminance sensor
  • Manual interference pauses auto-control WHEN
    • … lights are already on
    • … a scene is activated while auto-control is running (e.g. Philips Hue Scene turned on with your Smartphone)
  • Lights can be blocked from turning off by a configurable entity
  • Easy Configuration with auto-discovery based on a room akka area

It’s as simple as this

# Example configuration.yaml entry
room_light_control:
  - floor_light_control:
      room: floor
      motion_sensor: binary_sensor.floor_motion_sensor
      turn_off_delay: 30 
      turn_on_light: scene.floor_bright

I’ve created a GitHub repository for RLC, where you can download and find the installation instructions, configuration documentation and more examples:

I hope you’ll give it a try and let me know what you think. I’m looking forward to hearing your feedback.

So far this integration has only been tested with my system, see the used sensores/lights below.

  • Home-Assistant 2024.7.3
  • Philips Hue Integration
  • Aqara Motion Sensor
  • Philips Hue Motion Sensor
  • Aqara FP1 mmwave human presence sensor
  • Aqara FP2 mmwave human presence sensor
  • Everything Presence One presence sensor

Issues/Bugs
Please report any issues/bugs on my github repository page as it will be easier to track and resolve your submitted bugs.

Releases

v1.0.4-beta

  • Fixed multithreading related issues wich could lead RLC to crash

v1.0.3-beta

  • fixed issue with too long ULID
  • add compatibility for color mode xy

v1.0.2-beta

  • fixed compatibility issues with Home-Assistant 2023.12
  • add wiki chapter about debugging

Special credits goes to Daniel Mason, the creator of entity-controller from which I got inspired and used his code base as starting point for my own integration as a non native phyton developer :slight_smile:

4 Likes

Hello everybody,

I wanted to reach out to gather some valuable insights from you regarding my Integration, because of the low interest in it.
I’m just wondering, if there is generally no interest in controlling the lights in a room or maybe it doesn’t just cover your use cases. Or maybe you do it just basic with an automation script.

Thanks and I’m looking forward to hearing from you.

Regards
Valem

Hallo

I am about to try your project. I will let you know how it goes.

Hi, great! Let me know if you encounter any issues. Glad to help you out

Anyway to do debugging? I followed the config example but it seems the custom config is having trouble turning off the light

1 Like

This is the config I used, it managed to turn the light on but will not turn it off.

room_light_control:
    - office_light_control:
        room: Office
        motion_sensor: binary_sensor.esp_mmwave_occupancy
        turn_off_sensor: binary_sensor.esp_mmwave_occupancy
        turn_off_delay: 2 
        turn_on_light: light.office
        turn_off_light: light.office

ps: The light is a Philips Hue play bar

The turn_off_light accepts only a script. You can not configure a light directly. You can also omit the turn_off_light, then all the lights which are related to your room (area) will turn off

Actually also the turn_on_light supports only either a script or a scene, but it still seems to work if you configure a light directly.

take a look at the example configurations on the github page https://github.com/Valem/room-light-control#configuration-variables

As you have Philips Hue, all the scenes are imported automatically into HA. Try to use one of those Scenes to turn on the light and just omit the turn_off_light.
That should do the trick.

Thanks. Cool work. I ended up setting a simple script to turn it on/off. It would be cool if it can support running different script on time of the day(or maybe I can put it as a condition in the script itself?) as I have some lights used for night lights that I don’t wish to be turned on automatically until pretty late

I’m glad it works now. Yes exactly, if you want to control the light for different times in a day. E.g. Nighttime with a softer less bright tone, then you can do it with a script.

The reason that it works with scripts or scenes is to give more flexibility in controling how the light should behave.

For my bathroom I use following script to turn on the light:

script:
  bath_motion_activate_light:
	sequence:
	  - choose:
		  - conditions:
			  - condition: state
				entity_id: sensor.anybody_sleeping
				state: "True"
			sequence:
			  - service: scene.turn_on
				target:
				  entity_id: scene.bath_night
				data: {}
		default:
		  - service: script.lights_bath_on_auto
			data: {}

1 Like

@oreo_cake

Just added a debugging chapter to the wiki

This looks like it might be exactly what I’ve been looking for. I’d like to turn off all lights in the basement if there is no motion sensed on any of the sensors I have down there.

Only problem is that I have been working exclusively in the UI of Home Assistant and don’t know how to work with yaml. Any plans to make this workable in the UI? Thx!

It seems that your goal - turning off all basement lights when no motion is detected, might be more easily achieved with a simple Home Assistant automation, rather than using the “Room Light Control” integration. This integration treats the entire basement as a single room (configured in the way you wanna use it), meaning any motion anywhere in your basement would trigger all lights, which might not fit your needs.

Regarding your request for a UI-based configuration, there are currently no plans to enable this feature in the “Room Light Control” integration. If you prefer working exclusively within the UI, the best recommendation I can give you, is setting up an automation directly in Home Assistant.

Hope this helps.

1 Like