From ab277fd157224c91431ee775b72811430a178a0e Mon Sep 17 00:00:00 2001 From: Mikhail Diatchenko Date: Mon, 10 May 2021 17:55:44 +1200 Subject: [PATCH] Fixed sensor unavailable if failed to load data on startup (v1.1.1) --- custom_components/niwa_tides/manifest.json | 2 +- custom_components/niwa_tides/sensor.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/custom_components/niwa_tides/manifest.json b/custom_components/niwa_tides/manifest.json index 0a69e4c..426c50f 100755 --- a/custom_components/niwa_tides/manifest.json +++ b/custom_components/niwa_tides/manifest.json @@ -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": [], diff --git a/custom_components/niwa_tides/sensor.py b/custom_components/niwa_tides/sensor.py index 8c9432f..eb599e0 100755 --- a/custom_components/niwa_tides/sensor.py +++ b/custom_components/niwa_tides/sensor.py @@ -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):