Log an error instead of raising an exception (#14006)

This commit is contained in:
Sebastian Muszynski 2018-04-20 08:45:28 +02:00 committed by GitHub
parent 2372419d42
commit 8ef2abfca7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -14,7 +14,6 @@ import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import ( from homeassistant.const import (
TEMP_CELSIUS, CONF_NAME, CONF_MONITORED_CONDITIONS) TEMP_CELSIUS, CONF_NAME, CONF_MONITORED_CONDITIONS)
from homeassistant.exceptions import HomeAssistantError
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entity import Entity from homeassistant.helpers.entity import Entity
from homeassistant.helpers.temperature import display_temp from homeassistant.helpers.temperature import display_temp
@ -58,8 +57,9 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
if sensor.read_status() is None: if sensor.read_status() is None:
raise ValueError("CRC error while reading SHT31 status") raise ValueError("CRC error while reading SHT31 status")
except (OSError, ValueError): except (OSError, ValueError):
raise HomeAssistantError("SHT31 sensor not detected at address %s " % _LOGGER.error(
hex(i2c_address)) "SHT31 sensor not detected at address %s", hex(i2c_address))
return
sensor_client = SHTClient(sensor) sensor_client = SHTClient(sensor)
sensor_classes = { sensor_classes = {