Trend Binary Sensor


The trend platform allows you to create sensors which show the trend of numeric state orstate_attributes from other entities. This sensor requires two updates of the underlying sensor to establish a trend. Thus it can take some time to show an accurate state. It can be useful as part of automations, where you want to base an action on a trend.

To enable Trend binary sensors in your installation, add the following to your configuration.yaml file:

# Example configuration.yaml entry
binary_sensor:
  - platform: trend
    sensors:
      solar_angle:
        entity_id: sun.sun

Configuration variables:

  • sensors array (Required): List of your sensors.
    • friendly_name (Optional): Name to use in the Frontend.
    • device_class (Optional): The type/class of the sensor to set the icon in the frontend.
    • entity_id (Required): The entity that this sensor tracks.
    • attribute (Optional): The attribute of the entity that this sensor tracks. If no attribute is specified then the sensor will track the state.
    • invert (Optional): Invert the result (so true means descending rather than ascending)

Examples

In this section you find some real life examples of how to use this sensor.

Temperature trend

This example indicates true if the temperature is rising:

binary_sensor:
  - platform: trend
    sensors:
      temperature_up:
        friendly_name: 'Temp increasing'
        entity_id: sensor.skylight_temperature
        device_class: heat

And this one indicates true if the temperature is falling:

binary_sensor:
  - platform: trend
    sensors:
      temperature_down:
        friendly_name: 'Temp decreasing'
        entity_id: sensor.skylight_temperature
        device_class: cold
        invert: Yes