#How to change my script into an automation

1 messages · Page 1 of 1 (latest)

opaque sierra
#

Hi there,

What I want:
I want to calculate a number and set a variable with this calculated number.

i have the following script which is working fine.

  entity_id: input_number.solar_bewertung_ubermorgen
  value: >-
    {{ ((solar_ertrag_ubermorgen-Eingabemin) * (Zielmax-Zielmin) /
    (Eingabemax-Eingabemin)+Zielmin ) | round(1) }}
action: input_number.set_value

but want to create a blueprint with this calculation. But i cant add it to an automation .

is it even possible and what have to be the changes to do so.

help would be much appreciated :=
regards
E

#

I tried the following, but it gives an indention error
actions:

    solar_ertrag: "{{ states('sensor.energy_production_today_4') | float(0) }}"
    solar_ertrag_morgen: "{{ states('sensor.energy_production_tomorrow_4') | float(0) }}"
    solar_ertrag_ubermorgen: "{{ states('sensor.energy_production_d2') | float(0) }}"
    Eingabemin: 0
    Eingabemax: 4
    Zielmin: -10
    Zielmax: 10
action: input_number.set_value
    data:
      entity_id: input_number.solar_bewertung_ubermorgen
      value: >-
        {{ ((solar_ertrag_ubermorgen-Eingabemin) * (Zielmax-Zielmin) /
        (Eingabemax-Eingabemin)+Zielmin ) | round(1) }}
sour fiberBOT
#

To format your text as code, enter three backticks on the first line, press Enter for a new line, paste your code, press Enter again for another new line, and lastly three more backticks.
```yaml
example: here
```
Don't forget you can edit your post rather than repeatedly posting the same thing.

dim peak
#

just put a dash in front of the action. You now have it as 1 list item, it should be 2 separate items

#
- variables:
      solar_ertrag: "{{ states('sensor.energy_production_today_4') | float(0) }}"
      solar_ertrag_morgen: "{{ states('sensor.energy_production_tomorrow_4') | float(0) }}"
      solar_ertrag_ubermorgen: "{{ states('sensor.energy_production_d2') | float(0) }}"
      Eingabemin: 0
      Eingabemax: 4
      Zielmin: -10
      Zielmax: 10
- action: input_number.set_value
  data:
    entity_id: input_number.solar_bewertung_ubermorgen
    value: >-
      {{ ((solar_ertrag_ubermorgen-Eingabemin) * (Zielmax-Zielmin) /
        (Eingabemax-Eingabemin)+Zielmin ) | round(1) }}
#

oh, the indentation in the action was off as well