Use assignment expressions 10 (#57791)

This commit is contained in:
Marc Mueller 2021-10-15 21:36:03 +02:00 committed by GitHub
parent 9be3278ffa
commit 12d1dfdaf9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 44 additions and 87 deletions

View file

@ -129,8 +129,7 @@ async def async_call_action_from_config(
@callback
def async_condition_from_config(config: ConfigType) -> condition.ConditionCheckerType:
"""Evaluate state based on configuration."""
condition_type = config[CONF_TYPE]
if condition_type == CONF_IS_ON:
if config[CONF_TYPE] == CONF_IS_ON:
stat = "on"
else:
stat = "off"
@ -152,8 +151,7 @@ async def async_attach_trigger(
automation_info: AutomationTriggerInfo,
) -> CALLBACK_TYPE:
"""Listen for state changes based on configuration."""
trigger_type = config[CONF_TYPE]
if trigger_type == CONF_TURNED_ON:
if config[CONF_TYPE] == CONF_TURNED_ON:
to_state = "on"
else:
to_state = "off"