Template value should be a string for dictionary value @ data['action'][0]['data'] at creating my Blueprint

Hey,
i need some assistance in Creating a Blueprint.
This Blueprint works as an Automation, but not when i try to create the Automation from Blueprint.
What i get is temmple value should be a string for dictionary value @ data […]

I just cant figure out, what my mistake is.
Here’s the code:

blueprint:
  name: "Hoymiles Zero Export"
  description: 'Eine Automation, mit der sich eine Einspeisung auf einen gewünschten Verbrauchswert realisieren lässt.'
  domain: automation
  input:
    verbrauchssensor:
      name: "Verbrauchssensor"
      description: "Die Entität, welche den aktuellen Verbrauch anzeigt ( Muss auch  Negativwerte anzeigen können )"
      selector:
        entity:
          filter:
            domain: sensor 
    anzahl:
      name: "Anzahl Wechselrichter"
      description: "Trage die Anzahl der zu steuernden Wechselrichter ein"
      selector:
        number:
          max: 2
          min: 1
          mode: box
    takt:
      name: "Regelinterval"
      description: "Trage den Abstand in Sekunden jeder Regelung ein"
      selector:
        number:
          max: 120
          min: 5
          mode: box
      default: 30
    ziel:
      name: "Verbrauchsziel"
      description: "angestrebter Verbrauch"
      selector:
        number:
          max: 1000
          min: -2000
      default: -100
    critlow:
      name: "Kritischer Tiefpunkt"
      description: "Negative kritischer Punkt, ab welchem sofort geregelt wird"
      selector:
        number:
          max: 0
          min: -2000
      default: -300
    crithigh:
      name: "Kritischer  Höchstpunkt"
      description: "Positiver kritischer Punkt, ab welchem sofort geregelt wird"
      selector:
        number:
          max: 2000
          min: 0
      default: 0
    wr1:
      name: "Wechselrichter 1"
      selector:
        entity:
          filter:
            domain:
              number
    wr2:
      name: "Wechselrichter 2"
      selector:
        entity:
          filter:
            domain:
              number
trigger:
  - platform: time_pattern
    seconds: /!input takt
  - platform: numeric_state
    entity_id: !input verbrauchssensor
    for:
      hours: 0
      minutes: 0
      seconds: 5
    above: !input crithigh
  - platform: numeric_state
    entity_id: !input verbrauchssensor
    for:
      hours: 0
      minutes: 0
      seconds: 5
    below: !input critlow
condition:
    - condition: sun
      after: sunrise
      before: sunset
action:
  - service: number.set_value
    data:
      value: |-
        {% set verbrauch = states('!input verbrauchssensor') |float |
        round(0) %}
        {% set ziel = !input ziel %}
        {% set differenz = ziel - verbrauch %}
        {% set wert = states('!input wr1') | float | round(0) %}
        {% set rechnung = wert - (differenz/ !input anzahl) %}
        {% if rechnung > 1425 %}
          1425
        {% elif rechnung < 75 %}
          75
        {% else %}
          {{ rechnung }}
        {% endif %}
    target:
      entity_id:
      - !input wr1
      - !input wr2
mode: single

Set these as variables in the YAML and use that. I think the docs have an example like that. Look at script variables.

Thanks alot, I didn’t see that in the documentation.

1 Like

Look at these sections if you’re getting stuck:

And maybe here too:
Configuring variables into templates in a blueprint - Configuration - Home Assistant Community (home-assistant.io)

1 Like