mirror of
https://github.com/home-assistant/core.git
synced 2025-07-25 06:07:17 +00:00
Waqi State unknown if value is string (#97617)
This commit is contained in:
parent
615d7f0da7
commit
1587ac2137
@ -2,6 +2,7 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
from contextlib import suppress
|
||||
from datetime import timedelta
|
||||
import logging
|
||||
|
||||
@ -141,8 +142,9 @@ class WaqiSensor(SensorEntity):
|
||||
@property
|
||||
def native_value(self):
|
||||
"""Return the state of the device."""
|
||||
if self._data is not None:
|
||||
return self._data.get("aqi")
|
||||
if value := self._data.get("aqi"):
|
||||
with suppress(ValueError):
|
||||
return float(value)
|
||||
return None
|
||||
|
||||
@property
|
||||
|
Loading…
x
Reference in New Issue
Block a user