Blueprint requires device entity although meant optional

Hey everyone,
I do have an understanding issue and how to debug this.

I can save a new automation based on my blueprint only if I add an optional meant device entity (presence_sensor). Otherwise I get the following error when trying to safe the new automation:

Message malformed: Entity [] is neither a valid entity ID nor a valid UUID for dictionary value @ data['entity_id']

The optional input for the presence sensor:

    presence_sensor:
      name: 🛌 Select presence (binary) sensor
      description: |-
        Enables the automation to open the cover in the morning after the last one has left the room. Helpful on bedrooms, especially at weekend.


        Require _Enable presence detection_ option. Optional.
      default: []
      selector:
        entity:
          filter:
            - domain: binary_sensor
              device_class: presence

I don’t understand where the error message comes from and where to search. The complete blueprint can be found here.

Sorry for not providing more code snippets, as I don’t know which parts to show… :confused:

Any hint appreciated :slight_smile:

Carsten

Your blueprint actually needs to supply a default. default is not sent to the blueprint’s !include value when you don’t supply it.

Post the full blueprint please.

I’ve linked my blueprint already, or shall I post a >400 lines blueprint to the forum?

sorry, missed that

I believe the issue is coming from your condition. Change that condition from:

                  - "{{ trigger.id == 't_terminate_privacy_protection_with_presence' }}"
                  - condition: state
                    entity_id: !input presence_sensor
                    state: "on"

to

                  - "{{ trigger.id == 't_terminate_privacy_protection_with_presence' and is_state(tv_presence_sensor, 'on') }}"

Hm, the error stays the same.

when you reply, please reply to me not the thread. Otherwise I do not see the response.

Can you please post the full error in your text logs? It will point me to the real place it’s erroring.

Hm, can’t find any correlating entries in Settings → System → Logs → Home Assistant Core. Or am I looking into the wrong log?

Then where are you seeing this error?

In the webUI when saving the automation this “popup” with the error message is shown:

Afterwards on top of the webUI the error is also displayed:

You have that as required all over that BP. You have to have a valid entity in there.
No, it can’t be a default unless the default is a valid entity.

I don’t get it. I’ve created a test BP with an input defining an empty default, which behaves like I expect it (I can leave window empty then the cover is controlled via time):

blueprint:
  name: Test with empty default
  author: https://github.com/carslen
  description: "Just for testing empty defaults"
  domain: automation
  input:
    cover:
      name: Select your Cover
      selector:
        entity:
          filter:
            - domain: cover
    window:
      name: select your window contact if available
      description: This input has an empty default
      default: []
      selector:
        entity:
          filter:
            - domain: binary_sensor
              device_class: [window, door]
    cover_close:
      name: Time to close cover
      default: "18:00:00"
      selector:
        time:
    cover_open:
      name: Time to open cover
      default: "08:00:00"
      selector:
        time:

trigger_variables:
  cover: !input cover
  window: !input window
  cover_close: !input cover_close
  cover_open: !input cover_open

trigger:
  - platform: template
    alias: Contact open
    value_template: "{{ window != [] and is_state(window, ['true', 'on']) }}"
    id: open_contact

  - platform: template
    alias: contact close
    value_template: "{{ window != [] and is_state(window, ['false','off']) }}"
    id: close_contact

  - platform: time
    alias: open cover
    at: !input cover_open
    id: open

  - platform: time
    alias: close cover
    at: !input cover_close
    id: close

condition: []

action:
  - choose:
      - alias: Cover Open
        conditions:
          - condition: trigger
            id:
              - open
              - open_contact
        sequence:
          - service: cover.open_cover
            metadata: {}
            data: {}
            target:
              entity_id: !input cover
      - alias: Cover close
        conditions:
          - condition: trigger
            id:
              - close
              - close_contact
        sequence:
          - service: cover.close_cover
            metadata: {}
            data: {}
            target:
              entity_id: !input cover

Where is the difference?!

it’s your wait for trigger, you’ll need to turn it into a template.

FYI, your logs would have had an error. I’m not sure why you aren’t able to find it. Anyways, change

                  - wait_for_trigger:
                    - platform: state
                      entity_id:
                        - !input presence_sensor
                      from: "on"
                      to: "off"
                      for:
                        minutes: !input time_precense_absence_duration

to

                  - wait_for_trigger:
                    - platform: template
                      value_template: >
                        {{ is_state(tv_presence_sensor, 'off') }}
                      for:
                        minutes: !input time_precense_absence_duration

That solved the issue. Thank you!

Don’t know why I didn’t identified that as the problem, sometimes you need a push from outside :slight_smile: