mirror of
https://github.com/home-assistant/core.git
synced 2025-07-26 22:57:17 +00:00
Use dict.values() when appropriate (#42509)
This commit is contained in:
parent
9545fce55b
commit
989ab5029a
@ -186,7 +186,7 @@ class ApnsNotificationService(BaseNotificationService):
|
|||||||
def write_devices(self):
|
def write_devices(self):
|
||||||
"""Write all known devices to file."""
|
"""Write all known devices to file."""
|
||||||
with open(self.yaml_path, "w+") as out:
|
with open(self.yaml_path, "w+") as out:
|
||||||
for _, device in self.devices.items():
|
for device in self.devices.values():
|
||||||
_write_device(out, device)
|
_write_device(out, device)
|
||||||
|
|
||||||
def register(self, call):
|
def register(self, call):
|
||||||
|
@ -79,7 +79,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||||||
|
|
||||||
def dispose(event):
|
def dispose(event):
|
||||||
"""Close connections to Netio Devices."""
|
"""Close connections to Netio Devices."""
|
||||||
for _, value in DEVICES.items():
|
for value in DEVICES.values():
|
||||||
value.netio.stop()
|
value.netio.stop()
|
||||||
|
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||||||
scsgate = hass.data[DOMAIN]
|
scsgate = hass.data[DOMAIN]
|
||||||
|
|
||||||
if devices:
|
if devices:
|
||||||
for _, entity_info in devices.items():
|
for entity_info in devices.values():
|
||||||
if entity_info[CONF_SCS_ID] in scsgate.devices:
|
if entity_info[CONF_SCS_ID] in scsgate.devices:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||||||
scsgate = hass.data[DOMAIN]
|
scsgate = hass.data[DOMAIN]
|
||||||
|
|
||||||
if devices:
|
if devices:
|
||||||
for _, entity_info in devices.items():
|
for entity_info in devices.values():
|
||||||
if entity_info[CONF_SCS_ID] in scsgate.devices:
|
if entity_info[CONF_SCS_ID] in scsgate.devices:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ def _setup_traditional_switches(logger, config, scsgate, add_entities_callback):
|
|||||||
switches = []
|
switches = []
|
||||||
|
|
||||||
if traditional:
|
if traditional:
|
||||||
for _, entity_info in traditional.items():
|
for entity_info in traditional.values():
|
||||||
if entity_info[CONF_SCS_ID] in scsgate.devices:
|
if entity_info[CONF_SCS_ID] in scsgate.devices:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
@ -65,7 +65,7 @@ def _setup_scenario_switches(logger, config, scsgate, hass):
|
|||||||
scenario = config.get(CONF_SCENARIO)
|
scenario = config.get(CONF_SCENARIO)
|
||||||
|
|
||||||
if scenario:
|
if scenario:
|
||||||
for _, entity_info in scenario.items():
|
for entity_info in scenario.values():
|
||||||
if entity_info[CONF_SCS_ID] in scsgate.devices:
|
if entity_info[CONF_SCS_ID] in scsgate.devices:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||||||
switches = []
|
switches = []
|
||||||
tags = platform.load_tags()
|
tags = platform.load_tags()
|
||||||
for switch_type in config.get(CONF_MONITORED_CONDITIONS):
|
for switch_type in config.get(CONF_MONITORED_CONDITIONS):
|
||||||
for _, tag in tags.items():
|
for tag in tags.values():
|
||||||
if switch_type in tag.allowed_monitoring_types:
|
if switch_type in tag.allowed_monitoring_types:
|
||||||
switches.append(WirelessTagSwitch(platform, tag, switch_type))
|
switches.append(WirelessTagSwitch(platform, tag, switch_type))
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user