Filter out disconnected Shelly sensors (#39516)

This commit is contained in:
Paulus Schoutsen
2020-09-01 14:18:11 +02:00
committed by GitHub
parent 963651d6f2
commit aa476b392c

View File

@@ -37,7 +37,8 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
for block in wrapper.device.blocks: for block in wrapper.device.blocks:
for attr in SENSORS: for attr in SENSORS:
if not hasattr(block, attr): # Filter out non-existing sensors and sensors without a value
if getattr(block, attr, None) is None:
continue continue
sensors.append(ShellySensor(wrapper, block, attr)) sensors.append(ShellySensor(wrapper, block, attr))