(Solved)I need help with Yaml and writing value to input_number

Hi everyone,

Unfortunately, I’m still having some problems with YAML, and I’m also having some problems with English. I found something interesting in a YouTube video, but the implementation isn’t working as hoped.

Here’s what I’m planning:

I want to calculate something from the values ​​of a
sensor: (sensor.washing_machine_power_consumption_since_last_reset)
and an input_number: (input_number.electricity_price),
and then store the result in another
input_number: (input_number.washing_machine_mains_power_costs).

The calculation itself works, but the result isn’t stored in the input_number.

This is my last successful attempt:

Thanks in advance for your help.

Best, Torsten

Just a guess, but did you create a number helper instead of an input_number?

Or action input_number.set?

Hi. Next time, please paste the yaml (properly formatted) itself instead of a screenshot, so we can copy and modify the code.

You use action number.set_value on an input_number. You should use the right action: input_number.set_value. It is confusing, but number and input_number are different things.

1 Like

Hello, here is the code:

action: number.set_value
metadata: {}
data:
  value: >-
    {{ states('sensor.waschmaschine_stromverbrauch_seit_letztem_reset')|float(0)
    *  states('input_number.strompreis')|float(0) }}
target:
  entity_id: input_number.waschmaschine_netzstromkosten

I created these helpers:


and
Screenshot 2025-05-05 200212

Thank you!!

The solution was:

action: input_number.set_value
metadata: {}
data:
  value: >-
    {{ states('sensor.waschmaschine_stromverbrauch_seit_letztem_reset')|float(0)
    *  states('input_number.strompreis')|float(0) }}
target:
  entity_id: input_number.waschmaschine_netzstromkosten

1 Like