Configuration Template - Scaling

Finally, I configured a template for adjusted barometric pressure. Unfortunately, the scale is too big. It starts at 0. I would need only the range between 950 and 1050. Or even better the read-out adjusts itself to a meaningful scale. Any idea how to achieve this? Thank you.

I remember seeing another post that pointed you in the correct direction. This one. Have you tried creating a template sensor yet?

Yes, I created a template sensor and it is working. Only the graph is worthless.
Template:

 sensor:
  - platform: template
    sensors:
     sensor_ch_adj:
      friendly_name: "Sensor-CH ADJ"
      unique_id: "sensor.sensor_ch_adj"
      unit_of_measurement: hPa
      value_template: "{{ (states('sensor.sensor_ch_pressure')|float * (1 - (0.0065 * 1500) / (states('sensor.sensor_ch_temperature')|float + (0.0065 * 1500) + 273.15)) ** -5.257) | round(1)  }}"
      device_class: "pressure"

Screen Shot 2021-02-23 um 15.28.46|623x500, 50%

please paste the picture into the post

You can’t truncate the range on the graphs. The sensor itself returned zero at some point and that’s in the graph. You’ll either have to wait until that piece of data is outside the 24 hours or ensure that zero never makes it as a value.

Thank you for your quick reply. I couldn`t find this information elsewhere. So I will wait until tomorrow. On the other hand, it means that each time I restart the system I will have to wait 24 hours to see the movement.

Yes, but you can ensure the template never returns zero by adding an availability template

 sensor:
  - platform: template
    sensors:
     sensor_ch_adj:
      friendly_name: "Sensor-CH ADJ"
      unique_id: "sensor.sensor_ch_adj"
      unit_of_measurement: hPa
      value_template: "{{ (states('sensor.sensor_ch_pressure')|float * (1 - (0.0065 * 1500) / (states('sensor.sensor_ch_temperature')|float + (0.0065 * 1500) + 273.15)) ** -5.257) | round(1)  }}"
      device_class: "pressure"
      availability_template: >
        {% set p = states('sensor.sensor_ch_pressure') %}
        {% set t = states('sensor.sensor_ch_temperature') %}
        {% set unknown = ['unknown', 'unavailable'] %}
        {{ p not in unknown and t not in unknown }}

When either of the input sensors are unknown, the sensor itself will be unknown and it will properly filter out that data in the graph.

1 Like

Thank you. I modified the template according to your input.