Insert sensor temperature value to input number

Hi

Please help with automation

I have a temperature sensor

Condition:

If the temperature sensor shows the same temperature value for 15 minutes, then this temperature must be written to the input number

Thanks in advance !

trigger:
  - platform: state
    entity_id: sensor.your_sensor
    for: 
      minutes: 15
action:
  - service: input_number.set_value
    target:
      entity_id: input_number.your_input_number
    data:
      value: "{{ states('sensor.your_sensor")|float(0) }}"

Thank you

This is not true

In this case, the last value of the temperature sensor is inserted into the variable.

I need a value that does not change for 15 minutes

e.g. 3 last SAME values

I think you will find that it is.

The automation only triggers once the value has been the same for 15 minutes. This value (that has not changed for 15 minutes) is then saved into the input number.

Thank you

I didn’t think it was that easy

float(0) -what does it mean?

|float(0) converts the sensor state string to a number, if the state can not be converted to a number it is replaced with 0.

Error loading /config/configuration.yaml: invalid key: “OrderedDict([('states('sensor.0x00158d00044f9bae_temperature”)|float(0)’, None)])"
in “/config/includes/automation/13_rk.yaml”, line 14, column 0

Sorry, this:

value: "{{ states('sensor.your_sensor")|float(0) }}"

should be:

value: "{{ states('sensor.your_sensor')|float(0) }}"

(the double quote inside the brackets should be a single quote).

thanks a lot!

I will try