Skip to content

Instantly share code, notes, and snippets.

@Didgeridrew
Last active February 24, 2021 23:59
Show Gist options
  • Save Didgeridrew/27c4a03f2f993eb92a0f4f58cb14ab0c to your computer and use it in GitHub Desktop.
Save Didgeridrew/27c4a03f2f993eb92a0f4f58cb14ab0c to your computer and use it in GitHub Desktop.
Home Assistant: Using threshold and derivative for Tom
# The derivative sensor outputs positive for rising temperatures and negative for falling temperatures.
# The threshold sensor will give you a binary sensor called binary_sensor.furnace_temperature_rising
# which outputs "on" when temperatures are rising and "off" when they are falling.
# The hysteresis setting determines the ˚F/min rate necessary to switch states, limiting false positives.
# Finally, the template sensor tracks the amount of time between changes in the threshold sensor.
sensor:
- platform: derivative
source: sensor.furnace_temperature
unit_time: min
name: furnace temperature derivative
time_window: 00:01:00
- platform: template
sensors:
furnace_temp_period:
value_template: >-
{{ relative_time(states.binary_sensor.furnace_temperature_rising.last_changed)}}
binary_sensor:
- platform: threshold
entity_id: sensor.furnace_temperature_derivative
upper: 0
hysteresis: 2.0
name: Furnace Temperature Rising
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment