On my balcony I have a new LED string both for Christmas decoration and enough light on summer nights to find a wine glass. I have just stopped an automation runing since December. I’d like to keep it active with a condition only to run between St. Martin’s day and Candlemas.
I have activated sensor.date (in device “time & date”) but found no way to use it in automations. How do I say “after November 10th and before February 2nd” as a condition?
I have searched documentation and this forum but could not find anything about this.
Danke
Thank you for explaining the relevant month and day syntax, I wasn’t sure about that. So I don’t even need the device. I had expected that to make things easier, i.e. saving the need to learn that part of syntax.
I have simplified your code. Yours is shorter and more elegant, but mine easier to understand when coming back to it months later.
Also thank you to @Didgeridrew whom that solution stems from and who has generously helped me before.
alias: Balkongirlande an
description: ""
trigger:
- platform: sun
event: sunset
offset: "-00:18:00"
condition:
- condition: or
conditions:
- condition: template
value_template: "{{ (now().month, now().day) >= (11, 10) }}"
- condition: template
value_template: "{{ (now().month, now().day) <= (2,1) }}"
action:
- action: switch.turn_on
metadata: {}
data: {}
target:
entity_id: switch.tuya_rot
- action: automation.trigger
metadata: {}
data:
skip_condition: true
target:
entity_id: automation.licht_halb
mode: single