4141 template ,
4242)
4343from homeassistant .helpers .condition import (
44+ async_from_config as async_condition_from_config ,
4445 async_get_all_descriptions as async_get_all_condition_descriptions ,
4546 async_subscribe_platform_events as async_subscribe_condition_platform_events ,
47+ async_validate_condition_config ,
48+ async_validate_conditions_config ,
4649)
4750from homeassistant .helpers .dispatcher import async_dispatcher_connect
4851from homeassistant .helpers .entityfilter import (
6669)
6770from homeassistant .helpers .trigger import (
6871 async_get_all_descriptions as async_get_all_trigger_descriptions ,
72+ async_initialize_triggers ,
6973 async_subscribe_platform_events as async_subscribe_trigger_platform_events ,
74+ async_validate_trigger_config ,
7075)
7176from homeassistant .loader import (
7277 IntegrationNotFound ,
@@ -885,10 +890,7 @@ async def handle_subscribe_trigger(
885890 hass : HomeAssistant , connection : ActiveConnection , msg : dict [str , Any ]
886891) -> None :
887892 """Handle subscribe trigger command."""
888- # Circular dep
889- from homeassistant .helpers import trigger # noqa: PLC0415
890-
891- trigger_config = await trigger .async_validate_trigger_config (hass , msg ["trigger" ])
893+ trigger_config = await async_validate_trigger_config (hass , msg ["trigger" ])
892894
893895 @callback
894896 def forward_triggers (
@@ -905,7 +907,7 @@ def forward_triggers(
905907 )
906908
907909 connection .subscriptions [msg ["id" ]] = (
908- await trigger . async_initialize_triggers (
910+ await async_initialize_triggers (
909911 hass ,
910912 trigger_config ,
911913 forward_triggers ,
@@ -935,13 +937,10 @@ async def handle_test_condition(
935937 hass : HomeAssistant , connection : ActiveConnection , msg : dict [str , Any ]
936938) -> None :
937939 """Handle test condition command."""
938- # Circular dep
939- from homeassistant .helpers import condition # noqa: PLC0415
940-
941940 # Do static + dynamic validation of the condition
942- config = await condition . async_validate_condition_config (hass , msg ["condition" ])
941+ config = await async_validate_condition_config (hass , msg ["condition" ])
943942 # Test the condition
944- check_condition = await condition . async_from_config (hass , config )
943+ check_condition = await async_condition_from_config (hass , config )
945944 connection .send_result (
946945 msg ["id" ], {"result" : check_condition (hass , msg .get ("variables" ))}
947946 )
@@ -1028,16 +1027,16 @@ async def handle_validate_config(
10281027) -> None :
10291028 """Handle validate config command."""
10301029 # Circular dep
1031- from homeassistant .helpers import condition , script , trigger # noqa: PLC0415
1030+ from homeassistant .helpers import script # noqa: PLC0415
10321031
10331032 result = {}
10341033
10351034 for key , schema , validator in (
1036- ("triggers" , cv .TRIGGER_SCHEMA , trigger . async_validate_trigger_config ),
1035+ ("triggers" , cv .TRIGGER_SCHEMA , async_validate_trigger_config ),
10371036 (
10381037 "conditions" ,
10391038 cv .CONDITIONS_SCHEMA ,
1040- condition . async_validate_conditions_config ,
1039+ async_validate_conditions_config ,
10411040 ),
10421041 ("actions" , cv .SCRIPT_SCHEMA , script .async_validate_actions_config ),
10431042 ):
0 commit comments