From 5da2973351674329a0eaaf41e8313558cf2ddcbe Mon Sep 17 00:00:00 2001 From: Andrey Date: Mon, 25 Jan 2021 15:52:24 +0300 Subject: [PATCH] fix scanning --- custom_components/mega/config_flow.py | 4 ++-- custom_components/mega/sensor.py | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/custom_components/mega/config_flow.py b/custom_components/mega/config_flow.py index 44964d4..9a64d4c 100644 --- a/custom_components/mega/config_flow.py +++ b/custom_components/mega/config_flow.py @@ -32,8 +32,8 @@ STEP_USER_DATA_SCHEMA = vol.Schema( async def get_hub(hass: HomeAssistant, data): _mqtt = hass.data.get(mqtt.DOMAIN) - if not isinstance(_mqtt, mqtt.MQTT): - raise exceptions.MqttNotConfigured("mqtt must be configured first") + # if not isinstance(_mqtt, mqtt.MQTT): + # raise exceptions.MqttNotConfigured("mqtt must be configured first") hub = MegaD(hass, **data, lg=_LOGGER, mqtt=_mqtt, loop=asyncio.get_event_loop()) hub.mqtt_id = await hub.get_mqtt_id() if not await hub.authenticate(): diff --git a/custom_components/mega/sensor.py b/custom_components/mega/sensor.py index 93888f1..950cca9 100644 --- a/custom_components/mega/sensor.py +++ b/custom_components/mega/sensor.py @@ -154,5 +154,7 @@ class Mega1WSensor(MegaPushEntity): @property def name(self): n = super().name - c = self.customize.get(CONF_NAME, {}).get(self.key) + c = self.customize.get(CONF_NAME, {}) + if isinstance(c, dict): + c = c.get(self.key) return c or n \ No newline at end of file