Skip to content

Commit

Permalink
Fix update failed
Browse files Browse the repository at this point in the history
  • Loading branch information
cyr-ius committed Oct 22, 2022
1 parent 6c12435 commit a687d46
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
8 changes: 3 additions & 5 deletions custom_components/pdns/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME
from homeassistant.core import HomeAssistant
from homeassistant.helpers.aiohttp_client import async_create_clientsession
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed

from .pdns import PDNS, PDNSFailed

Expand Down Expand Up @@ -57,9 +57,7 @@ def __init__(self, hass: HomeAssistant, entry: ConfigEntry) -> None:
)

async def _async_update_data(self) -> dict:
state = {}
try:
state = await self.api.async_update()
return await self.api.async_update()
except PDNSFailed as error:
_LOGGER.error(error)
return state
raise UpdateFailed from error
4 changes: 2 additions & 2 deletions custom_components/pdns/binary_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,5 @@ def __init__(self, coordinator):

@property
def is_on(self):
"""Return true if the binary sensor is on."""
return self.coordinator.data.get(CONF_PUBLIC_IP) is None
"""Return true if the binary sensor have a trouble."""
return self.available is False
2 changes: 1 addition & 1 deletion custom_components/pdns/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
"issue_tracker": "https://github.com/Cyr-ius/hass-pdns/issues",
"codeowners": ["@Cyr-ius"],
"iot_class": "cloud_polling",
"version": "2.3.8"
"version": "2.3.9"
}

0 comments on commit a687d46

Please sign in to comment.