mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 13:17:32 +00:00
Reduce IPP errors when printer is offline (#44413)
This commit is contained in:
parent
0b1791c293
commit
cb82f5159e
@ -48,6 +48,8 @@ async def async_setup(hass: HomeAssistant, config: Dict) -> bool:
|
|||||||
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||||
"""Set up IPP from a config entry."""
|
"""Set up IPP from a config entry."""
|
||||||
|
|
||||||
|
coordinator = hass.data[DOMAIN].get(entry.entry_id)
|
||||||
|
if not coordinator:
|
||||||
# Create IPP instance for this entry
|
# Create IPP instance for this entry
|
||||||
coordinator = IPPDataUpdateCoordinator(
|
coordinator = IPPDataUpdateCoordinator(
|
||||||
hass,
|
hass,
|
||||||
@ -57,13 +59,13 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|||||||
tls=entry.data[CONF_SSL],
|
tls=entry.data[CONF_SSL],
|
||||||
verify_ssl=entry.data[CONF_VERIFY_SSL],
|
verify_ssl=entry.data[CONF_VERIFY_SSL],
|
||||||
)
|
)
|
||||||
|
hass.data[DOMAIN][entry.entry_id] = coordinator
|
||||||
|
|
||||||
await coordinator.async_refresh()
|
await coordinator.async_refresh()
|
||||||
|
|
||||||
if not coordinator.last_update_success:
|
if not coordinator.last_update_success:
|
||||||
raise ConfigEntryNotReady
|
raise ConfigEntryNotReady
|
||||||
|
|
||||||
hass.data[DOMAIN][entry.entry_id] = coordinator
|
|
||||||
|
|
||||||
for component in PLATFORMS:
|
for component in PLATFORMS:
|
||||||
hass.async_create_task(
|
hass.async_create_task(
|
||||||
hass.config_entries.async_forward_entry_setup(entry, component)
|
hass.config_entries.async_forward_entry_setup(entry, component)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user