Remove useless try-except from Tasmota binary sensor (#41462)

This commit is contained in:
Erik Montnemery 2020-10-08 08:44:11 +02:00 committed by GitHub
parent 896f64d02b
commit 85603dcd08
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -8,7 +8,7 @@ from homeassistant.helpers.dispatcher import async_dispatcher_connect
import homeassistant.helpers.event as evt import homeassistant.helpers.event as evt
from .const import DOMAIN as TASMOTA_DOMAIN from .const import DOMAIN as TASMOTA_DOMAIN
from .discovery import TASMOTA_DISCOVERY_ENTITY_NEW, clear_discovery_hash from .discovery import TASMOTA_DISCOVERY_ENTITY_NEW
from .mixins import TasmotaAvailability, TasmotaDiscoveryUpdate from .mixins import TasmotaAvailability, TasmotaDiscoveryUpdate
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
@ -20,17 +20,13 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
@callback @callback
def async_discover(tasmota_entity, discovery_hash): def async_discover(tasmota_entity, discovery_hash):
"""Discover and add a Tasmota binary sensor.""" """Discover and add a Tasmota binary sensor."""
try: async_add_entities(
async_add_entities( [
[ TasmotaBinarySensor(
TasmotaBinarySensor( tasmota_entity=tasmota_entity, discovery_hash=discovery_hash
tasmota_entity=tasmota_entity, discovery_hash=discovery_hash )
) ]
] )
)
except Exception:
clear_discovery_hash(hass, discovery_hash)
raise
async_dispatcher_connect( async_dispatcher_connect(
hass, hass,