Automation trigger, trigger at specific time

Hello,

i have a automation that uses the state of a sensor that switches from False to True.
This switch happens approximately at midnight.

My question is, how can i trigger the action at a specific time instead?

There’s a section here on time based triggers

If it is the sensor that switches at midnight, what sensor is it ?

its a integration for garbage collection (it adds sensors), it checks a website for the information.
the sensor itself is the following:

year_month_day_date: 2021-04-07
last_update: 06-04-2021 16:26
hidden: false
days_until_collection_date: 1
is_collection_date_today: false
friendly_name: Afvalinfo GFT
icon: mdi:recycle

yes, but i need the trigger to check first if the state of the sensor is true or false. I cant find out how to do that part.

Yeah, did you say that?
Sorry.
You would make that check part of the condition.

1 Like

Sorry for the misunderstanding,

would it be 2 seperate conditions then? one checking the state for true and another for the time?

The time would be the trigger and the sensor the condition.
So it would work like this:
Trigger at midnight:
Is the sensor on?
If yes, carry out action
If not, do nothing, trigger again tomorrow.

1 Like

ah so its the exact opposite.

i now made the automation as following

  • trigger at 08:00:00
  • condition state of entity: true
  • action turn on light

so in this order it should fire off tomorrow at 8 if im correct?

There are two possible ways for this:

  1. Set a fixed time to check the state of the sensor.
  2. Work with a time pattern, where every X minutes a check for the state is performed.

First would be, if you need the automation to fire before a time you specified. Eg. you don’t get up before 07:30, and therefor don’t need your automation to run before that time.

The second one fits, if you need the automation to run at latest X minutes after the state changed. That would be, no matter when the trigger comes, you want to be noticed. Eg. if you know, you have to be at work at 08:00, but you want the automation to trigger as soon as it starts to snow, so you could get on the road early.

EDIT: forgot the third method, let it trigger on state change of the sensor. :slight_smile:

1 Like

great examples! thank you.

Let me sketch the situation.

The sensor that i use checks a website to see if its garbage collection day or not. If it is, the sensor switches from false to true. This happens when the day changes aka midnight.

Now i want it to notify me in the morning as i do not want to be woken up from a light or sound when im sleeping at night.

Hence thats why i now made a trigger that goes of at 08:00 with a condition checking if the sensor is true or false.

That being said, i dont know if it works yet. I will have to see it tomorrow morning :stuck_out_tongue:

To make the confusion complete, integrate that in your “wake up mode”.

I set my alarm clock on my phone, that triggers an input_datetime in HA (“alarm_clock_me”) to set that time. One hour before my alarm_clock rings, I’ll start my wake_up_mode (starting the espresso machine, pull up the blinds, start the light circle and so on). That would be the perfect time, to run your automation and check the state of the sensor. :smiley:

You would always be notified just after waking up. :smiley:

that sounds really convenient, but probably also above my curent knowledge :smile:

Don’t worry, it will grow on you! :smiley: :smiley: :smiley:

You’ll see tomorrow morning, after it notifies you the first time. That’s when you get addicted, there is no way out! :rofl:

1 Like