Blueprint is getting Imported but Automation is not running

Hi,

I am facing problem when I try to build an automation using the Blueprint(Attached) I have created.
I can see following error in HA log section.

When I prepare the automation using blank GUI mechanism, my concept works fine

blueprint:
  name: Electricity Saver for Rooms having No Natural Light
  description: This blueprint will automate closed areas where there is no natural light throghout the day(Wash Rooms, Under Ground Rooms etc)
    Turn on respective lights when area is occupied(motion detected) and will turn off the lights when area is unoccupied(No Motion Detected).
    Also, one an control the lights using switches and light operation(specially) using switches has also been taken cared

  domain: automation
  source_url: 
  input:
    motion_entity:
      name: Motion Sensor
      selector:
        entity:
          domain: binary_sensor
          device_class: motion
    light_target:
      name: Light
      selector:
        target:
          entity:
            domain: light
            
mode: restart
max_exceeded: silent  

trigger:
  platform: state
  entity_id:  !input  motion_entity
  from: 'on'
  to: 'off'
  platform: state
  entity_id:  !input  light_target
  from: 'off'
  to: 'on'
  platform: time_pattern
  seconds: '1'

action:
  - choose:
      - conditions:
          - condition: state
            entity_id: motion_entity
            state: 'on'
        sequence:
          - service: light.turn_on
            target:
              entity_id: light_target
      - conditions:
          - condition: state
            entity_id: motion_entity
            state: 'off'
        sequence:
          - service: light.turn_off
            target:
              entity_id: light_target
mode: restart
max_exceeded: silent  

trigger:
  platform: state
  entity_id:  !input  motion_entity
  from: 'on'
  to: 'off'
  platform: state
  entity_id:  !input  light_target
  from: 'off'
  to: 'on'
  platform: time_pattern
  seconds: '1'

action:
  - service: light.turn_on
    target:
      entity_id: !input light_target

The Automation Generated using UI is as follows:

id: '1656002721329'
alias: EnergySave
description: ''
trigger:
  - platform: state
    entity_id: binary_sensor.ewelink_ms01_29c00825_ias_zone
    from: 'on'
    to: 'off'
  - platform: state
    entity_id: binary_sensor.ewelink_ms01_29c00825_ias_zone
    from: 'off'
    to: 'on'
  - platform: time_pattern
    seconds: '1'
condition: []
action:
  - choose:
      - conditions:
          - condition: state
            entity_id: binary_sensor.ewelink_ms01_29c00825_ias_zone
            state: 'on'
        sequence:
          - service: light.turn_on
            target:
              device_id: 5b588b838ae416795f967d7be7dca0a2
              entity_id: light.veea_light_inc_light_001_ddfbe2fe_level_on_off
      - conditions:
          - condition: state
            entity_id: binary_sensor.ewelink_ms01_29c00825_ias_zone
            state: 'off'
        sequence:
          - service: light.turn_off
            target:
              device_id: 5b588b838ae416795f967d7be7dca0a2
              entity_id: light.veea_light_inc_light_001_ddfbe2fe_level_on_off
    default: []
mode: restart'

The Error Generated in logs are as follows:

