Black
This commit is contained in:
1 parent
da05dfe708
commit
4de97abc3a
2676 files changed
+163166
-140084
No files matched your search
@@ -9,8 +9,7 @@ from . import SmartThingsEntity
|
||||
from .const import DATA_BROKERS, DOMAIN
|
||||
|
||||
|
||||
async def async_setup_platform(
|
||||
hass, config, async_add_entities, discovery_info=None):
|
||||
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
|
||||
"""Platform uses config entry setup."""
|
||||
pass
|
||||
|
||||
@@ -19,17 +18,19 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
|
||||
"""Add switches for a config entry."""
|
||||
broker = hass.data[DOMAIN][DATA_BROKERS][config_entry.entry_id]
|
||||
async_add_entities(
|
||||
[SmartThingsSwitch(device) for device in broker.devices.values()
|
||||
if broker.any_assigned(device.device_id, 'switch')])
|
||||
[
|
||||
SmartThingsSwitch(device)
|
||||
for device in broker.devices.values()
|
||||
if broker.any_assigned(device.device_id, "switch")
|
||||
]
|
||||
)
|
||||
|
||||
|
||||
def get_capabilities(capabilities: Sequence[str]) -> Optional[Sequence[str]]:
|
||||
"""Return all capabilities supported if minimum required are present."""
|
||||
# Must be able to be turned on/off.
|
||||
if Capability.switch in capabilities:
|
||||
return [Capability.switch,
|
||||
Capability.energy_meter,
|
||||
Capability.power_meter]
|
||||
return [Capability.switch, Capability.energy_meter, Capability.power_meter]
|
||||
return None
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user