Keep getting Message malformed: expected float for dictionary value @ data['value']

I want to decrease my solar inverter in several steps from 1% at a time.
This simplified code is not working. I do keep getting Message malformed: expected float for dictionary value @ data[‘value’]

Can anybody help me?

type or paste code here

The malfunctioning piece of code without the conditions:

repeat:
      count: 100
      sequence:
      ***** if condition is right ****
        - device_id: **********
          domain: number
          entity_id: number.goodwe_grid_export_limit
          type: set_value
          value: ("{{ states('number.goodwe_grid_export_limit')|float }}" - 1)

You’re using a Device Action to set the value of number.goodwe_grid_export_limit. A Device Action does not support templates.

Use the number.set_value action (it supports templates).

In addition, the template you used has syntax errors.

repeat:
      count: 100
      sequence:
      #***** if condition is right ****
        - action: number.set_value
          target:
            entity_id: number.goodwe_grid_export_limit
          data:
            value: "{{ states('number.goodwe_grid_export_limit') | float(0) - 1 }}"

super… That will do the job.

Thank you

You’re welcome!

Before you go, please consider marking my post above with the Solution tag. It will automatically place a check-mark next to the topic’s title which indicates to others that the topic has been solved. This helps other users find answers to similar questions.