Logger: homeassistant.components.automation
Source: components/automation/__init__.py:628
Integration: Automation ([documentation](https://www.home-assistant.io/integrations/automation), [issues](https://github.com/home-assistant/home-assistant/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+automation%22))
First occurred: June 23, 2022 at 7:35:39 PM (136 occurrences)
Last logged: 9:44:24 AM

* Blueprint Electricity Saver for Rooms having No Natural Light generated invalid automation with inputs OrderedDict([('motion_entity', OrderedDict([('device_id', '3f411e986a1b662ddbdbef5263f69a61'), ('entity_id', 'binary_sensor.ewelink_ms01_29c00825_ias_zone')])), ('light_target', OrderedDict([('device_id', '5b588b838ae416795f967d7be7dca0a2'), ('entity_id', 'light.veea_light_inc_light_001_ddfbe2fe_level_on_off')]))]): Entity ID device_id is an invalid entity ID for dictionary value @ data['action'][0]['choose'][0]['conditions'][0]['entity_id']. Got None not a valid value for dictionary value @ data['action'][0]['choose'][0]['sequence'][0]['target']['entity_id']. Got None
* Blueprint Electricity Saver for Rooms having No Natural Light generated invalid automation with inputs OrderedDict([('motion_entity', 'binary_sensor.ewelink_ms01_29c00825_ias_zone'), ('light_target', OrderedDict([('device_id', '5b588b838ae416795f967d7be7dca0a2'), ('entity_id', 'light.veea_light_inc_light_001_ddfbe2fe_level_on_off')]))]): extra keys not allowed @ data['action'][0]['conditions']. Got None extra keys not allowed @ data['action'][0]['sequence']. Got None
* Blueprint Electricity Saver for Rooms having No Natural Light generated invalid automation with inputs OrderedDict([('motion_entity', OrderedDict([('device_id', '3f411e986a1b662ddbdbef5263f69a61'), ('entity_id', 'binary_sensor.ewelink_ms01_29c00825_ias_zone')])), ('light_target', OrderedDict([('device_id', '5b588b838ae416795f967d7be7dca0a2'), ('entity_id', 'light.veea_light_inc_light_001_ddfbe2fe_level_on_off')]))]): extra keys not allowed @ data['action'][0]['conditions']. Got None extra keys not allowed @ data['action'][0]['sequence']. Got None
* Blueprint Electricity Saver for Rooms having No Natural Light generated invalid automation with inputs OrderedDict([('motion_entity', 'binary_sensor.ewelink_ms01_29c00825_ias_zone'), ('light_target', OrderedDict([('device_id', '5b588b838ae416795f967d7be7dca0a2'), ('entity_id', 'light.veea_light_inc_light_001_ddfbe2fe_level_on_off')]))]): not a valid value for dictionary value @ data['action'][0]['target']['entity_id']. Got None
* Blueprint Electricity Saver for Rooms having No Natural Light generated invalid automation with inputs OrderedDict([('motion_entity', OrderedDict([('device_id', '3f411e986a1b662ddbdbef5263f69a61'), ('entity_id', 'binary_sensor.ewelink_ms01_29c00825_ias_zone')])), ('light_target', OrderedDict([('device_id', '5b588b838ae416795f967d7be7dca0a2'), ('entity_id', 'light.veea_light_inc_light_001_ddfbe2fe_level_on_off')]))]): not a valid value for dictionary value @ data['action'][0]['target']['entity_id']. Got None

It will be great if someone can direct me to exact root cause.

Thanks in advance !!!

You need to format your post correctly for people to read it first.

As I am new to this, I am learning, Is the formatting acceptable ?

I think you need to add "!input " to the actions not just the triggers.

Hi,

I have now changed it as below:

blueprint:
  name: Electricity Saver for Rooms having No Natural Light
  description: This blueprint will automate closed areas where there is no natural light throghout the day(Wash Rooms, Under Ground Rooms etc)
    Turn on respective lights when area is occupied(motion detected) and will turn off the lights when area is unoccupied(No Motion Detected).
    Also, one an control the lights using switches and light operation(specially) using switches has also been taken cared

  domain: automation
  source_url: https://gist.github.com/deepaksoniVeea/bac2040e4635d4a391812109d237bbce
  input:
    motion_entity:
      name: Motion Sensor
      selector:
        entity:
          domain: binary_sensor
          device_class: motion
    light_target:
      name: Light
      selector:
        target:
          entity:
            domain: light
            
mode: restart
max_exceeded: silent  

trigger:
  - platform: state
    entity_id: motion_entity
    from: 'on'
    to: 'off'
  - platform: state
    entity_id: motion_entity
    from: 'off'
    to: 'on'
  - platform: time_pattern
    seconds: '1'

action:
  choose:
    - conditions:
        condition: state
        entity_id: !input motion_entity
        state: 'on'
      sequence:
        service: light.turn_on
        target:
          entity_id: !input light_target
    - conditions:
        condition: state
        entity_id: !input motion_entity
        state: 'off'
      sequence: 
        service: light.turn_off
        target:
          entity_id: !input light_target

I am still getting the Error in the logs as:

2022-06-27 09:24:42 ERROR (MainThread) [homeassistant.components.automation] Blueprint Electricity Saver for Rooms having No Natural Light generated invalid automation with inputs OrderedDict([('motion_entity', 'binary_sensor.ewelink_ms01_29c00825_ias_zone'), ('light_target', OrderedDict([('device_id', 'e3c98a576bd58283b3d1ec9fc55f8808'), ('entity_id', 'light.veea_light_inc_light_001_ddfbe2fe_level_on_off')]))]): not a valid value for dictionary value @ data['action'][0]['choose'][0]['sequence'][0]['target']['entity_id']. Got None
2022-06-27 09:24:42 ERROR (MainThread) [homeassistant.components.automation] Blueprint Electricity Saver for Rooms having No Natural Light generated invalid automation with inputs OrderedDict([('motion_entity', 'binary_sensor.ewelink_ms01_29c00825_ias_zone'), ('light_target', OrderedDict([('device_id', 'e3c98a576bd58283b3d1ec9fc55f8808'), ('entity_id', 'light.veea_light_inc_light_001_ddfbe2fe_level_on_off')]))]): not a valid value for dictionary value @ data['action'][0]['choose'][0]['sequence'][0]['target']['entity_id']. Got None
2022-06-27 09:24:42 ERROR (MainThread) [homeassistant.components.automation] Blueprint Electricity Saver for Rooms having No Natural Light generated invalid automation with inputs OrderedDict([('motion_entity', 'binary_sensor.ewelink_ms01_29c00825_ias_zone'), ('light_target', OrderedDict([('device_id', 'e3c98a576bd58283b3d1ec9fc55f8808'), ('entity_id', 'light.veea_light_inc_light_001_ddfbe2fe_level_on_off')]))]): not a valid value for dictionary value @ data['action'][0]['choose'][0]['sequence'][0]['target']['entity_id']. Got None
2022-06-27 09:24:42 ERROR (MainThread) [homeassistant.components.automation] Blueprint Electricity Saver for Rooms having No Natural Light generated invalid automation with inputs OrderedDict([('motion_entity', 'binary_sensor.ewelink_ms01_29c00825_ias_zone'), ('light_target', OrderedDict([('device_id', 'e3c98a576bd58283b3d1ec9fc55f8808'), ('entity_id', 'light.veea_light_inc_light_001_ddfbe2fe_level_on_off')]))]): not a valid value for dictionary value @ data['action'][0]['choose'][0]['sequence'][0]['target']['entity_id']. Got None
2022-06-27 09:24:42 ERROR (MainThread) [homeassistant.components.automation] Blueprint Electricity Saver for Rooms having No Natural Light generated invalid automation with inputs OrderedDict([('motion_entity', 'binary_sensor.ewelink_ms01_29c00825_ias_zone'), ('light_target', OrderedDict([('device_id', 'e3c98a576bd58283b3d1ec9fc55f8808'), ('entity_id', 'light.veea_light_inc_light_001_ddfbe2fe_level_on_off')]))]): not a valid value for dictionary value @ data['action'][0]['choose'][0]['sequence'][0]['target']['entity_id']. Got None
2022-06-27 09:24:42 ERROR (MainThread) [homeassistant.components.automation] Blueprint Electricity Saver for Rooms having No Natural Light generated invalid automation with inputs OrderedDict([('motion_entity', 'binary_sensor.ewelink_ms01_29c00825_ias_zone'), ('light_target', OrderedDict([('device_id', 'e3c98a576bd58283b3d1ec9fc55f8808'), ('entity_id', 'light.veea_light_inc_light_001_ddfbe2fe_level_on_off')]))]): not a valid value for dictionary value @ data['action'][0]['choose'][0]['sequence'][0]['target']['entity_id']. Got None

Thanks in advance !!!

Hi,

I have expected community to help me, but any ow I managed to make it run. As per community rule, herr is the solution:

blueprint:
  name: Electricity Saver for Rooms having No Natural Light
  description: This blueprint will automate closed areas where there is no natural light throghout the day(Wash Rooms, Under Ground Rooms etc)
    Turn on respective lights when area is occupied(motion detected) and will turn off the lights when area is unoccupied(No Motion Detected).
    Also, one an control the lights using switches and light operation(specially) using switches has also been taken cared

  domain: automation
  source_url: https://gist.github.com/deepaksoniVeea/bac2040e4635d4a391812109d237bbce
  input:
    motion_entity:
      name: Motion Sensor
      selector:
        entity:
          domain: binary_sensor
          device_class: motion
    light_entity:
      name: Light
      selector:
        target:
          entity:
            domain: light

mode: restart
max_exceeded: silent

trigger:
  - platform: state
    entity_id: !input motion_entity
    from: 'on'
    to: 'off'
  - platform: state
    entity_id: !input motion_entity
    from: 'off'
    to: 'on'
  - platform: time_pattern
    seconds: '1'

action:
  - choose:
      - conditions:
          - condition: state
            entity_id: !input motion_entity
            state: 'on'
        sequence:
          - service: light.turn_on
            target: !input light_entity
      - conditions:
          - condition: state
            entity_id: !input motion_entity
            state: 'off'
        sequence:
          - service: light.turn_off
            target: !input light_entity

Thanks for your support !!!