Target Selector & Entity Selector Errors

Message malformed: Entity entity_id is neither a valid entity ID nor a valid UUID for dictionary value @ data[‘action’][2][‘if’][0][‘entity_id’]
Message malformed: expected a dictionary for dictionary value @ data['action'][0]['target']

Errors similar to these generally happen when you try to put a ‘target’ item into a place that is looking for an ‘entity’, or you are trying to put an ‘entity’ into a place asking for a ‘target’. I know that targets can have ‘entities’, but it is not the same format of ‘entity’. See the Explanation Samples below.

Just be careful especially when using selectors that if you have a ‘target’ selector, you need to send that to a service looking for a ‘target’ and you cannot directly use that ‘target’ item in a template that is expecting an ‘entity’. Also always use ‘entity’ selectors with ‘entity’ scoped code in the rest of the automation/blueprint.

Explanation Samples:

A target selector returns a dictionary containing entity_id key with a list of entities. e.g.

{'entity_id': [ ., ., . ] }

Or the yaml variation

entity_id:
- .
- .
- .

So, when you use entity_id: !input <some_target_selector> and you select entities… you end up feeding this to the yaml:

entity_id:
  entity_id:
  - .
  - .

Instead of the desired

entity_id:
- .
- .

That’s why you can’t use target selector
Entity selector always returns a list of entities, which is just [ ., ., . ] or the yaml equivalent:

- .
- .
- .

Explanation samples original from HA Discord[#blueprints] courtesy:
petro

The Home Assistant Cookbook - Index.