| id: "dynamic_switch_alarm" |
| name: "Dynamically switch the alarm" |
| description: "Switch the alarm according to the weather" |
|
|
| setup_steps: { |
| adb_call: { rotate: { orientation: PORTRAIT_0 } } |
| } |
|
|
| reset_steps: [ |
| { adb_call: { force_stop: { package_name: "com.google.android.deskclock" } } }, |
| { adb_call: { force_stop: { package_name: "mobi.lockdown.weather" } } }, |
| { adb_call: { press_button: { button: HOME } } }, |
| { |
| adb_call: { |
| start_activity: { |
| full_activity: "mobi.lockdown.weather/mobi.lockdown.weather.activity.SplashActivity" |
| } |
| } |
| success_condition: { |
| wait_for_app_screen: { |
| app_screen: { |
| activity: "mobi.lockdown.weather/mobi.lockdown.weather.activity.SplashActivity" |
| } |
| timeout_sec: 10.0 |
| } |
| num_retries: 3 |
| } |
| } |
| ] |
|
|
| event_sources: { |
| view_hierarchy_event: { |
| selector: '#"mobi.lockdown.weather:id/day1" #$"tvPop"' |
| properties: { |
| property_name: "text" |
| pattern: "[1-6]?\\d%" |
| } |
| } |
| id: 1 |
| } |
| event_sources: { |
| view_hierarchy_event: { |
| selector: '#"mobi.lockdown.weather:id/day1" #$"tvPop"' |
| properties: { |
| property_name: "text" |
| pattern: "(?:[7-9]?\\d|100)%" |
| } |
| } |
| id: 2 |
| } |
| event_sources: { |
| view_hierarchy_event: { |
| selector: '#"com.google.android.deskclock:id/digital_clock"[text="8:00\xe2\x80\x8aAM"]+#$"onoff".$"Switch"' |
| properties: { |
| property_name: "text" |
| pattern: "ON" |
| } |
| properties: { |
| property_name: "checked" |
| pattern: "true" |
| } |
| } |
| id: 3 |
| } |
| event_sources: { |
| view_hierarchy_event: { |
| selector: '#"com.google.android.deskclock:id/digital_clock"[text="8:00\xe2\x80\x8aAM"]+#$"onoff".$"Switch"' |
| properties: { |
| property_name: "text" |
| pattern: "OFF" |
| } |
| properties: { |
| property_name: "checked" |
| pattern: "false" |
| } |
| } |
| id: 4 |
| } |
|
|
| event_slots: { |
| reward_listener: { |
| type: OR |
| events: { |
| event: { |
| id: 5 |
| events: { id: 1 } |
| transformation: "y = 0" |
| } |
| } |
| events: { |
| event: { |
| id: 6 |
| events: { id: 2 } |
| transformation: "y = 0" |
| } |
| } |
| events: { |
| event: { |
| id: 7 |
| events: { id: 3 } |
| prerequisite: 5 |
| transformation: "y = 1" |
| } |
| } |
| events: { |
| event: { |
| id: 8 |
| events: { id: 4 } |
| prerequisite: 6 |
| transformation: "y = 1" |
| } |
| } |
| } |
| episode_end_listener: { |
| type: OR |
| events: [ |
| { id: 7 }, |
| { id: 8 } |
| ] |
| transformation: "y = True" |
| } |
| } |
|
|
| command: "Turn off my alarm in the morning if it will rain tomorrow, otherwise leave it on." |
|
|