Trends: what are the best settings? And what does the Netatmo integration use?

I want to make trend sensors for temperature and humidity in my house. I noticed that Netatmo offers non binary sensors that output up, down or stable. But I cannot find the settings behind this.

I want to recreate those sensors for my Aqara temperature sensors. But I don’t have an idea how to do this. The Trend integrations creates a binary sensor (and therefore there is no stable option).

Any ideas?

You could add a template sensor that combines the two binary sensors created by the Trend integration.
Something like this:

binary_sensor:
  - platform: trend
    sensors:
      temp_falling:
        entity_id: sensor.outside_temperature
        sample_duration: 7200
        max_samples: 120
        min_samples: 20
        min_gradient: -0.0008
        device_class: cold

      temp_rising:
        entity_id: sensor.outside_temperature
        sample_duration: 7200
        max_samples: 120
        min_samples: 20
        min_gradient: 0.0008
        device_class: heat

template:
  - sensor:
    - name: Trend Temperature
      unique_id: uid_trend_temperature
      state: >
        {% if is_state('binary_sensor.temp_rising', 'on') %}
          Rising
        {% elif is_state('binary_sensor.temp_falling', 'on') %}
          Falling
        {% else %}
          Stable
        {% endif %}
      icon: >
        {% if is_state('sensor.trend_temperature', 'Rising') %}
          mdi:arrow-top-right-thin-circle-outline
        {% elif is_state('sensor.trend_temperature', 'Falling') %}
          mdi:arrow-bottom-right-thin-circle-outline
        {% else %}
          mdi:arrow-right-thin-circle-outline
        {% endif %}

Will this work? You have two times “on” (if and elif). And will a binary sensor be empty for the else case?

Yes, this will work. Did you already try it?

What you do is creating an extra sensor that replaces the two binary sensors with a template sensor that can have three states: Rising, Falling or Stable.
The state depends on the states of the two binary sensors.

        {% if is_state('binary_sensor.temp_rising', 'on') %}
          Rising

So if the binary_sensor.temp_rising is on the state will be Rising. Etc.
So this template sensor is not a binary sensor. You could call it a “triple” sensor.

1 Like

Oh yeah right. I read it all wrong making a false assumption. I did not try this, as it will make quite a lot of sensors… that is a bit of a downside.

Last question: your trend sensors, are the actual values that would give reliable output?

“My” trend sensors are just the ones from the Home Assistant Trend integration doc.
There are a lot of configuration options to play with to adapt them to your specific sensors, but I bed that this can give you a very reliable output.