Autmation help for Lights

Hey there. I’m looking to see if it’s possible or get some help on the following. I’d like to set up 2 automations on some strips of LED lights I have set up on a smart plug. they currently light up the basement stairs. What I’d like is to

  1. Set the lights to turn on autmatically at 5pm and shut off at 2am. (basic time schedule)
  2. Have that smartplug shut off the LED lights IF the basement light is turned on. The basement light is a leviton smart switch already configured in HASSIO. ( is this possible? )

I’m new to autmations and trigger and any help with the coding would be great. Thank you in advance.

-  alias: 'Turn the lights on at 5pm'
  trigger:
    platform: time
    at: '17:00:00'
  condition: []
  action:
  - service: light.turn_on
      entity_id: light.yourlightentity
-  alias: 'Turn the lights off at 2am'
  trigger:
    platform: time
    at: '02:00:00'
  condition: []
  action:
  - service: light.turn_off
      entity_id: light.yourlightentity
-  alias: 'Turn the LED lights off when basement light on'
  trigger:
    platform: state
    entity_id: light.basementlightentity
    from: 'off'
    to: 'on'
  condition: []
  action:
  - service: light.turn_off
      entity_id: light.yourLEDlightentity

I also suggest reading this to understand everything about automations

thank you so much for the quick reply =) I’ve got the toggle working as expected, I’ll try the time condition later this afternoon. I really appreciate the assistance.

You are welcome. One note here: I must have done something wrong with the formatting of the automation and the indentation is off. Dont copy my automations, write them from the beggining. If you have problems, reply and I will rewrite the automations correctly.

No I’m golden, I was able to do what i needed with your help. =) thanks so much. Yaml below.

  • alias: ‘Turn Stairs off when Basement Light on’
    trigger:
    platform: state
    entity_id: light.basement
    from: ‘off’
    to: ‘on’
    condition: []
    action:

    • service: switch.turn_off
      entity_id: switch.02200216ecfabc87ea94
  • alias: ‘Turn Stairs On when Basement Light Off’
    trigger:
    platform: state
    entity_id: light.basement
    from: ‘on’
    to: ‘off’
    condition:

    • condition: time
      after: ‘17:00:00’
      action:
    • service: switch.turn_on
      entity_id: switch.02200216ecfabc87ea94
  • alias: ‘Turn the Stairs on at 5pm’
    trigger:
    platform: time
    at: ‘17:00:00’
    condition: []
    action:

    • service: switch.turn_on
      entity_id: switch.02200216ecfabc87ea94
  • alias: ‘Turn the Stairs off at 3am’
    trigger:
    platform: time
    at: ‘03:00:00’
    condition: []
    action:

    • service: switch.turn_off
      entity_id: switch.02200216ecfabc87ea94
  • alias: ‘Turn on Decorations at 4pm’
    trigger:
    platform: time
    at: ‘16:00:00’
    condition: []
    action:

    • service: switch.turn_on
      entity_id: switch.02200216ecfabc882d49
    • service: switch.turn_on
      entity_id: switch.fireplace_switch
    • service: switch.turn_on
      entity_id: switch.02200216ecfabc87ec41Preformatted text
2 Likes

You need to get in the habit of posting your code properly formatted by using the instructions in the blue box at the top of the page.