Invalid entity id for dictionary in a Blueprint with a motion sensor

Hi

I am trying to make a blueprint with a fairly simple functionality but I am having a problem that I do not know how to correct.

The goal is to control the light in an area with a motion sensor and a door sensor. For example the entrance to a house in which is the front door and then the distributor with no door. If the door is open the light is on, independent of the motion sensor. If the door is close then the light is on or off depending of the motion sensor.

The code is this:

blueprint:
  name: Motion and Door Lights in an area with multiples entrances 
  description: Turn light on based on detected motion and one door sensor with multiples entrances
  domain: automation
  input:
    motion_sensor:
      name: Motion Sensor
      description: This sensor will be synchronized with the light.
      selector:
        device:
          integration: zha
          manufacturer: Philips
          model: SML001
          entity:
            domain: binary_sensor
            device_class: occupancy
    door_sensor:
      name: Door Sensor
      description: This sensor will be synchronized with the light.
      selector:
        entity:
          domain: binary_sensor
          device_class: opening
    target_light:
      name: Lights
      description: The lights to keep in sync.
      selector:
        target:
          entity:
            domain: light
trigger:
  - type: state
    platform: device
    entity_id: !input motion_sensor
    domain: binary_sensor
  - type: state
    platform: device
    entity_id: !input door_sensor
    domain: binary_sensor
condition: []
action:
  - choose:
      - conditions:
          - condition: state
            entity_id: !input door_sensor
            state: 'on'
        sequence:
          - service: light.turn_on
            target: !input target_light
      - conditions:
          - condition: state
            entity_id: !input door_sensor
            state: 'off'
          - type: occupied
            condition: device
            device_id: !input motion_sensor
            domain: binary_sensor
        sequence:
          - service: light.turn_on
            target: !input target_light
      - conditions:
          - condition: state
            entity_id: !input door_sensor
            state: 'off'
          - type: not_occupied
            condition: device
            device_id: !input motion_sensor
            domain: binary_sensor
        sequence:
          - service: light.turn_off
            target: !input target_light
mode: single

And the error is this.

Logger: homeassistant.components.automation
Source: components/automation/init.py:517
Integration: Automatización (documentation, issues)
First occurred: 13:27:56 (1 occurrences)
Last logged: 13:27:56

Blueprint Motion and Door Lights in an area with multiples entrances generated invalid automation with inputs OrderedDict([(‘motion_sensor’, ‘2edf7229d3cfacba059d2d728bcee0d3’), (‘door_sensor’, ‘binary_sensor.lumi_lumi_sensor_magnet_aq2_9cb7ce03_on_off’), (‘target_light’, OrderedDict([(‘device_id’, [‘042ed6380bdbf9b6af1af78f4d066d2c’])]))]): Entity ID 2edf7229d3cfacba059d2d728bcee0d3 is an invalid entity id for dictionary value @ data[‘entity_id’]. Got None required key not provided @ data[‘device_id’]. Got None value must be one of [‘bat_low’, ‘cold’, ‘connected’, ‘gas’, ‘hot’, ‘light’, ‘locked’, ‘moist’, ‘motion’, ‘moving’, ‘no_gas’, ‘no_light’, ‘no_motion’, ‘no_problem’, ‘no_smoke’, ‘no_sound’, ‘no_vibration’, ‘not_bat_low’, ‘not_cold’, ‘not_connected’, ‘not_hot’, ‘not_locked’, ‘not_moist’, ‘not_moving’, ‘not_occupied’, ‘not_opened’, ‘not_plugged_in’, ‘not_powered’, ‘not_present’, ‘not_unsafe’, ‘occupied’, ‘opened’, ‘plugged_in’, ‘powered’, ‘present’, ‘problem’, ‘smoke’, ‘sound’, ‘turned_off’, ‘turned_on’, ‘unsafe’, ‘vibration’] for dictionary value @ data[‘type’]. Got None

What is the problem?. I’ve tried every combination I can think of, but obviously not the right one.

Thanks in advance.

Your blueprint uses a Device Selector for motion_sensor but assigns the value to an entity_id. The error message is reporting you can’t assign 2edf7229d3cfacba059d2d728bcee0d3 (which is a device_id) to an entity_id.

Given it’s a blueprint, you don’t need to be so specific with the selector (no comment on whether the syntax is broadly correct). Try the following and if it doesn’t work tinker with the domain or device class. Suggest change device class to motion in the first instance if this doen’t work.

I’m not sure the trigger will work. My trigger for motion is at the bottom, same concept for the door.

  input:
    motion_sensor:
      name: Motion Sensor
      description: This sensor will be synchronized with the light.
      selector:
        entity:
          domain: binary_sensor
          device_class: occupancy
trigger:
  - platform: state
    entity_id: !input 'trigger_entity_1'
    to: 'on'