Turn on switch on every 4th sunday at 7:30am

This template will return true on the 4th sunday of every month:

{{(now().strftime("%d")|int>=22) and (now().strftime("%d")|int <=28) and (now().strftime("%w")|int==0)}}

And here it is in a sample automation that turns a switch on at sunrise the 4th Sunday of every month.

- alias: 4thSundaySwitch
  trigger:
    - platform: sun
      event: sunrise
  condition:
    condition: template
    value_template : '{{(now().strftime("%d")|int>=22) and (now().strftime("%d")|int <=28) and (now().strftime("%w")|int==0)}}'
  action: 
    - service: switch.turn_on
      entity_id : switch.sundayswitch
7 Likes