Skip to content
Snippets Groups Projects
Unverified Commit 3ad59f87 authored by starkillerOG's avatar starkillerOG Committed by GitHub
Browse files

Fix xiaomi_miio error when no sensors present (#37531)

parent c1aaceeb
No related branches found
No related tags found
No related merge requests found
......@@ -83,16 +83,18 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
gateway = hass.data[DOMAIN][config_entry.entry_id]
sub_devices = gateway.devices
for sub_device in sub_devices.values():
sensor_variables = None
if sub_device.type == DeviceType.SensorHT:
sensor_variables = ["temperature", "humidity"]
if sub_device.type == DeviceType.AqaraHT:
sensor_variables = ["temperature", "humidity", "pressure"]
entities.extend(
[
XiaomiGatewaySensor(sub_device, config_entry, variable)
for variable in sensor_variables
]
)
if sensor_variables is not None:
entities.extend(
[
XiaomiGatewaySensor(sub_device, config_entry, variable)
for variable in sensor_variables
]
)
async_add_entities(entities, update_before_add=True)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment