⚙ Turn Light, Switch, Entity or Scene On & Off with Trigger Conditions

Hi Blacky,

I’m just feeling very stupid, I can’t seem to get the automation to work. I have a hue light and it looks like the only requirement is the first field which is specified with the entity of the hue, which can toggle using the entities page.

what am i missing, i’m so desperate to use some of your great additions.

dumfounded dan

@greenembrace

This blueprint can turn ON and OFF your light. You get to choose what you would like out of the 4 options. You can choose more than one option.

  1. Use The Entity State Option (Optional)
  2. Use The Sun Option (Optional)
  3. Use The Ambient Option (Optional)
  4. Use The Time Options (Optional)

If you are more after a sensor light that works from a PIR type of sensor then look at my sensor light blueprint.

Blacky :smiley:

Hi

@Blacky

in part i have discovered part of my problem :slight_smile:
I’m using momentary buttons for my switches, and as such the light comes ON with press and then OFF with release.

There may be some workaround but is it possible to add an on transition of state. When you create a standard automation using state as trigger you have the option of selecting a from/to state or both, but for a momentary button only one is required.

I will be interested in you thoughts on this.

looking up daniel

@greenembrace

Hi Daniel,

I have 2 blueprints for this that you can check out;

Probably it would be best if you explain what you are trying to do, then I will be able to help and not give you a bum steer.

Blacky :smiley:

This is my first message on this board so i hope i do i right.

First, thanks for this amazing blueprint but i have a question and can’t find the answer yet.
I’m not sure how the ON/OFF features relates to each other (AND/OR?)

This my use-case:
If it is a weekday AND after 16:00 AND LUX became below 300 (somewhere after 16:00), then turn on lights untill 22:00, After 22:00 do nothing.

This is what i have now:

alias: "- Woonkamerverlichting blueprint voor licht"
description: ""
use_blueprint:
  path: Blackshome/entities-on-off-trigger-conditions.yaml
  input:
    entity_switch:
      entity_id:
        - light.ecodim_bv_ecodim_zigbee_3_0_level_on_off
        - switch.servieskast_on_off
        - light.televisie_rechts_level_light_color_on_off
        - light.tz3000_49qchf10_ts0502a_24741efe_level_light_color_on_off
        - light.zitbank_links_level_light_color_on_off
        - light.zitbank_rechts_level_light_color_on_off
    include_light_control: use_brightness
    include_entity_input: entity_disabled
    include_ambient: ambient_enabled
    ambient_light_sensor: sensor.xiaomi_lumi_sen_ill_mgl01_illuminance
    ambient_light_value: 300
    ambient_light_value_off: 800
    after_time: "16:00:00"
    before_time: "22:00:00"
    include_weekdays: weekday_enabled
    weekday_options:
      - mon
      - tue
      - wed
      - thu
      - fri
    light_brightness: 50

Is this possible?

@fvdijke

Firstly welcome to the community :smiley:

Your welcome and thanks for your kind words.

Nice you put in a use case as this realy helps me answer your question.

Try this I have the same thing you are trying to do;

  1. Import my :bulb: Sensor Light blueprint.
  2. Create a schedule helper and set up your time from 16:00 to 22:00. Go to settings/devices & services/ helper tab at the top/ create helper button down the bottom / select schedule then enter in a name and just select the time you would like for each day and click create.
  3. In the “Sensor Light” blueprint this schedule will be your trigger. Enter it in.
  4. Select the entities you would like to turn ON and OFF in “Lights - Switches - Scenes”.
  5. Now for your “LUX became below 300 (somewhere after 16:00)”. You can “Use The Ambient Options” but because you have said “somewhere after 16:00” looks like you may like to use “The Sun Option”. I use sun but totally up to you, so choose what you would like. If you use sun then just the “Sun Elevation Falling” is the one you will need to adjust because you going to turn it OFF at 22:00 well before the sun rises. Tip: if you use “Sun Elevation Falling” then your starting time can be well before the sun sets like you have with 16:00. Either way if you set the time early your sun or LUX values will be the trigger to turn ON your entity and then it will turn OFF at 22:00.

Hope this helps you and let us know how you go.

Blacky :smiley:

1 Like

Thanks Blacky for this great response.
I think i’ve set it al up but have one more question (for now :wink: ).
I’m not sure what to do with the Sun Elevation because i want it to depend on the weather conditions. IF it is a rainy day, lights go on after 16:00. But when it’s sunny, lights stay off till LUX drops below ambient threshold (between 16:00 and 22:00).

