I have set up a template sensor to convert station level air pressure to sea level like this:
template:
- sensor:
- name: "Pressure sea level"
unique_id: "pressure_red"
state: |-
{%- set h = 123.0 %}
{%- set p = states('sensor.outdoor_pressure') | float %}
{%- set phi = 0.01 * (states('sensor.outdoor_humidity') | float) %}
{%- set t = (states('sensor.outdoor_temperature') | float) %}
{%- set T = 273.15 + t %}
{%- set E = phi * 6.112 * e**((17.62 * t) / (243.12 + t)) %}
{%- set x = (9.80665 / (287.05* (T + 0.12 * E + 0.0065 * (h / 2)))) * h %}
{{ (p * e**x) | round(2) }}
unit_of_measurement: 'hPa'
device_class: "pressure"
state_class: "measurement"
icon: "mdi:gauge"
Then I would like to add a new statistics-graph to plot the two:
chart_type: line
period: hour
days_to_show: 2
type: statistics-graph
entities:
- entity: sensor.outdoor_pressure
name: statniv.
- entity: sensor.pressure_sea_level
name: reduz.
stat_types:
- mean
- min
- max
title: Luftdruck
However, only the sensor.outdoor_pressure
shows up, the sensor.pressure_sea_level
not.
Using a history graph works perfectly:
type: history-graph
entities:
- entity: sensor.pressure_sea_level
name: reduz.
- entity: sensor.outdoor_pressure
name: statniv.
What might be the issue here? Is this also related to this bug: Expected data source not listed - Home Assistant
However, it turns up in the list when setting device_class
and state_class
.