✈ Holiday & Away Lighting

@muppet

Yes it will.

Blacky :grinning_face:

1 Like

hello @Blacky, and thank you for your great module!
I could try it and perhaps you can help me.
I chosed this setup

  • trigger : sun elevation
  • shuffled lights on
  • light duration between 5 and 10 minutes
  • light off shuffle between 22 and 23h00

The current situation is

  • the lights switch on randomly after sunset : OK
  • they all stay ON until 22h00 : not OK
  • and then switch off randomly until 23h00 : OK

Is it possible, that they switch off randomly after 5-10 minutes and re-switch on randomly until 22h00? They could then switch definitively on between 22 and 23h.

I am sure I did not parameter it correctly; do you see a solution for that?

Thank you in advance for your help and have a great evening.

@1Cedric1

Welcome to the community.

Could you please provide us your YAML of the automation? This YAML code are the settings you have selected in the automation so I can help. To do this go into your automation, top right 3 dots, Edit in YAML, copy all the code, come back to the forum and in your reply at the top tool bar click on “</>” and paste code in there.

Blacky :smiley:

Thank you @Blacky. this is what I found:

id: '1782394727220'
alias: Holiday & Away Lighting
description: ''
use_blueprint:
  path: Blackshome/holiday-away-lighting.yaml
  input:
    automation_control: disable_automation_control
    trigger_selection: sun_elevation
    entity_order_on: entities_on_shuffled
    time_off_selection: earliest_latest_time_range
    entity_order_off: entities_off_shuffled
    entity_1: light.ampelmann
    entity_2: light.parents_lampe_1
    entity_3: light.samuel_lampe_4
    entity_4: light.couloir_lampe_3
    entity_5: light.evan_lampe_2
    on_time_delay: 0
    start_time_range: '22:00:00'
    sun_elevation: -0.5

@1Cedric1

So currently you have them turn ON at sunset and then turn OFF between 10 and 11.

You asked

You can use a Random Activity Window to achieve this. The only tricky part is handling the “turn ON at sunset” behavior as this changes throughout the year and not time fixed.

Instead of trying to solve everything in a single automation, it’s better to split it into a few simple ones. For Holiday/Away lighting, the goal isn’t complexity... it’s just creating the impression that someone is home.

A simple approach could look like this:

  • Automation 1: Turn lights ON at sunset and turn them OFF sometime between 10:00–11:00pm (or any time you prefer). Use a toggle helper (for reference we will call it HAL1) in a light input to track this state so we can trigger the next automation 2.
  • Automation 2: When HAL1 turns OFF we use it as the trigger to then turn lights back ON again or another set of lights.
  • From there, use the Random Activity Window option to randomly turn lights ON/OFF.

This approach helps create more natural movement through the house without over complicating a single automation.

The key idea is to think in multiple small automations rather than one large one, each handling a specific time window or behavior change. Toggle helpers become useful as simple links between automations but you can also use a light, just remember if you do use a light to link to the next automation then that light only turns ON and OFF once otherwise you be in a automation loop.

Hopefully this will give you some ideas and get you thinking on how and what your after.

Blacky :grinning_face:

1 Like

great, thank you cery much, I'll try!

1 Like

I have a question about your Blueprints. If I import one into my HA, does it come in as YAML, or is it more intuitive, like I set up my simple automations? I have not mastered YAML. Is there somewhere I could read about Blueprints? Thanks.

There's no yaml really. Import the blueprint, then make an automation based on the blueprint, it will ask for you to provide the info needed to run in your setup.
Test with the built-in/provided one to see how it works.

@MFB

Once you import a blueprint, you can use it to create as many automations as you like.

To create an automation from a blueprint, go to Settings > Automations & Scenes . Click Create Automation , then select the blueprint you want to use. Or you can, select the Blueprints tab at the top, choose the blueprint, complete the required settings, and save it with a name that suits your automation.

To edit the automation later, return to Settings > Automations & Scenes , in the Automations tab, find the automation you created, and click on it. This will open the automation that was created from the blueprint, where you can review or modify its settings.

Blacky :smiley:

Hello again - I have been using this and it’s working pretty great, but I’ve one issue I’d like to understand how to fix please :slight_smile:

I have my HA setup so that the automation I’ve created from the template is turned on when my house alarm is on, and turns off when my house alarm turns off. So basically if we’re away for the night, random lights will turn on and off which is perfect.

What I’ve noticed though is, even though the automation gets turned off when we arrive home, it seems that left over timer(s) can still fire? I know this because we have a bright light in our master bedroom that is only used for lighting when we’re away, and it popped on this morning at 1:34am heh. Wife wasn’t very happy!

