šŸ”† Smart Light - Entity - Sun Elevation - Ambient & Time Triggers

@knotfinleyHA

Welcome to the community.

Thanks for providing your YAML.

Everything looks good and I have tested this and it is working. I used version 1.8 but it should work on version 1.7. Note your ā€˜TP-Link P135 wall plugā€™ is a switch so the light control will not work on a switch. Maybe this is done internally within the ā€˜TP-Link P135 wall plugā€™.

Not sure if you have updated to the new version 1.8 or not but if you have then you can clean up some YAML by removing the code below.

    include_light_control:
      - dont_use_brightness

Here is your full YAML with the code cleaned up for you.

alias: Office Light On & Off
description: Scheduled light on and off for workdays
use_blueprint:
  path: Blackshome/entities-on-off-trigger-conditions.yaml
  input:
    light_colour_temperature: 2700
    entity_switch:
      entity_id: switch.office_light
    light_transition_off: 15
    light_transition_on: 0
    after_time: "10:30:00"
    before_time: "10:35:00"
    weekday_options:
      - mon
      - tue
      - wed
      - thu
      - fri
    include_time: time_enabled
    include_weekdays: weekday_enabled

Blacky :smiley:

Hello Blacky,

I think I found the issue. Using Edge I created Home Assistant webpage as an app so I could pin it to my taskbar and it opens like an app. I have noticed that when updating some items it doesnā€™t work in app mode. So I opened the HA webpage through the browser and did the update there and it worked. I also copied your version of yaml but donā€™t think that was the problem.

Thanks for your help and the blueprint.
Thanks for the help.

@knotfinleyHA

Nice one and thanks for letting the community know and for getting back to me :+1:

Your welcome

Enjoy

Blacky :smiley:

Thanks for the blueprint. Iā€™m relatively new to HA and this my first automation with HA. The following:

alias: Office Lights On
description: Turn Office Light ON at sunset and OFF at sunrise
use_blueprint:
  path: Blackshome/entities-on-off-trigger-conditions.yaml
  input:
    entity_switch:
      entity_id:
        - light.office_light
        - light.office_light_2
    include_sun: sun_enabled
    include_light_control:
      - use_brightness
    light_brightness: 50
    include_entity_input: entity_disabled
    light_transition_on: 5
    light_transition_off: 5
    sun_elevation_rising: -4
    sun_elevation: 5

Turns the lights on appropriately before sunset but doesnā€™t turn them off at sunrise. I added the line ā€œsun_elevation_risingā€ since the normal edit only created one line (sun_elevation) in the YAML.

These are Feit smart light bulbs connected via the Tuya integration.

Thanks for your guidance.

@k5madsen

Hi Kent and welcome to the community.

Thanks for reaching out and giving me the heads up. There was a bug and it has now been resolved. Please update the blueprint. It will not change your automatons when you update. You can do this by just clicking on the ā€œImport Blueprintā€ blue button again at the top.

If you donā€™t see it in your YAML it just means that you are using the default value and havenā€™t selected anything yet so that is okay.

Again thanks for letting us know.

Blacky :smiley:

New update 1.9

Bugs Fixed :bug:

  • Fixed a bug in sun options. Sun Elevation Rising would not turn entities OFF.

If you like this blueprint? Consider hitting the :heart: button in the top post :+1:

If you like my blueprints, and would like to show your support or just say thank you? Click Here :smiling_face_with_three_hearts:

Enjoy

Blacky :grinning:

New update 2.0

Trigger-Ready Control - Customize On & Off for Light, Switch, Scene, or Any Entity :vertical_traffic_light:

Maintenance :toolbox:

  • Update the description in ā€œLights - Switches - Entities - Scenesā€ to include the new option to select ā€œlabelsā€. The updated description should read:

    NOTE: Only entities can be used. Areas, devices, and labels are not supported.

If you like this blueprint? Consider hitting the :heart: button in the top post :+1:

If you like my blueprints, and would like to show your support or just say thank you? Click Here :smiling_face_with_three_hearts:

Enjoy

Blacky :grinning:

Thanks for the quick and effective fix. I deployed the update yesterday afternoon and the lights turned off this morning as desired.

1 Like

Excellent! Question, any chance to add weather to this? What I mean is, Iā€™d like to use Sun elevation along with weather so if itā€™s cloudy/raining I can change the elevation value to a different value compared to sunny/partly cloudy, etc.

Not really sure what you are trying to do. If you can give me some more detail (use case) for me to better understand.

Blacky :smiley:

Apologies, I should have provided more detail. Hereā€™s an example for turning lights on and off at sunrise/sunset:

Letā€™s say for example itā€™s cloudy or raining, set the sunā€™s elevation higher before turning lights on/off and if itā€™s clear or partly cloudy, set the suns elevation lower.

@BobMac57

It looks like your doing this based on the ambient light. You are best to use an ambient light sensor (LUX sensor).

Blacky :smiley:

Thx for the quick response. I am using that config in one area of the house and not wanting this everywhere due to not wanting to spend money on additional sensors since the ambient light would differ extensively. There is a blueprint for ā€˜Close/open curtain (cover, blinds) based on sun and weatherā€™ that I can adaptā€¦ would be nice though to have the optionā€¦ thanks for your hard work!

1 Like

not sure this is possible - trying to use Sun elevation to trigger the lights on, but want to use time (midnight) to turn them off?

@Kfuhr

Welcome to the community.

Yes you can do this.

Enable the sun and you ā€˜Sun Elevation Fallingā€™ settings to your liking. Just leave the ā€˜Sun Elevation Risingā€™ set to -4. Then enable time. Set your ā€˜On Timeā€™ to 11:59pm and your ā€˜Off Timeā€™ to 12am. Happy days.

Enjoy

Blacky :smiley:

awesome - thank you!!!

@Blacky - that worked perfectly!

@Kfuhr

Hi Ken, nice one thanks for letting us know.

Blacky :smiley:

Hi Blacky! Once again - thank you for all your work on the blueprints. As you can tell Iā€™m working my way through all of them and replacing my multiple convoluted automations with your simple and structured blueprints :sweat_smile:

Iā€™m considering replacing my 3 automations with what I think can be done with this single blueprint, which does the following:

  1. At sunset, turn ON 4-specific lights, if there is anyone at home
  2. At sunset, if no one is at home, turn ON only 2-specific lights (for the dogs :slight_smile:)
  3. If we leave the house after sunset, turn OFF all lights leaving just 2-specific lights ON
  4. When returning home after sunset, turn ON 4-specific lights (similar to case 1)

Scenarios 1 & 2 seem like they can be done fairly straightforward through the sun elevation trigger and appropriate global condition of zone.home.
Scenarios 3 & 4 - am I right in assuming I have to use the entity state option (I have a ā€œpersonsAtHomeā€ group which reports ā€œhomeā€ and ā€œnot_homeā€ I can tie to a ON/OFF toggle helper) to trigger these? Am I on the right track here? Hopefully this isnā€™t too confusing!

@Nuwanda

Best to use the sensor light blueprint with probably a schedule for the trigger and sun condition and device tracker. The 2 lights to leave ON without device tracker.

TIP If you use a schedule helper then you can set the time before sunset and OFF later in the night or after sunrise. Then when you select the sun condition it will trigger the light ON / OFF if someone is home. Device tracker will turn the lights ON / OFF when you arrive or leave home if the trigger is ON and it meets your sun condition.

Blacky :smiley: