mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 13:17:32 +00:00
Fix unpredictable entity names in concord232 binary_sensor (#11292)
This commit is contained in:
parent
a44181fd35
commit
802a95eac5
@ -62,6 +62,13 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
|||||||
_LOGGER.error("Unable to connect to Concord232: %s", str(ex))
|
_LOGGER.error("Unable to connect to Concord232: %s", str(ex))
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
# The order of zones returned by client.list_zones() can vary.
|
||||||
|
# When the zones are not named, this can result in the same entity
|
||||||
|
# name mapping to different sensors in an unpredictable way. Sort
|
||||||
|
# the zones by zone number to prevent this.
|
||||||
|
|
||||||
|
client.zones.sort(key=lambda zone: zone['number'])
|
||||||
|
|
||||||
for zone in client.zones:
|
for zone in client.zones:
|
||||||
_LOGGER.info("Loading Zone found: %s", zone['name'])
|
_LOGGER.info("Loading Zone found: %s", zone['name'])
|
||||||
if zone['number'] not in exclude:
|
if zone['number'] not in exclude:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user