Preparing for sunny weather. Tips please?

I’m in the UK and I set up Home Assistant last Autumn (Fall) as the days were getting darker.

Today was the first sunny day of the year and I realise my automations are going to require some seasonal adjustment. I work from home and have two office lights that come on as I enter the room and turn off 30 minutes after no activity. I have an automated roller blind that opens on sunrise and closes on sunset.

I realise that for the sunny months I don’t need the lights on all day and my desk is too sunny when the sun is out in the morning. I can guess some automations myself, like half-closing the blinds on sunny days according to the weather, but figured you people here could give me some better advice.


Use a light sensor, like the Xiaomi Mijia one. Then you can turn the lights on as the room gets dimmer, and off as it gets brighter.

You could use the same logic for the blinds, closing them when the light goes above a certain level, and opening them when it goes below a certain level.

Thank you. I have a couple of Xiaomi sensors which include luminosity. For instance, this is the reading for my son’s room.

So for that I suppose the automation would be to turn the lights on if there was someone in the room AND the luminosity would be below a certain amount. Is that right?

As for the blinds, I think I need some other trigger. It’s only a problem if I’m sitting at my desk. Maybe the blinds lower 75% if the sun is out from Monday through Friday?

Yes, and this is exactly what I do. Trigger on the room becoming occupied or the light level falling below 30, with the conditions of the room being occupied and the light level being below 30.

The workday sensor could cover that, if that’s you working from home. The logic would be similar though. You could also build out some form of presence detection - for instance I use the nmap device tracker and the fact that my work laptop shows home.

1 Like

@Tinkerer suggestion is certainly the most accurate and robust method of accomplishing what you need. However, if you don’t have a physical illuminance sensor in all of your rooms, you could try a weather based illuminance sensor in the meantime.

Set up an automation that will turn off all your lights when the illuminance (sun elevation works too, but illuminance is more consistent) goes above the desired threshold. Then use this same value to determine if automatic lights should come on by using it as a condition in the automation that turns the lights on.

If all of your lights would use the same lux value to turn on/off, I suggest creating template binary sensor and use that as the trigger/condition in your automations. Then if you want to fine tune the trigger value or add other parameters (eg is someone home) you only have to do it in one place.

  - platform: template
        value_template: "{{ states('sensor.outdoor_illuminance')|int < 50 }}"

Here’s an example automation from my config. This will turn the lights on anytime the “auto-light” sensor turns on or whenever the occupancy mode changes to Home, Guest or Night, but only if the auto-light sensor is on .

- id: light_front_porch_light_auto_on
  alias: "[Light] Front Porch Light Auto On"
    - platform: state
      entity_id: binary_sensor.auto_light_on
      to: 'on'

    - platform: state
      entity_id: input_select.occupancy_mode
        - Home
        - Guest
        - Night

    - condition: state
      entity_id: binary_sensor.auto_light_on
      state: 'on'

    - service: light.turn_on
      entity_id: light.front_porch_light

- id: light_front_porch_light_auto_off
  alias: "[Light] Front Porch Light Auto Off"
    - platform: state
      entity_id: binary_sensor.auto_light_on
      to: 'off'

    - service: light.turn_off
      entity_id: light.front_porch_light

Okay. I’ve set up a motion sensor which included a luminance sensor which ought to handle the lights only coming on when it’s sufficiently dark.

I’m wondering if I should use the Outdoor illuminance template sensor to control my blinds, i.e. only close them when it’s sunny and it’s a workday. Now I need to figure out how I install that sensor…

If that’s the Xiaomi one, be aware that it only reports light level when there’s motion.

1 Like