I want to use the timeout
in a copy sensor, but it is not working as expected. My temp_object_change
is stalled for hours on a old value, instead of going down to zero. From the documentation and examples I read, I thought this would work.
Note: I do not want to use heartbeat, as this send values without looking is something was sent just minutes ago.
sensor:
- platform: mlx90614
update_interval: 30s
object:
id: temp_object
filters:
- delta: ${delta_send_object}
- throttle: 1minutes
- platform: copy
source_id: temp_object
id: "temp_object_change"
unit_of_measurement: "°C/h"
filters:
- lambda: |-
static float last_value = 0;
static float last_time = 0;
float time = (float) millis();
if ((last_time == 0)|( time <= last_time )){
last_value = x;
last_time = time;
return {};
}
float change = ( ( x - last_value ) / ( time - last_time ) ) * 1000 * 60 * 60;
last_value = x;
last_time = time;
return change;
- timeout:
timeout: 10minutes
value: 0
- exponential_moving_average:
send_every: 1