Skip to content

Commit

Permalink
fix: leaf_temperature_offset bug
Browse files Browse the repository at this point in the history
  • Loading branch information
mentalilll committed Jul 29, 2024
1 parent c4ee822 commit 4670f96
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions dist/chart.js
Original file line number Diff line number Diff line change
Expand Up @@ -265,16 +265,16 @@ export const chart = {
} else {
vpd = this.calculateVPD(leafTemperature, temperature, humidity).toFixed(2);
}
const min_vpd = this.calculateVPD(temperature - 2, temperature, this.max_humidity);
const max_vpd = this.calculateVPD(temperature - 2, temperature, this.min_humidity);
const min_vpd = this.calculateVPD(temperature - (this.config.leaf_temperature_offset || 2), temperature, this.max_humidity);
const max_vpd = this.calculateVPD(temperature - (this.config.leaf_temperature_offset || 2), temperature, this.min_humidity);
const relativeVpd = vpd - min_vpd;
const totalVpdRange = max_vpd - min_vpd;
const percentageVpd = (relativeVpd / totalVpdRange) * 100;

const relativeTemperature = temperature - this.min_temperature;
const totalTemperatureRange = this.max_temperature - this.min_temperature;
const percentageTemperature = (relativeTemperature / totalTemperatureRange) * 100;

const pointerElements = this.createPointer(index, percentageVpd, percentageTemperature, sensor.name, vpd, humidity, temperature);

// Check and append only if elements are Nodes
Expand Down
2 changes: 1 addition & 1 deletion dist/ha-vpd-chart.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Set version for the card
window.vpdChartVersion = "1.3.6";
window.vpdChartVersion = "1.3.7";

import {methods} from './methods.js';
import {chart} from './chart.js';
Expand Down

0 comments on commit 4670f96

Please sign in to comment.