mirror of
https://github.com/home-assistant/core.git
synced 2025-07-18 18:57:06 +00:00
Log when Nanoleaf is unavailable (#56921)
This commit is contained in:
parent
1d00bc8a62
commit
2874ca2e08
@ -1,6 +1,7 @@
|
|||||||
"""Support for Nanoleaf Lights."""
|
"""Support for Nanoleaf Lights."""
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import logging
|
||||||
import math
|
import math
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
@ -46,6 +47,8 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_platform(
|
async def async_setup_platform(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
@ -187,6 +190,10 @@ class NanoleafLight(LightEntity):
|
|||||||
try:
|
try:
|
||||||
await self._nanoleaf.get_info()
|
await self._nanoleaf.get_info()
|
||||||
except Unavailable:
|
except Unavailable:
|
||||||
|
if self.available:
|
||||||
|
_LOGGER.warning("Could not connect to %s", self.name)
|
||||||
self._attr_available = False
|
self._attr_available = False
|
||||||
return
|
return
|
||||||
|
if not self.available:
|
||||||
|
_LOGGER.info("Fetching %s data recovered", self.name)
|
||||||
self._attr_available = True
|
self._attr_available = True
|
||||||
|
Loading…
x
Reference in New Issue
Block a user