Skip to content

Instantly share code, notes, and snippets.

@skywalkerisnull
Last active February 26, 2025 09:53
Show Gist options
  • Save skywalkerisnull/e1a1e5f247e53d7a82c7a030d41c56af to your computer and use it in GitHub Desktop.
Save skywalkerisnull/e1a1e5f247e53d7a82c7a030d41c56af to your computer and use it in GitHub Desktop.
type: custom:plotly-graph
title: Pressure and Boiling Point
entities:
- entity: sensor.gw1100c_relative_pressure
type: line
name: |
$ex {
const raw_pressure_hPa = parseFloat(ys.at(-1));
const corrected_pressure_hPa = raw_pressure_hPa - 80.7; // 80.7 is because this is at 722m above MSL
const P1 = 1013.25; // Standard atmospheric pressure in hPa
const T1 = 373.15; // Boiling point of water at standard pressure in Kelvin
const delta_H_vap = 40790; // Enthalpy of vaporization in J/mol
const R_gas = 8.314; // Universal gas constant in J/(mol·K)
const P2 = corrected_pressure_hPa;
const T2 = 1 / ((1 / T1) - (R_gas * Math.log(P2 / P1) / delta_H_vap));
const boiling_point_C = T2 - 273.15; // Convert from Kelvin to Celsius
return "Raw Pressure " + raw_pressure_hPa.toFixed(2) + " hPa, Boiling Point " + boiling_point_C.toFixed(2) + " °C";
}
line:
width: 1
shape: spline
color: yellow
statistic: mean
period: 5minute
layout:
yaxis:
title: Pressure
side: left
xaxis:
title: Time
showlegend: true
hours_to_show: 48
refresh_interval: 10
@skywalkerisnull
Copy link
Author

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment