mirror of
https://github.com/home-assistant/core
synced 2024-10-07 10:13:38 +02:00
Open Hardware Monitor Sensor reconnect (#28052)
* raise PlatformNotReady * Don't show errors on reconnect
This commit is contained in:
parent
b4054add61
commit
62a3dc1a94
@ -7,6 +7,7 @@ import voluptuous as vol
|
||||
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||
from homeassistant.const import CONF_HOST, CONF_PORT
|
||||
from homeassistant.exceptions import PlatformNotReady
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.util import Throttle
|
||||
@ -38,6 +39,8 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
|
||||
def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||
"""Set up the Open Hardware Monitor platform."""
|
||||
data = OpenHardwareMonitorData(config, hass)
|
||||
if data.data is None:
|
||||
raise PlatformNotReady
|
||||
add_entities(data.devices, True)
|
||||
|
||||
|
||||
@ -130,7 +133,7 @@ class OpenHardwareMonitorData:
|
||||
response = requests.get(data_url, timeout=30)
|
||||
self.data = response.json()
|
||||
except requests.exceptions.ConnectionError:
|
||||
_LOGGER.error("ConnectionError: Is OpenHardwareMonitor running?")
|
||||
_LOGGER.debug("ConnectionError: Is OpenHardwareMonitor running?")
|
||||
|
||||
def initialize(self, now):
|
||||
"""Parse of the sensors and adding of devices."""
|
||||
|
Loading…
Reference in New Issue
Block a user