Keep getting parsing errors on my blueprint: extra keys not allowed

This is the automation I want to convert to a blueprint (automating open window detection with Tado):

- id: 'xxxxx'
  alias: Chauffage aan als raam dicht is
  description: ''
  trigger:
  - platform: state
    entity_id: sensor.kamer_1_open_window
    from: 'True'
    to: 'False'
  condition: []
  action:
  - device_id: xxxxx
    domain: climate
    entity_id: climate.kamer_1
    type: set_hvac_mode
    hvac_mode: auto

The blueprint looks like this:

blueprint:
  name: Tado open window detection
  description: turns the Tado off when open window is detected
  domain: automation

  input:
    open_window_sensor:
      name: Open Window Sensor
      selector:
        entity:
          domain: sensor
    target_climate:
      name: Climate Device
      selector:
        entity:
          domain: climate

  trigger:
    platform: state
    entity_id: !input open_window_sensor
    from: 'True'
    to: 'False'

  action:
      entity_id: !input target_climate
      type: set_hvac_mode
      hvac_mode: auto

But when I load this in Home Assistant, I keep getting the following exceptions:

Invalid blueprint: extra keys not allowed @ data['blueprint']['action']. Got OrderedDict([('entity_id', 'target_climate'), ('type', 'set_hvac_mode'), ('hvac_mode', 'auto')])
extra keys not allowed @ data['blueprint']['trigger']. Got OrderedDict([('platform', 'state'), ('entity_id', 'open_window_sensor'), ('from', 'True'), ('to', 'False')])

The error appears as soon as I put something in the trigger of action sections. Can anyone help me with this? I already checked for wierd characters.

In your automation your action is hvac_mode: auto but in your blueprint you’ve made it hvac_mode: 'off' what happens if you make them the same?

That doesn’t change a thing. I’ve updated my samples to reflect this.

The action is invalid because it has no service call

  action:
      entity_id: !input target_climate
      type: set_hvac_mode
      hvac_mode: auto

It needs to call climate.set_hvac_mode.

  action:
  - service: climate.set_hvac_mode
    data:
      entity_id: !input target_climate
      hvac_mode: auto

The original automation used a Device-based action that employs a device_id. However, when converted to a blueprint, it’s simpler to use a traditional service call which doesn’t need a device_id.

1 Like

you’re missing a target: declaration from target_climate

Both of the selectors are Entity Selectors. Had they been Target Selectors then, yes, the blueprint would need to use target.

  input:
    open_window_sensor:
      name: Open Window Sensor
      selector:  #<------ Entity selector
        entity:  #<------
          domain: sensor
    target_climate:
      name: Climate Device
      selector:  #<------ Entity selector
        entity:  #<------
          domain: climate
1 Like

I’ve changed the action to include a service call, but I still get a similar parsing error:

Invalid blueprint: extra keys not allowed @ data['blueprint']['action']. Got [OrderedDict([('service', 'climate.set_hvac_mode'), ('data', OrderedDict([('entity_id', Input(name='target_climate')), ('hvac_mode', 'auto')]))])]
extra keys not allowed @ data['blueprint']['trigger']. Got OrderedDict([('platform', 'state'), ('entity_id', Input(name='open_window_sensor')), ('from', 'True'), ('to', 'False')])

Post the YAML code that includes the service call.

That would be

  action:
    service: climate.set_hvac_mode
    data:
      entity_id: !input target_climate
      hvac_mode: auto

But the error indicates problems in the trigger and action section…

Is there some reason that prevents you from posting the entire blueprint automation?

I realize you posted the original version above, but it’s helpful to see the modified version in its entirety.

Besides always having the complet actual blueprint is really a good idea.

If you are using the Version from your first post, the indentation is not correct.

Try this:

blueprint:
  name: Tado open window detection
  description: turns the Tado off when open window is detected
  domain: automation

  input:
    open_window_sensor:
      name: Open Window Sensor
      selector:
        entity:
          domain: sensor
    target_climate:
      name: Climate Device
      selector:
        entity:
          domain: climate

trigger:
  platform: state
  entity_id: !input open_window_sensor
  from: 'True'
  to: 'False'

action:
  entity_id: !input target_climate
  type: set_hvac_mode
  hvac_mode: auto

With the correct service call and indentation.

blueprint:
  name: Tado open window detection
  description: turns the Tado off when open window is detected
  domain: automation
  input:
    open_window_sensor:
      name: Open Window Sensor
      selector:
        entity:
          domain: sensor
    target_climate:
      name: Climate Device
      selector:
        entity:
          domain: climate
trigger:
  platform: state
  entity_id: !input open_window_sensor
  from: 'True'
  to: 'False'
action:
  service: climate.set_hvac_mode
  data:
    entity_id: !input target_climate
    hvac_mode: auto

Be advised that if you intend to share this blueprint with others, it employs an unusual convention for the window sensor. Normally, it would be binary_sensor with on and off states. You are using a sensor with True and False states.

Aaaah! that’s the problem. Action and trigger need to be on the same level as blueprint.

About the sensor: I writing this for the tado integration and their open window sensor is not a binary sensor. It’s a regular sensor with ‘True’ and ‘False’ as states.

Also, I need to look at templating so I can handle opening and closing in one blueprint.

Thanks for the help and Happy Newyear

In that case, I suggest you consider limiting the Entity Selector’s choices to the Tado integration. All you need is to add integration: tado to the selector. There’s an example in the documentation.

It can be done like this:

trigger:
  platform: state
  entity_id: !input open_window_sensor
action:
  service: climate.set_hvac_mode
  data:
    entity_id: !input target_climate
    hvac_mode: "{{ 'off' if trigger.to_state.state == 'True' else 'auto' }}"

I assume you want hvac_mode to be off when the Tado sensor is True and auto when it’s False? Or is it the opposite?

About the integration selector: I already saw that in the documentation, but thanks for the tip. It would be nice if I could filter the sensors on name ending on _open_window, but I don’t think that’s possible.

Thanks for the template and all the help. It’s a bit frustrating that the error message is not really helpful, but now I’m ready go wild with blueprints :smiley:

It’s possible.

Hmm, I don’t see this in the documentation of the Entity Selectors.

@lodewijk, did you find out any method on how to filter the entity selector on id?

No, I did not :frowning: