#Question about sunset automation with manual overrideHi everyone! I'm trying to

1 messages · Page 1 of 1 (latest)

whole adder
#

Hi everyone! I'm trying to set up an automation for my lights with the following behavior:
What I want:
Lights turn ON at sunset (but not later than 9 PM)
Lights turn OFF at 9 PM automatically
If I manually turn OFF the lights before 9 PM (e.g., at 8 PM), they should stay OFF
BUT the next day, the automation should work normally again (lights turn ON at sunset)
My concern:
If I manually turn off the lights in the evening, I don't want them turning back ON the same night, but they should still turn ON the next evening at sunset.
What I've tried:
I'm considering using a condition to check if it's before 9 PM and if the light is already OFF, but I'm not sure if this prevents the lights from turning ON the next day.
Should I use an input_boolean to track whether the automation should run, or is there a simpler solution?
Any help would be appreciated! Thanks

west apex
#

I think if you set up the checks in this order, it should work fine.

#

When: "Sun sets"
And if: "[your light] is off"
Then do: "Light turn on"

Then second automation:
When: "Time is 2100 everyday" (there's a time trigger you can set, and it has options for each day)
And if: "[your light] is on"
Then do: "Light turn off"

#

the sunset trigger should reset each day, and you can also set it to check at specific times at specific days (e.g. every day)

whole adder
#

Like this?

whole adder
autumn drum
#

To recap your wish, you want to turn on the lights on the sunset, but only if sunset is before 9PM and no matter what, you want them to turn off at 9PM. You can do this with a single automation having 2 triggers, or 2 automations.

But then you have said that if you manually turn the lights off before 9PM, they should stay off. That means if you manually turn lights off before the sunset (which is before 9PM) the sunset event should not turn them on?

This part is slightly confusing, but you can add a helper (input_boolean) that acts as a variable and you can set this helper to "manually set to off" and then you check the state in your automation to turn them on (sunset event). And another automation let's say at midnight, that will reset the helper for the next day activity.

#

Search for "motion enabled lights with manual override" type of automations

whole adder
#

Thank you for your reply.
My main issue is the following:
If I go to sleep around 9:30 PM and the lights are still on, I usually turn them off manually using the wall light switch. The problem is that once I do that, the lights cannot be turned on again via Home Assistant, because they are completely without power.
What I’m looking for is a smarter solution, for example:
An automation that detects when I go to sleep and turns the lights off beforehand, or
An automation that turns the lights off at a fixed time (e.g. 9:00 PM), but
If I’m still awake and turn the lights on manually, Home Assistant should turn them off again automatically after a certain time.
I hope this explains my situation clearly. Any suggestions or best practices would be appreciated

autumn drum
#

Or don't physically turn them off and add smart switch instead?

whole adder
#

Which smart switch would you recommend? In the evening i usually won't use my phone in case i need to turn off the lights tough that is why i was used to turn them off physically

opaque sparrow
#

Shelly is not bad. But if you use more Wifi iot stuff, be prepared to also spend money on a good wifi network. So you could go for a Zigbee Shelly.

If you have a neutral wire at the switch or you can place it near the light you can pick any Shelly, including an i4. If you don't have a neutral wire and can run one, you need a 1L or 2L.

whole adder
#

I think the 1gen4 hat also zigbee

#

am i right?

opaque sparrow
#

Correct! Do you already have a Zigbee network?

whole adder
#

Yes i do have one. But i am not 100% sure if i have a neutral wire or not

#

I live in germany

#

and these?

autumn drum
#

Sonoff ZBMINIL2 is likely for you, you don't need neutral and it is zigbee.

#

you plug it in the seris to your light and have 2 inputs for your switch on the wall. so you can control it remotely and manually

opaque sparrow
#

But you have smart bulb, don't you? Then a ZBminiL2 isn't usable/desirable as it will still kill the power to the smart bulbs. You need a module with detached mode. The Shelly has that.

whole adder
#

What does this detached mode do?

#

And I have smart bulbs but I would replace them maybe

autumn drum
#

detached mode only sends notification to home assistant about "someone pressed physical switch" but does nothing to the light. Then HA does the rest.

autumn drum
opaque sparrow
opaque sparrow
whole adder
#

I have one from silvercrest

#

Works over tuya

opaque sparrow
#

Tuya Wifi (and thus the Tuya integation) or Zigbee?

whole adder
#

ZigBee but over the tuya Integration

#

Somehow it is shown in home assistant but I can not configure it to control any of the lights

#

Fernbedienung 2 it is called the remote

opaque sparrow
#

So you have a Tuya gateway?

Do you also have a Zigbee stick (USB / Ethernet)?

whole adder
#

No I only have the tuya/silvercrest Gateway

opaque sparrow
#

Then I would definitely switch 😄

whole adder
#

And which zigbee adapter?

thorn coral
#

already answered that one.

whole adder
#

alias: New automation
description: ""
triggers:

  • trigger: sun
    event: sunset
    offset: 0
    conditions:
  • condition: time
    before: "21:00:00"
    actions:
  • action: light.turn_on
    metadata: {}
    target:
    entity_id:
    - light.rgbic_strip_lights
    - light.gu_10_weiss
    - light.gu_10_farbig
    - light.gu_10_weiss_3
    - light.gu_10_weiss_4
    - light.gu_10_weiss_6
    device_id:
    - ca787edba2218136ccaeb603f589f92f
    - 2ca2b3c52d6294909927efba6dbeef3e
    - 7edc257335b2386ff6b70eb2e7eb7649
    - 685142b8fd880fce5e382ac15682500e
    - 68dea247b22068d74da05f21df2e5bca
    - 9f191852108b45faa844bc1ff331acbf
    data:
    color_temp_kelvin: 2000
    mode: single
#

Why does this only work for 2 devices from the list?

autumn drum
#

Use the triple ` to format the code.

#

don't use device_id, use the entity_id only.

whole adder
#

that was the one that home assist used

#

alias: New automation
description: ""
triggers:

  • trigger: sun
    event: sunset
    offset: 0
    conditions:
  • condition: time
    before: "21:00:00"
    actions:
  • action: light.turn_on
    metadata: {}
    target:
    entity_id:
    - light.rgbic_strip_lights
    - light.gu_10_weiss
    - light.gu_10_farbig
    - light.gu_10_weiss_3
    - light.gu_10_weiss_4
    - light.gu_10_weiss_6
    - light.gu_10_farbig_2
    - light.govee_light_2
    - light.govee_light_3
    data:
    color_temp_kelvin: 2000
    mode: single
#

that is better?

#

alias: Dreame Saugen
description: ""
triggers:

  • trigger: time
    at: "10:00:00"
    weekday:
    • mon
    • tue
    • wed
    • thu
    • fri
      conditions:
  • condition: device
    device_id: 5c63ab01b3b45ccab486cfbbd53a00df
    domain: device_tracker
    entity_id: 875a0cbbaf466ff73dbb2d95152e79bc
    type: is_not_home
  • condition: device
    device_id: 1e933ba6235e2635714d569a15129476
    domain: device_tracker
    entity_id: 904c0112b77bfaa486954ed4ca9abb99
    type: is_not_home
    actions:
  • device_id: 703bb6c301f47d888ba3f5c1404ec3d3
    domain: vacuum
    entity_id: b15cb5b6e403603c6c1067a73149b7bc
    type: clean
    mode: single
tacit gobletBOT
#

To format your text as code, enter three backticks on the first line, press Enter for a new line, paste your code, press Enter again for another new line, and lastly three more backticks.
```yaml
example: here
```
Don't forget you can edit your post rather than repeatedly posting the same thing.

glad walrus
#

Maybe I do not understand the real problem but if you use a boolean helper for manual switch this will bypass your automation. And in your automation you add the trigger sunrise. when sunrise you put your helper to false this way it will reset automatically every day.

whole adder
#

One light does not turn on on its own