Skip to content

Commit

Permalink
Fixed sensor unavailable if failed to load data on startup (v1.1.1)
Browse files Browse the repository at this point in the history
  • Loading branch information
muxa committed May 10, 2021
1 parent 1760784 commit ab277fd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion custom_components/niwa_tides/manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"domain": "niwa_tides",
"name": "NIWA Tides",
"version": "1.1.0",
"version": "1.1.1",
"documentation": "https://github.com/muxa/home-assistant-niwa-tides",
"issue_tracker": "https://github.com/muxa/home-assistant-niwa-tides/issues",
"dependencies": [],
Expand Down
6 changes: 3 additions & 3 deletions custom_components/niwa_tides/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,12 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
_LOGGER.error("Latitude or longitude not set in Home Assistant config")

tides = NiwaTidesInfoSensor(name, entity_id, lat, lon, key)

add_entities([tides])

tides.update()
if tides.data == None:
_LOGGER.error("Unable to retrieve tides data")
return

add_entities([tides])


class NiwaTidesInfoSensor(RestoreEntity):
Expand Down

0 comments on commit ab277fd

Please sign in to comment.