Hi folks,
I want to create an automation that only works from october to january.
How can I do this?
The datetime-helper only gives me the opportunity for one year.
thanks for help
Bernd
Hi folks,
I want to create an automation that only works from october to january.
How can I do this?
The datetime-helper only gives me the opportunity for one year.
thanks for help
Bernd
make a template condition checking the month. Or make a template sensor that checks the month and only turns on during those months.
{{ now().month in [10, 11, 12, 1] }}
this seems to be exacly what I’m looking for.
…but I’m a bloody noob and don’t have any idea how to work with templates.
you have the template… you just now have to use it. The rest is yaml.
All you need is to combine the template condition with the template you were given.
Here’s the one from the docs:
condition:
alias: "Iphone battery above 50%"
condition: template
value_template: "{{ (state_attr('device_tracker.iphone', 'battery_level')|int) > 50 }}"
Replace the template on the last line with the one petro gave you (and change the alias). Don’t forget to keep the outer quotes:
condition:
- alias: "October to January"
condition: template
value_template: "YOUR_TEMPLATE_GOES_HERE"
(I added a -
so that if you add other conditions you don’t have issues)