Black
This commit is contained in:
1 parent
da05dfe708
commit
4de97abc3a
2676 files changed
+163166
-140084
No files matched your search
@@ -8,19 +8,18 @@ from homeassistant.components.lock import LockDevice
|
||||
from . import SmartThingsEntity
|
||||
from .const import DATA_BROKERS, DOMAIN
|
||||
|
||||
ST_STATE_LOCKED = 'locked'
|
||||
ST_STATE_LOCKED = "locked"
|
||||
ST_LOCK_ATTR_MAP = {
|
||||
'codeId': 'code_id',
|
||||
'codeName': 'code_name',
|
||||
'lockName': 'lock_name',
|
||||
'method': 'method',
|
||||
'timeout': 'timeout',
|
||||
'usedCode': 'used_code'
|
||||
"codeId": "code_id",
|
||||
"codeName": "code_name",
|
||||
"lockName": "lock_name",
|
||||
"method": "method",
|
||||
"timeout": "timeout",
|
||||
"usedCode": "used_code",
|
||||
}
|
||||
|
||||
|
||||
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
|
||||
|
||||
@@ -29,8 +28,12 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
|
||||
"""Add locks for a config entry."""
|
||||
broker = hass.data[DOMAIN][DATA_BROKERS][config_entry.entry_id]
|
||||
async_add_entities(
|
||||
[SmartThingsLock(device) for device in broker.devices.values()
|
||||
if broker.any_assigned(device.device_id, 'lock')])
|
||||
[
|
||||
SmartThingsLock(device)
|
||||
for device in broker.devices.values()
|
||||
if broker.any_assigned(device.device_id, "lock")
|
||||
]
|
||||
)
|
||||
|
||||
|
||||
def get_capabilities(capabilities: Sequence[str]) -> Optional[Sequence[str]]:
|
||||
@@ -64,7 +67,7 @@ class SmartThingsLock(SmartThingsEntity, LockDevice):
|
||||
state_attrs = {}
|
||||
status = self._device.status.attributes[Attribute.lock]
|
||||
if status.value:
|
||||
state_attrs['lock_state'] = status.value
|
||||
state_attrs["lock_state"] = status.value
|
||||
if isinstance(status.data, dict):
|
||||
for st_attr, ha_attr in ST_LOCK_ATTR_MAP.items():
|
||||
data_val = status.data.get(st_attr)
|
||||
|
||||
Reference in new issue
Block a user