I’m currently using a condition in an automation to only run the automation on Mon, Wed, and Fri.
condition:
- condition: time
before: '23:59:59'
weekday:
- mon
- wed
- fri
after: 00:00:00
I’d prefer an option to pick the days of the week the automation runs that isn’t hard coded. Is there a way to add a day of the week picker on the dashboard that I can use as a condition in an automation?
tom_l
June 21, 2022, 4:47am
2
Input booleans and the custom button card:
Thanks!
I’m having trouble figuring out how you are using the input booleans. Presumably, those day of the week buttons on the bottom turn on/off the boolean, correct? If so, how are those used in the automation? Do you have an automation for each day of the week and those day buttons are turning on/off the automations?
tom_l
June 22, 2022, 2:51am
4
My input booleans are named like this:
input_boolean.zone_1_mon
input_boolean.zone_1_tue
input_boolean.zone_1_wed
input_boolean.zone_1_thu
input_boolean.zone_1_fri
input_boolean.zone_1_sat
input_boolean.zone_1_sun
For use with a template condition like this:
condition: template
value_template: >
{% set day = strptime(states('sensor.date'), '%Y-%m-%d').strftime('%a')|lower %}
{{ is_state('input_boolean.zone_1_' ~ day, 'on') }}
If you are going to be using this in lots of places it makes sense to create a day sensor (and tomorrow sensor if you wish) sensor:
template:
- sensor:
- name: "Day Today"
state: "{{ strptime(states('sensor.date'), '%Y-%m-%d').strftime('%a')|lower }}"
- name: "Day Tomorrow"
state: "{{ (strptime(states('sensor.date'), '%Y-%m-%d') + timedelta(days=1)).strftime('%a')|lower }}"
So you can simplify the condition template to:
condition: template
value_template: >
{% set day = states('sensor.day_today') %}
{{ is_state('input_boolean.zone_1_' ~ day, 'on') }}
Elreinodemu
(Andres Duffill)
October 16, 2022, 7:01pm
5
For some reason I cant get it working. Anyone can help ,me?
``
Elreinodemu
(Andres Duffill)
October 26, 2022, 11:25am
6
Can you explain me how to introduce this correctly in the yalm?
My input booleans:
input_boolean.zone_remanso_day