Blueprint with conditions errors when using as automation

Hi everyone,

I’m creating blueprints to remove some of my double code around my installation, especially around motion detection and light handling.

In this case I have created a blueprint for motion where I’m able to set different variables for configuration (activate automation, time interval is should be active etc.).

To code can be found here:

When I use the blueprint in an automation it gives me an error:

Blueprint Activate Light on Motion generated invalid automation with inputs
('motion_entity', 'binary_sensor.guestbathroom_presence'),
('light_target', OrderedDict([('entity_id', ['light.guestbathroom_ceiling', 'light.guestbathroom_under_sink'])])),
('timer_entity', OrderedDict([('entity_id', 'input_number.guestbathroom_presence_timer')])),
('active_entity', OrderedDict([('entity_id', 'input_boolean.guestbathroom_presence_active')])),
('active_after_entity', OrderedDict([('entity_id', 'input_datetime.guestbathroom_presence_active_after')])), 
('active_before_entity', OrderedDict([('entity_id', 'input_datetime.guestbathroom_presence_active_before')]))
Entity ID entity_id is an invalid entity id for dictionary value @ data['condition'][0]['conditions'][0]['entity_id']. Got None

Does anyone have a take on why this error is given? I have read a lot of documentation about blueprints, but can see to find the issue.

Thanks in advance.


Your input selector for the time is wrong, try something like this:

      name: Tid

My usecase is for the trigger, but condition should work in the same way

  platform: time
  at: !input turn_off_time

Actually, most of your selectors have an invalid prefix “input_” in the domain declartion, the domain is only number, time, boolean

Hi Per,

Happy new year!

I do not want to set these variables in the automation, which is what your solution would require.

I have created variables, that I can easily modify in lovelace. I want to use these variables in my automation. Therefore I set my inputs as entities.


God fortsättning! :tada:

Oh, then I missunderstood your intention.
From my meager understanding of troubleshooting the blueprints/automation combo, the error message your receive indicates that HA encounters an empty string/data missmatch.

My approach has been to scale down the failing trigger/condition/action to a bare minimum, and then reinstate argument for argument in order to isolate the failing one, which then can be addressed.
Sorry to not being of more direct help.

What does your automation in yaml looks like?

Go to an automation from this blueprint which isn´t working, click the three dots top right corner and choose yaml.

No worries, it could have been a valid issue you mentioned. Thank you for using your time.

I have tried removing each condition. First all conditions, and then the automation worked. Then added each of them alone. All three conditions failed.

There is valid data in each variabel when I check both my lovelace setup area, but also in the developer-area in Home Assistant.

Have a nice evening!


Thank you for using time on this issue.

Is it the automation yaml code in my github in “automations.yaml” that you are talking about?
The direct link to this file is:

Thanks in advance.

I copied your blueprint from the url at the top of the thread, but had no problem to create an automation from it, using stray Helpers I am using for my own automations, so from that perspective I would say that your blueprint works, at least with my config :slight_smile:

Not having the proper Time input_datetime the automation will never actually fire off, but that is beside the point in the case of testing the blueprint -> automation process.

I have tested with device id as well as entity id for the “Lys” input, and either seem to work as intended, if that is of any help in your troubleshooting.

Hi Per,

That also works fine for me. Actually the yaml code in automations.yaml on the GitHub is the auto-created. So creating through the automation-interface creates the code.

But the automation actually does not work. It gives me the supplied error message (from my origin post) when checking my config or doing a restart of Home Assistant.

The code that is genereated in my case is different from the one that you posted on github:

- id: '1609519114787'
  alias: aaab Activate Light on Motion
  description: ''
    path: villa_lundborg/aaaa.yaml
      motion_entity: binary_sensor.rorelse_ljus_trappa
        - light.matrum_vitrinskap
        - light.kok_matbord
      timer_entity: input_number.mv_mur_timme
      active_after_entity: input_datetime.annika_morgon
      active_before_entity: input_datetime.annika_morgon

You end up with an extra entry that is not generated in my case, and I’d say that it is additional “entity_id” statement that trips your automation

        entity_id: input_datetime.guestbathroom_presence_active_before

Test the code by manually editing the automation.yaml where you remove the newline and "entity_id: ".

Why the generated code differs is beyound me, as I merly copy-pasted your blueprint code.

Running a server config check gives no warnings, niether does a reload of the automations.

Wow, that solve it. If I create through the UI now it does not create the entity_id line, but looks just like yours.

I do not know why it did it in the first place.

But - you solved my problem!

Thank you for your time. Have a nice evening!

You are welcome :pray:

Happy to been able to help :slight_smile: