mirror of
https://github.com/home-assistant/core.git
synced 2025-07-27 15:17:35 +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
|
from __future__ import annotations
|
||||||
|
|
||||||
import asyncio
|
import asyncio
|
||||||
|
from contextlib import suppress
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
@ -141,8 +142,9 @@ class WaqiSensor(SensorEntity):
|
|||||||
@property
|
@property
|
||||||
def native_value(self):
|
def native_value(self):
|
||||||
"""Return the state of the device."""
|
"""Return the state of the device."""
|
||||||
if self._data is not None:
|
if value := self._data.get("aqi"):
|
||||||
return self._data.get("aqi")
|
with suppress(ValueError):
|
||||||
|
return float(value)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
Loading…
x
Reference in New Issue
Block a user