mirror of
https://codeberg.org/icewind/taspromto.git
synced 2026-06-03 16:44:11 +02:00
filter bogus co2 values
This commit is contained in:
parent
86a4ab5477
commit
43f9ad4e06
1 changed files with 4 additions and 2 deletions
|
|
@ -74,11 +74,13 @@ impl DeviceState {
|
|||
{
|
||||
self.power_today = Some(today);
|
||||
}
|
||||
if let Some(today) = json["MHZ19B"]["CarbonDioxide"]
|
||||
if let Some(co2) = json["MHZ19B"]["CarbonDioxide"]
|
||||
.as_number()
|
||||
.and_then(|num| f32::try_from(num).ok())
|
||||
{
|
||||
self.co2 = Some(today);
|
||||
if co2 > 1.0 {
|
||||
self.co2 = Some(co2);
|
||||
}
|
||||
}
|
||||
|
||||
if json["PMS5003"].is_object() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue