SMART LIVING
SmartLights

Efficient Illumination: Turning Off Lights When Daylight is Abundant

Efficient Illumination: Turning Off Lights When Daylight is Abundant
0 views
2 min read
#SmartLights

Frequently in our residence, certain family members tend to leave the lights illuminated. When someone is still at home, the existing home automation fails to trigger, leading to all lights remaining on when nobody is home. My desire is for the lights in a room to be turned off when sufficient daylight is present.

To achieve this, I employ Home Assistant and utilize a z-wave PIR sensor to gauge lux. The lighting aspect involves Philips hue lights, where lux serves as the unit of measurement for light intensity. More information on lux can be found here.

The Automation Process

In Home Assistant, navigate to Configuration (right menu), then Automations, and click the Add Automation button.

Start with an Empty Automation

Name the automation and place it in Single mode.

When Daylight is Sufficient, Turn Off Lights

Triggers: When daylight is sufficient, triggering the automation.

  • Trigger type is device, and as lux changes on the device, the automation activates.
  • A lux threshold of 75 is set for a duration of one minute. Testing this ensures a steady reading, avoiding false positives.

Conditions: No specific conditions are applied.

Actions: The primary action is to turn off the lights when daylight is deemed sufficient.

  • This action is applied to the device, and the relevant room is selected. It results in the deactivation of all lights in that room.

The Code

alias: When daylight is sufficient, turn off lights
description: ''
trigger:
  - type: value
    platform: device
    device_id: 907f544f1d5a7c915062cadb56d39c1f
    entity_id: sensor.device_name
    domain: sensor
    above: 75
    for:
      hours: 0
      minutes: 1
      seconds: 0
condition: []
action:
  - type: turn_off
    device_id: e11ea2388c1569d19de50ba1141f5aaa
    entity_id: light.device_name
    domain: light
mode: single

This code encapsulates the automation, ensuring that when daylight is deemed sufficient, the lights in the specified room are gracefully turned off. Feel free to adjust lux thresholds and durations according to your preferences during the testing phase.