diff --git a/src/UnitHelper.jsx b/src/UnitHelper.jsx index 9a6f106..53dfef3 100644 --- a/src/UnitHelper.jsx +++ b/src/UnitHelper.jsx @@ -424,6 +424,22 @@ export function getAlertRange(type) { return { max: 0, min: -105 } case "offline": return { max: +Infinity, min: 120 } + case "co2": + return { max: 2500, min: 350 } + case "voc": + return { max: 500, min: 0 } + case "pm10": + return { max: 250, min: 0 } + case "pm25": + return { max: 250, min: 0 } + case "pm40": + return { max: 250, min: 0 } + case "pm100": + return { max: 250, min: 0 } + case "luminosity": + return { max: 10000, min: 0 } + case "sound": + return { max: 127, min: 0 } default: return { max: 100, min: 0 } } diff --git a/src/components/AlertItem.jsx b/src/components/AlertItem.jsx index 4dfe154..f9f155d 100644 --- a/src/components/AlertItem.jsx +++ b/src/components/AlertItem.jsx @@ -41,7 +41,7 @@ class AlertItem extends Component { if (max === +Infinity) max = 900 return addVariablesInString(this.props.t("alert_offline_description"), [max / 60]); } - var uh = getUnitHelper(type) + var uh = getUnitHelper(this.props.dataKey) if (type !== "humidity") { min = uh.value(min) max = uh.value(max) @@ -111,7 +111,7 @@ class AlertItem extends Component { getMinMaxArr() { var alert = this.state.alert; if (!alert) return null; - var uh = getUnitHelper(this.props.type.toLowerCase()) + var uh = getUnitHelper(this.props.dataKey) if (this.props.type.toLowerCase() === "humidity") return [alert.min, alert.max] let val = [uh.value(alert.min), uh.value(alert.max)] @@ -126,7 +126,7 @@ class AlertItem extends Component { var alert = this.state.alert; var type = this.props.type.toLowerCase(); var t = this.props.t - var uh = getUnitHelper(type) + var uh = getUnitHelper(this.props.dataKey) var enabled = alert && alert.enabled; var validRange = getAlertRange(type) if (type === "temperature" || type === "pressure") { diff --git a/src/states/Sensor.jsx b/src/states/Sensor.jsx index 9c4b7dd..6e8928c 100644 --- a/src/states/Sensor.jsx +++ b/src/states/Sensor.jsx @@ -715,9 +715,20 @@ class Sensor extends Component { return