Condition with selector boolean in blueprint

Hello,

I want to create a blueprint with a condition based on a selector boolean. Something like:

blueprint:
  name: Control
  description:
  domain: automation
  input:
    boolean_estimation:
      selector:
        boolean:
trigger:
  - platform: time_pattern
    minutes: "0"
    id: update_buffer
condition: []
action:
  - choose:
      - conditions:
          - condition: trigger
            id: update_buffer
          - condition: state
            entity_id: !input boolean_estimacion
            state: "on"
        sequence:
          - ...

This doesn’t work.

What is the correct syntax to use boolean selectors in conditions? Maybe I have to create a variable and use it within a template or there’s another way?

Thank you!

I answer my own question. This works:

action:
  - choose:
      - conditions:
          - condition: trigger
            id: update_buffer
          - condition: template
            value_template: !input boolean_estimacion
        sequence:
          - ...
1 Like

The Template Condition’s value_template expects a template.

The example you posted is supplying value_template with an entity_id (of an input_boolean).

The solution is to assign boolean_estimacion to a script variable and then reference the script variable in a Template Condition that checks if its value is on.

action:
  - variables:
      estimacion: !input boolean_estimacion
  - choose:
      - conditions:
          - condition: trigger
            id: update_buffer
          - condition: template
            value_template: "{{ is_state(estimacion, 'on') }}"
        sequence:
          - ...

Thank you!

1 Like