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 a.k.a area.The integration supports a variety of sensors, including motion and human presence sensors like the Aqara FP1.

The main features are:

  • Automatic Light Control: Lights in a room are automatically discovered and controlled without any additional configuration. The integration uses the lights assigned to a room (a.k.a area) to seamlessly manage turning them on and off based on motion or human presence sensors.

  • Simplified Setup: No need to manually configure individual lights — just assign your lights to a room a.k.a area in Home Assistant, and Room Light Control takes care of the rest.

  • Scene or Script Activation: Optionally, specify a scene or script to activate for more complex lighting setups. When configured, these scenes or scripts can define exactly how the lights turn on, providing full control over the lighting atmosphere.

  • Human Presence Detection: Supports advanced sensors like the Aqara FP1 (mmWave sensors) to detect human presence and control lights accordingly.

  • Automatic Lights-Off Logic: Lights turn off based on a timer after no motion is detected, or by using occupancy sensors. The timer resets if motion is detected again.

  • Illuminance-Based Lighting: Optionally use an illuminance sensor to only turn on the lights when the natural light level is below a defined threshold.

  • Manual Interference Handling: Automatically pauses auto-control if manual actions are detected, WHEN

    • … lights are already on
    • … a scene is activated while auto-control is running (e.g. Philips Hue Scene turned on with your Smartphone)
  • Turn-Off Blocking Entities: Configure entities that, when active, prevent the lights from being turned off (e.g., if a specific device is running or a condition is met).

  • Flexible Configuration for Advanced Users: Advanced users can define custom scripts or scenes for more tailored lighting behaviors, while simple setups can rely on automatic light discovery and control.

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

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.10.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.

Release History

Version 1.0.5-beta ( 24.11.2024)

Version 1.0.5-beta

Release Date: 24.11.2024

New Features

  • Renamed turn_on_light to activate_light_script_or_scene to better reflect its intended purpose of only working with scenes or scripts.

  • Made activate_light_script_or_scene an optional configuration variable. When it is not provided, the integration will automatically turn on lights in the room (roomLightEntities) instead of requiring a scene or script.

Bug Fixes

  • Improved logging to clearly indicate whether roomLightEntities are being used by default or if a scene/script is being activated.

Breaking Changes

  • The turn_on_light variable has been renamed to activate_light_script_or_scene. Configurations using the old variable will need to be updated to the new name.
Version 1.0.4-beta

Version 1.0.4-beta

Bug Fixes

  • Fixed multithreading related issues wich could lead RLC to crash
Version 1.0.3-beta

Version 1.0.3-beta

New Features

  • add compatibility for color mode xy

Bug Fixes

  • fixed issue with too long ULID
Version 1.0.2-beta

Version 1.0.2-beta

New Features

  • add wiki chapter about debugging

Bug Fixes

  • fixed compatibility issues with Home-Assistant 2023.12

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

I have released a new Version (1.0.5-beta) which makes configuration even easier. No more need for any additional scripts or scenes for simple light scenarios.

Release Notes:

New Features

  • Renamed turn_on_light to activate_light_script_or_scene to better reflect its intended purpose of only working with scenes or scripts.
  • Made activate_light_script_or_scene an optional configuration variable. When it is not provided, the integration will automatically turn on lights in the room (roomLightEntities) instead of requiring a scene or script.

Bug Fixes

  • Improved logging to clearly indicate whether roomLightEntities are being used by default or if a scene/script is being activated.

Breaking Changes

  • The turn_on_light variable has been renamed to activate_light_script_or_scene. Configurations using the old variable will need to be updated to the new name.
1 Like