Using action inputs in automations

I am feeling a bit dumb: I am trying to create an automation blueprint which has an action input and this input should be run later.

However it fails with: Message malformed: Unable to determine action @ data['action'][0]

What is the problem? Any help is kindly appreciated.

I have created following demo script which triggers this issue:

blueprint:                                                                                                                                          
  name: POC Blueprint                                                                                                                               
  description: Automation blue print to test things                                                                                                 
  domain: automation                                                                                                                                
  input:                                                                                                                                            
    triggered_action:                                                                                                                               
      name: Triggered actions                                                                                                                       
      description: Actions that should be executed at sunrise                                                                                       
      selector:                                                                                                                                     
        action:                                                                                                                                     
                                                                                                                                                    
trigger:                                                                                                                                            
  - platform: sun                                                                                                                                   
    event: sunrise                                                                                                                                  
                                                                                                                                                    
action:                                                                                                                                             
  -sequence: !input triggered_action 

space after the - in -sequence?

Unfortunately not. also with - sequence: !input triggered_action it does not work.

sequence prob isn’t the right thing anyways. in a normal construct, you wouldn’t do
- sequence: action

i presume you’re trying to let the user choose an action and invoke it.

look at this:

If the input will be providing all of the actions, you can use:

action: !input triggered_action 

Otherwise, you need to use one of the methods described in the link in @armedad’s post above.

Thanks @Didgeridrew for your answer. It works! Thanks @armedad for your further tips!

Also there was no default in the input meaning if you don’t put a valid action in there, it might error like that.

1 Like

Thanks @Sir_Goodenough for this helpful aspect.

1 Like