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

Just to be sure… we are discussing this option. Agree?

With that by-pass if the state is ON it will disable the automation. If the state is OFF it will enable the automation. Just tested it again and it is working.

Blacky :smiley:

Still not sure if I understand you.

I want have have a manual (physical) switch that will turn off the lights when I go to bed. Is this by-pass the correct setting for that?

@beurdy

No, you would use the “Use The Entity State Option (Optional)”

Blacky :smiley:

It looks like ON and OFF can only ever be used together.
But if you just want to turn off and not turn on, you can’t use the time feature, right?

I currently use automation in which I switch a light on and off based on brightness. But always switch it off at a certain fixed time.

@Herr.Vorragend

This blueprint just turns things ON and OFF. You can add any condition you like and is why I put it there. So you could add a condition that state must be ON then it will only turn OFF.

To do this, add condition, click state, select your entity, select ON.

Blacky :smiley:

Thanks for the blueprint. A suggestion, maybe move the time setting to the top, instead of the end. For me I need to make semi frequent changes to the time and I would think that this would be the most used section anyway.

Thanks…Steely

Thanks for your suggestion, I will add it to the list and keep it in mind.

Blacky :smiley:

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