Use assignment expressions 28 (#58189)

This commit is contained in:
Marc Mueller 2021-10-22 14:06:04 +02:00 committed by GitHub
parent a3d1159a13
commit eab235173b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
24 changed files with 30 additions and 61 deletions

View file

@ -154,8 +154,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
@callback
def async_add_service(service):
entity_class = ENTITY_TYPES.get(service.short_type)
if not entity_class:
if not (entity_class := ENTITY_TYPES.get(service.short_type)):
return False
info = {"aid": service.accessory.aid, "iid": service.iid}
async_add_entities([entity_class(conn, info)], True)