Use assignment expressions 26 (#58187)

This commit is contained in:
Marc Mueller 2021-10-22 11:31:17 +02:00 committed by GitHub
parent be201e3ebe
commit 184e0d7fdf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 29 additions and 57 deletions

View file

@ -264,9 +264,7 @@ async def webhook_fire_event(hass, config_entry, data):
@validate_schema({vol.Required(ATTR_CAMERA_ENTITY_ID): cv.string})
async def webhook_stream_camera(hass, config_entry, data):
"""Handle a request to HLS-stream a camera."""
camera = hass.states.get(data[ATTR_CAMERA_ENTITY_ID])
if camera is None:
if (camera := hass.states.get(data[ATTR_CAMERA_ENTITY_ID])) is None:
return webhook_response(
{"success": False},
registration=config_entry.data,