Hello,
Can someone suggest a route how to calculate the incremental change in value for a sensor?
Say sensor_x was just updated to 90 from previous value of 88. So the increment value I am looking for is 2.
Thanks
–B
Hello,
Can someone suggest a route how to calculate the incremental change in value for a sensor?
Say sensor_x was just updated to 90 from previous value of 88. So the increment value I am looking for is 2.
Thanks
–B
You can use a template… Exactly how you need to set it up will vary depending on where and how you plan on using the value.
Here’s an example creating a sensor that holds the value:
template:
- trigger:
- platform: state
entity_id: sensor.x
sensor:
- name: Sensor X Increment Value
state: "{{ trigger.to_state.state | int - trigger.from_state.state | int }}"
If you share more information about your use case, we can probably give you an answer that is appropriate for what you are trying to do.