Test for 3rd Sunday and certain time of day

In an automation, how best would one test for 6:45pm on the third Sunday of the week? I thought of the following:

  1. day of week = Sunday; and
  2. time of day = 6:45pm; and
  3. day of month = between 15 and 21

Thanks,
Rich

In this post you can find some ideas
How to show date of last Wednesday of the month? - Configuration - Home Assistant Community (home-assistant.io)

Thanks vingerha

Just getting back to this now …

I changed my requirements in determining if it is the 1st Sunday of the month and tested this code piece under Developer Tools in the “Templates” area

{{ (now().weekday()) == 6 and (now().day) <= 7 }}

My issue now is how would I write this into an Automation? I think I would use a CONDITION. My TRIGGER is going to be a time of the day.

I would appreciate any help in how to accomplish that.

Seems my binary_sensor definition is not being recognized in Automation Visual Editor. Here are relative parts

Here is binary_sensor definition

TEST_TIME not available in automation editor so apparently HA does not recognize what I have done. Here is YAML for automation. I manuall added the CONDITION.

image

Can anyone tell me why HA does not see the binary_sensor?

No entry appears in LOGBOOK saying it fired.

LOG error is as follows

Thanks for looking

Any reason you’re making a template sensor just for this automation? I think a template condition within the automation would make a lot more sense, unless you plan to use the result somewhere else too.

No reason. I am open to any standard means to make it work. I just don’t know how to accomplish what you are saying. Can you provide code for Condition?

Thanks for replying.

You binary sensor is poorly indented/formatted, hence, do read the documentation and look at examples
But as @brooksben11 already wrote no need for a bs
You can use a condition to the automation of type ‘template’ and paste your template into that

I did as you suggested by adding a Template Condition with the code and it worked.

I did not see anything wrong with the format of binary sensor though.

the - name starts on 1st column, should be indented, again, check the docs
image