Struggling with blueprint syntax/debug

Hello,

is there any complete documentation somewhere to understand the syntax properly?
I made an automation which works but when I try to convert it into blueprint, it always fails and difficult to say why:

blueprint:
  name: Light from Motion with retries
  description: Turn a light on based on detected motion with retries
  domain: automation
  input:
    motion_sensor:
      name: Motion Sensor
      description: PIR sensor that will be trigger the light.
      selector:
        entity:
    target_light:
      name: Lights
      description: The lights to trigger.
      selector:
        entity:
    by_motion:
      name: by motion
      description: input_boolean to tell that the light has been switched on by a motion sensor.
      selector:
        entity:

alias: Light from Motion
description: ""
triggers:
  - type: occupied
    entity_id: !input motion_sensor
    domain: binary_sensor
    trigger: entity
  - type: not_occupied
    entity_id: !input motion_sensor
    domain: binary_sensor
    trigger: entity
conditions: []
actions:
  - choose:
      - conditions:
          - condition: and
            conditions:
              - condition: state
                entity_id: input_boolean.motion_detection
                state: "on"
              - type: is_occupied
                condition: entity
                #device_id: !input motion_sensor
                entity_id: !input motion_sensor
                domain: binary_sensor
              - condition: state
                entity_id: switch.inter_storeroom
                state: "off"
        sequence:
          - action: retry.actions
            metadata: {}
            data:
              sequence:
                - type: turn_on
                  #device_id: !input target_light
                  entity_id: !input target_light
                  domain: switch
                  enabled: false
              retries: 15
              expected_state:
                - "on"
          - action: input_boolean.turn_on
            metadata: {}
            data: {}
            target:
              entity_id: !input by_motion
        alias: Motion detection allowed, detection detected and light is off
      - conditions:
          - condition: and
            conditions:
              - type: is_not_occupied
                condition: entity
                entity_id: !input motion_sensor
                domain: binary_sensor
              - condition: state
                entity_id: !input by_motion
                state: "on"
                enabled: true
        sequence:
          - action: retry.actions
            metadata: {}
            data:
              sequence:
                - type: turn_off
                  entity_id: !input target_light
                  domain: switch
                  enabled: false
              retries: 20
              expected_state:
                - "off"
          - action: input_boolean.turn_off
            metadata: {}
            data: {}
            target:
              entity_id: !input by_motion
        alias: "Option2: Light trigger by motion and motion disappeared"
mode: single

I looked at [‘actions’][0], then [‘choose’][0], then [‘conditions’][0] & [‘conditions’][1] but it is still too difficult for me to figure out what is wrong :frowning:
Thanks in advance for any support.

Hello wanico,

This is

There is no condition of the type ‘entity’
Conditions - Home Assistant.

2 Likes

To add to SG’s comment…

First, while Device components are often described as “easy” or “good for beginners”, blueprinting using them can be significantly more difficult because you are now responsible for properly handling all the weird and extraneous data they contain.

Second, there are no triggers like those used in your example… trigger: entity is not a valid option.

If you rebuild your original automation using State triggers and conditions you will find it much easier to convert to a blueprint.

Community Cookbook: Why and How to avoid device IDs…

Overview: https://www.home-assistant.io/docs/blueprint/
Configuration Schema: https://www.home-assistant.io/docs/blueprint/schema/

Lastly, do your future self a favor and add filters to the input selectors so you can only pick the desired type of entity i.e. light or input_boolean… there’s no reason to force future You to scroll through all those names or accidentally choose the wrong thing which will just lead to more error messages.

2 Likes

What does that “retry.actions” mean?
Something custom?

1 Like

I would guess an LLM hallucinated this

Thank you. I will look at this this evening.

Thank you for the support. Replacing the “Devices” by “Entities” in the original Automation made so simple to create the Blueprint !

1 Like