So I’m just curious - when the automation is disabled are there residual timers that keep going? If so, what would be the proper way to stop them, short of restarting home assistant? Or is something else going on?
Here is an image where you can see the automation was disabled, but it still was the cause of the light trigger.

YAML of my automation:

alias: Holiday & Away Lighting
description: Random Lights on and off
use_blueprint:
  path: Blackshome/holiday-away-lighting.yaml
  input:
    trigger_selection: sun_elevation
    entity_state_on_time_delay: 23
    entity_order_on: entities_on_shuffled
    random_on_delay: 300
    time_off_selection: random_activity_window
    min_on_time:
      hours: 0
      minutes: 15
      seconds: 0
    max_on_time:
      hours: 3
      minutes: 0
      seconds: 0
    start_time_range: "21:30:00"
    activity_window_duration:
      hours: 10
      minutes: 0
      seconds: 0
    activity_cycle_count: 4
    activity_min_on_time:
      hours: 0
      minutes: 2
      seconds: 30
    activity_max_on_time:
      hours: 0
      minutes: 55
      seconds: 0
    activity_min_off_time:
      hours: 1
      minutes: 21
      seconds: 0
    entity_order_off: entities_off_shuffled
    entity_1: light.smart_led_strip_light
    entity_1_include_light_control:
      - use_brightness
    entity_1_include_light_colour_control: disable_colour_control
    entity_2: switch.lounge_plug
    entity_3: light.carport_led
    entity_3_include_light_control:
      - use_brightness
    entity_3_include_light_colour_control: use_colour_temperature
    entity_4: light.athom_rgbct_light_b49068_rgbcct_bulb
    entity_4_include_light_control:
      - use_brightness
    entity_4_include_light_colour_control: use_colour_temperature
    entity_5: switch.office_plug
    entity_6: switch.athom_bedroom_plug_switch
    entity_7: switch.athom_bedroom_plug_switch
    entity_8: switch.driveway_lights
    entity_9: light.backyard_light
    entity_10: switch.athom_smart_plug_v2_f24f9e_switch

Thanks again for this very useful blueprint!

Edit: I’m wondering if I sholud just leave the automation “on” all the time and have a global condition that checks if the house alarm is on or not, would that resolve the issue?

@muppet

Hi Tim, that is not good.

Thanks for providing all the info. What I can see is you don’t have anything stopping the automation. In Automation Control if you select Entity State and in the Entity State input is where you would select your template for when your house alarm is ON or OFF. Then when it is ON the automation will be active but when it is OFF the automation will be disabled.

BUT!

I have just tested it and can see that if it was started when you were out and then came home turning OFF your alarm it would still run until the end. This is a bug I will need to resolve… it will be fixed in the next release that will be out soon.

Blacky :smiley:

The way I do this is I have the following automation, which itself enables and disables the Holiday & Away Lighting Automation.

YAML:

alias: Sync MotionEye and Auto Lights to Alarm State
description: ""
triggers:
  - trigger: state
    entity_id:
      - alarm_control_panel.home
    to:
      - disarmed
      - armed_away
conditions: []
actions:
  - if:
      - condition: state
        entity_id: alarm_control_panel.home
        state: armed_away
    then:
      - action: homeassistant.enable_config_entry
        data:
          config_entry_id: 19c055be2b26e2dc23ad1ce4f0a10fec
      - action: automation.turn_on
        metadata: {}
        target:
          entity_id: automation.holiday_away_lighting
        data: {}
    else:
      - action: homeassistant.disable_config_entry
        data:
          config_entry_id: 19c055be2b26e2dc23ad1ce4f0a10fec
      - action: automation.turn_off
        metadata: {}
        target:
          entity_id: automation.holiday_away_lighting
        data:
          stop_actions: false.  <------- I think this should be true!
mode: single

I did it like this because I couldn’t see a way to use the state of armed_away of my alarm (which is a custom addon, alarmo) within the automation control → entity state and I didn’t want to create a boolean_value if I didn’t need to. Plus this automation already existed to turn the MotionEye addon on and off so dropping Holiday & Away Lighting Automation in seemed a natural fit.

What I have noticed though is that stop_actions: false which almost certainly I should have set to true. So it’s probably my fault for not setting that correctly - the automation was allowed to continue.

Anyway thank you very much for your prompt reply and I’m glad you’ve also found something to fix, so it’s win win all around.

Much Love,
Tim

@muppet

Your welcome. I will PM you on your automation so it keeps this thread on topic.

Blacky :smiley: