Skip to content

Commit

Permalink
Merge pull request #73 from andrey-git/pure-pm25-value
Browse files Browse the repository at this point in the history
Fix pure pm25 value
  • Loading branch information
gjohansson-ST authored Aug 18, 2024
2 parents 587159d + 143a06a commit 24b09b2
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions pysensibo/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,12 @@ async def async_get_devices_data(self) -> SensiboData: # noqa: C901
pure_geo_integration: bool | None = None
pure_measure_integration: bool | None = None
pure_prime_integration: bool | None = None

# Pure devices has special handling for PM2.5 value
# as it represents an AQI value
pm25 = None
pm25_pure = None

if dev["productModel"] == "pure":
pure_boost_enabled = pure_conf.get("enabled", False)
pure_sensitivity = pure_conf.get("sensitivity", "n").lower()
Expand All @@ -249,12 +255,10 @@ async def async_get_devices_data(self) -> SensiboData: # noqa: C901
"measurements_integration", False
)
pure_prime_integration = pure_conf.get("prime_integration", False)
if dev["productModel"] == "pure" and (pm25 := measure.get("pm25")):
pm25 = None
pm25_pure = PureAQI(pm25)
if (_pm25 := measure.get("pm25")) is not None:
pm25_pure = PureAQI(_pm25)
else:
pm25 = measure.get("pm25")
pm25_pure = None

# Binary sensors for main device
room_occupied = dev["roomIsOccupied"]
Expand Down

0 comments on commit 24b09b2

Please sign in to comment.