mirror of
https://github.com/home-assistant/core.git
synced 2025-11-12 12:30:31 +00:00
Use assignment expressions 10 (#57791)
This commit is contained in:
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user