alias: "-LICHT: Woonkamerverlichting"
description: >-
  Schakel woonkamerverlichting aan na 16:00 (werkdagen) en als LUX lager is dan
  300. Schakel licht uit als LUX hoger is dan 600. Na 22:00 niet meer doen.
use_blueprint:
  path: Blackshome/sensor-light.yaml
  input:
    motion_trigger:
      - schedule.ikbenthuis
    light_switch:
      entity_id:
        - light.tz3000_49qchf10_ts0502a_24741efe_level_light_color_on_off
        - light.televisie_rechts_level_light_color_on_off
        - light.zitbank_links_level_light_color_on_off
        - light.zitbank_rechts_level_light_color_on_off
        - light.ecodim_bv_ecodim_zigbee_3_0_level_on_off
        - switch.servieskast_on_off
    include_ambient: ambient_enabled
    ambient_light_sensor: sensor.xiaomi_lumi_sen_ill_mgl01_illuminance
    ambient_light_value: 300
    ambient_light_high_value: 600
    weekday_options:
      - mon
      - tue
      - wed
      - thu
      - fri


Time to test. See if i can generate some rainy clouds :slight_smile:

@fvdijke

All looks good. The days to run should be selected in your schedule but I can see that time is not enabled anyway so all should be good.

Yea then what you have selected “Ambient Options” will work for what you are trying to do. Perfect :wink:

Blacky :smiley:

It works and i’m very happy.
One little thing, not all entities go OFF when LUX is above high threshold.
Entity: light.ecodim_bv_ecodim_zigbee_3_0_level_on_off will stay on.

They should all go OFF. I would suspect a loss in communication or something on your end as we send the data to all.

It’s all working perfectly. Thanks for your help!

1 Like

@Blacky

Hi,

Sorry its taken time to get back to you. I have 7 RPi’s connected via the remote RPi integration which in turn support about 60 push buttons, they are mostly for Hue lights of different flavors, but some fans and a couple of heaters.

They are working via simple automations and basically just turn on/off.

I saw you great blueprint that could control a whole range of different functions.

I’m interested in turning some lights on/off at specific times and also some with reference to the sun.
Like: sunset + 1 hour → turn light on

Turn light on/off according to the current ambient light level (i have a number of hue motion sensors that also include ambient light sensors)

I would also in the future like to dim lights using the button (which i can do using the app)

this is why i was drawn to your blueprint

daniel

@greenembrace

If you would like this then you will need this blueprint :bulb: Sensor Light - Motion Sensor - Door Sensor - Sun Elevation - LUX Value - Scenes - Time

For this use a schedule in the linked blueprint above (Sensor Light)

We use sun elevation as HA recommend this. You can read up more on this in the FAQ of the sensor light blueprint.

No problem in the sensor light blueprint.

You can do this i the sensor light blueprint and the light will stay that way until it is turn OFF then it will rest back to your settings in the blueprint next time it is turned ON.

Hope this helps you.

Blacky :smiley:

@Blacky
thanks Blacky for your considered response, I shall work my way through it

kind regards.

I’m loving the versatility of this blueprint! I’m using it to control the lighting in my reptile room, with a motion sensor. However, I want the lights to COME ON during the day, based on sun elevation, to provide a more natural seasonal cycle. As near as I can tell, this will only turn the lights on when the sun is moving high → low. Is there a way to invert the sun logic?

If you are using a motion sensor then you should check out my :bulb: Sensor Light Blueprint.

Blacky :smiley:

Of course I posted in the wrong thread :slight_smile: I am using the Sensor Light blueprint, I’ll move the discussion there

1 Like

Hi Blacky, and Happy New Year.

I’m trying to figure out if this is the right Blueprint for what I’m trying to do. I have a bathroom with two separate light circuits. One is dim and soft that turns on and off with Sensor Light whenever motion is triggered. The second one, bright for shaving primarily, I turn on manually at the light switch box.

I’d like to have a situation where the bright manual-on light turns off concurrent with the Sensor Light timing out of the main soft light.

Basically I don’t want to have to remember to turn the bright shaving off manually at the wall switch. Is this the correct blueprint? Or perhaps it is the Trigger Run-On Timer?

Thank you

Probably the easiest way to do this it trough a custom automation.

I will PM you the how to so you can ask questions if needed.

Blacky :smiley:

Where in this blueprint can I define that my motion sensor triggers the light to be switch on? Am I overlooking something?