Better lights

I use this to turn on hallway lights In response to a motion sensor.

But on cloudy days, or depending On the season sometimes the place is dark before that.

What’s a better way?

An additional light sensor, or even better, a motion sensor with integrated light sensor like the zigbee model from Xiaomi, or similar.

Then you can condition on a light threshold instead of sunset and sunrise.

Actually with PIR motion sensors are they mostly the same in terms of quality and sensitivity?
I chose mine based on AAA battery and not weird button ones.

The Xiaomi/Aqara one I mentioned, and which I use for exactly the same purpose, to turn on lights when the light intensity is below a certain threshold, uses a CR2450 battery, which lasts 2+ years in my situation - depending on the frequency it is actually being used/triggered I suppose :wink:

Not sure if you meant CR2450 being a button (battery) or not. There must be similar ones around using AAA or AA batteries as well if that’s what you prefer.

Or if you are into DIY: Outdoor Lux Sensor

Yes CR2450 are not common here at all. We have CR 2032
and I assume these batteries last less than the larger AAA

I use this logic
found this

    - name: illuminance
      # friendly_name: "Sunlight Percentage"
      unique_id: 9f57cea2-b4e0-4fd0-b1f0-f3a351f6154ff50fee79-c60b-484e-b364-0ed2909a71b3
      state: >-
        {%- set elevation = state_attr('sun.sun','elevation') | float %}
        {%- set cloud_coverage = state_attr('weather.home','cloud_coverage') | float %}
        {%- set cloud_factor = (1 - (0.75 * ( cloud_coverage / 100) ** 3 )) %}
        {%- set min_elevation = -6 %}
        {%- set max_elevation = 90 %}
        {%- set adjusted_elevation = elevation - min_elevation %}
        {%- set adjusted_elevation = [adjusted_elevation,0] | max %}
        {%- set adjusted_elevation = [adjusted_elevation,max_elevation - min_elevation] | min %}
        {%- set adjusted_elevation = adjusted_elevation / (max_elevation - min_elevation) %}
        {%- set adjusted_elevation = adjusted_elevation %}
        {%- set adjusted_elevation = adjusted_elevation * 100 %}
        {%- set brightness = adjusted_elevation * cloud_factor %}
        {{ brightness | round }}
      availability: >-
        {% from 'availability_template.jinja' import avail %}
        {{- avail(['sun.sun','weather.home']) | bool -}}
      unit_of_measurement: "%"
      device_class: illuminance
      icon: mdi:sun-angle

then added this to my automation condition

    entity_id: sensor.illuminance
    below: 11

Thanks I will try that out
could possibly even turn on the light brightness according to the illuminance