Blueprint Formatting with choose

I’m working on creating a blueprint to tell whether or not an entity (Switch or Light) was turned on/off by physical touch or HA. I know it works because I copied it directly from an automation that actively works. However, any attempt to save it to a file and import it into Home Assistant I get errors like these:

Invalid blueprint: extra keys not allowed @ data['blueprint']['action']. Got [{'choose': [{'conditions': [{'condition': 'template', 'value_template': '{{ trigger.to_state.context.id != none }}'}, {'condition': 'template', 'value_template': '{{ trigger.to_state.context.parent_id == none }}'}, {'condition': 'template', 'value_template': '{{ trigger.to_state.context.user_id == none }}'}], 'sequence': [{'service': 'input_boolean.turn_on', 'target': {'entity_id': Input(name='trigger_boolean')}}]}, {'conditions': [{'condition': 'template', 'value_template': '{{ trigger.to_s... extra keys not allowed @ data['blueprint']['condition']. Got [{'condition': 'template', 'value_template': "{% if states(trigger.entity_id) != 'unknown' and not is_state(trigger.entity_id, 'unavailable') -%}\n true\n{%- endif %} \n"}] extra keys not allowed @ data['blueprint']['trigger']. Got {'platform': 'state', 'entity_id': [Input(name='trigger_entity')]}

Any suggestions or experts to look at this and fix my typo or error somewhere?

blueprint:
  name: Monitor Entity State Changes
  description: Monitor state changes of multiple entities and determine the type of change.
  domain: automation
  input:
    trigger_entity:
      name: Entities to Monitor
      description: List of entity IDs to monitor state changes.
      selector:
        entity:
    trigger_boolean:
      name: Corresponding Input Booleans
      description: List of input_boolean entities to set based on state changes.
      selector:
        boolean:
  
  trigger:
    platform: state
    entity_id: 
      - !input trigger_entity

  condition:
    - condition: template
      value_template: >
        {% if states(trigger.entity_id) != 'unknown' and not
        is_state(trigger.entity_id, 'unavailable') -%}
          true
        {%- endif %}        

  action:
    - choose:
        - conditions:
            - condition: template
              value_template: "{{ trigger.to_state.context.id != none }}"
            - condition: template
              value_template: "{{ trigger.to_state.context.parent_id == none }}"
            - condition: template
              value_template: "{{ trigger.to_state.context.user_id == none }}"
          sequence:
            - service: input_boolean.turn_on
              target:
                entity_id: !input trigger_boolean
        - conditions:
            - condition: template
              value_template: "{{ trigger.to_state.context.id != none }}"
            - condition: template
              value_template: "{{ trigger.to_state.context.parent_id == none }}"
            - condition: template
              value_template: "{{ trigger.to_state.context.user_id != none }}"
          sequence:
            - service: input_boolean.turn_off
              target:
                entity_id: !input trigger_boolean
        - conditions:
            - condition: template
              value_template: "{{ trigger.to_state.context.id != none }}"
            - condition: template
              value_template: "{{ trigger.to_state.context.parent_id != none }}"
            - condition: template
              value_template: "{{ trigger.to_state.context.user_id == none }}"
          sequence:
            - service: input_boolean.turn_off
              target:
                entity_id: !input trigger_boolean

How to read Home Assistant Configuration Errors.

Now that said, you appear to have boolean and entity selectors for inputs, but you are putting those into target in the bottom.

Logic should dictate that if it worked as an automation, whatever you changed is the most likely where the problem lies,and all the !inputs are what you changed.

You need to have a target selector if you are going to put the value into a target. Otherwise you can leave the selectors as entities and change the action part to work with entities.

Please also follow that tutorial on reading and finding errors, it will be invaluable to know this in the future.

1 Like