File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -118,6 +118,11 @@ def run_action(action, driver_instance):
118118
119119 Returns the result value from the action.
120120 """
121+ # Run optional setup steps before the main action
122+ for step in action .get ("setup" , []):
123+ method = getattr (driver_instance , step ["method" ])
124+ method (* step .get ("args" , []))
125+
121126 action_type = action ["action" ]
122127
123128 if action_type == "call" :
Original file line number Diff line number Diff line change @@ -85,6 +85,30 @@ tests:
8585 expect_not_none : true
8686 mode : [mock, hardware]
8787
88+ - name : " Auto-trigger temperature after poweroff"
89+ action : call
90+ setup :
91+ - method : poweroff
92+ method : temperature
93+ expect_not_none : true
94+ mode : [mock]
95+
96+ - name : " Auto-trigger humidity after poweroff"
97+ action : call
98+ setup :
99+ - method : poweroff
100+ method : humidity
101+ expect_not_none : true
102+ mode : [mock]
103+
104+ - name : " Auto-trigger read after one-shot mode"
105+ action : call
106+ setup :
107+ - method : trigger_one_shot
108+ method : read
109+ expect_not_none : true
110+ mode : [mock]
111+
88112 - name : " Auto-trigger after poweroff"
89113 action : hardware_script
90114 script : |
You can’t perform that action at this time.
0 commit comments