Automated Conditional Input Boolean?

I´m trying out using Helpers for the first time so i might be way off on my solution here but basically i want to run a Automation each night to set a Input boolean that i can then use in other automations.

Idea is to set a bool if its Garbage day, the trigger is set for 01:00 every night, and depending on the weekday and week number it should set the bool to true/false.


platform: time
at: '01:00:00'


condition: and
  - condition: template
    value_template: '{{(as_timestamp(now())|timestamp_custom (''%U'') | int % 2) == 1 }}'
  - condition: time
      - tue

Now, this is where i´m a bit lost, how do i set the bool value depnding on the condition, i need a if else action in some way, otherwise the bool will only be set once and never reset.

service: input_boolean.turn_on
  entity_id: input_boolean.isgarbageday

Any tips are welcome

You can use a choose in the action of the automation with your conditions there:

  - choose:
      - conditions:
          - "{{(as_timestamp(now())|timestamp_custom ('%U') | int % 2) == 1 }}"
          - condition: time
              - tue                
          - service: input_boolean.turn_on
            entity_id: input_boolean.isgarbageday
      - service: input_boolean.turn_off
        entity_id: input_boolean.isgarbageday
1 Like

That is perfect, just what i was looking for. Really appreciate that Dennis, saved me a lot of headache.