diff --git a/homeassistant/components/binary_sensor/mqtt.py b/homeassistant/components/binary_sensor/mqtt.py index 34db8b2f3fb..f42feec6838 100644 --- a/homeassistant/components/binary_sensor/mqtt.py +++ b/homeassistant/components/binary_sensor/mqtt.py @@ -21,7 +21,7 @@ from homeassistant.components.mqtt import ( MqttAttributes, MqttAvailability, MqttDiscoveryUpdate, MqttEntityDeviceInfo, subscription) from homeassistant.components.mqtt.discovery import ( - ALREADY_DISCOVERED, MQTT_DISCOVERY_NEW) + MQTT_DISCOVERY_NEW, clear_discovery_hash) import homeassistant.helpers.config_validation as cv from homeassistant.helpers.dispatcher import async_dispatcher_connect import homeassistant.helpers.event as evt @@ -71,7 +71,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities): discovery_hash) except Exception: if discovery_hash: - del hass.data[ALREADY_DISCOVERED][discovery_hash] + clear_discovery_hash(hass, discovery_hash) raise async_dispatcher_connect(