Use assignment expressions 10 (#57791)
This commit is contained in:
parent
9be3278ffa
commit
12d1dfdaf9
10 changed files with 44 additions and 87 deletions
|
@ -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"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue