Skip to content

Commit

Permalink
- Bugfix VPD Value
Browse files Browse the repository at this point in the history
- Bugfix toFixed Axes
  • Loading branch information
mentalilll committed Feb 24, 2024
1 parent e64041b commit 03dbc51
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions ha-vpd-chart.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,12 @@ class HaVpdChart extends HTMLElement {
if (sensor.leaf_temperature !== undefined) {
leafTemperature = hass.states[sensor.leaf_temperature].state;
}
let vpd = hass.states[sensor.vpd].state || this.calculateVPD(parseFloat(leafTemperature), parseFloat(temperature), parseFloat(humidity)).toFixed(2)
let vpd;
if (sensor.vpd !== undefined) {
vpd = hass.states[sensor.vpd].state;
} else {
vpd = this.calculateVPD(parseFloat(leafTemperature), parseFloat(temperature), parseFloat(humidity)).toFixed(2);
}
let card = document.createElement('ha-card');
card.innerHTML += `
<div class="bar">
Expand Down Expand Up @@ -201,7 +206,7 @@ class HaVpdChart extends HTMLElement {
let hum = document.createElement('div');
hum.className = 'humidity-axis-label';
// Runden auf eine sinnvolle Anzahl von Dezimalstellen, z.B. 1
hum.innerHTML = `${currentValue}%`;
hum.innerHTML = `${currentValue.toFixed(0)}%`;
humidityAxis.appendChild(hum);
}
axes.appendChild(temperatureAxis);
Expand Down

0 comments on commit 03dbc51

Please sign in to comment.