Trail-Sense icon indicating copy to clipboard operation
Trail-Sense copied to clipboard

[Tracking Issue] Automations (Triggers, Actions)

Open kylecorry31 opened this issue 1 year ago • 3 comments

While writing up #2157 I thought it may be useful to let the user trigger behaviors for other things such as time of day, location (geofence), distance travelled, etc. This could also be the foundation of a generic alert mechanism (#1915, #719, #647).

This could be a tasker/IFTTT like feature where the user specifies the trigger and a list of actions that should occur.

This ticket will be focused on converting existing features to automations and not be user facing. After this is implemented, a new ticket can be created for allowing a user facing tool for automations.

Triggers

  • [ ] Sunrise/set/noon (type and offset)
  • [ ] Time
  • [ ] Timer (countdown)
  • [ ] Tide level (high, low, tide table)
  • [ ] Geofence (enter, exit)
  • [x] Power saving mode (enabled, disabled)
  • [ ] Device battery is low
  • [ ] Device charging state (start charging, stop charging)
  • [x] Backtrack (enabled, disabled)
  • [x] Weather monitor (enabled, disabled)
  • [x] Sunset alerts (enabled, disabled)
  • [x] Pedometer (enabled, disabled)
  • [ ] Astronomy event (meteor shower, eclipse)
  • [ ] Distance travelled (currently the distance alert - specify source?)
  • [ ] Cell signal state changed (established or lost - from backtrack)
  • [ ] Weather forecast changed (choose weather conditions)
  • [ ] Weather alert changed (storm, cold, hot)
  • [ ] Bluetooth (connect, disconnect - if bluetooth permission is added)

All triggers have the ability to repeat on the next occurrence (indefinitely). Triggers also can send data to the actions (type: number, text, datetime, boolean)

Actions (multiple allowed - executed in sequence):

  • [ ] Set a trigger (ex. timer)
  • [x] Resume/pause backtrack
  • [ ] Enable/disable backtrack
  • [ ] Change backtrack frequency
  • [x] Resume/pause weather monitor
  • [ ] Enable/disable weather monitor
  • [ ] Change weather monitor frequency
  • [x] Resume/pause pedometer
  • [ ] Enable/disable pedometer
  • [ ] Send notification (type, title, body, icon - some of these will not be user changeable)
  • [ ] Change power saving mode state (enable, disable)
  • [ ] Sound off alarm (need a way to specify this in the trigger for the time based ones so they can be scheduled accordingly)
  • [ ] Cancel a trigger
  • [ ] Create a beacon
  • [ ] Record/update a note

Other features

  • [ ] Inverse automations (each trigger and action can specify an inverse - ex. resume and pause)

There will be premade triggers/actions for the existing ones in TS (sunset alert, distance alert, storm alert, daily weather, etc) that can't be deleted but can be enabled/disabled.

Actions should also have access to some data points regardless of what triggers them such as current time, current/daily weather (with the time of the forecast), total distance travelled, current astronomy times/events, etc (come up with a list)

kylecorry31 avatar Jan 13 '24 16:01 kylecorry31

Even if the first iterations aren't user facing, this would be nice to have from a development perspective.

A broadcast receiver that takes in an action ID and executes the associated action(s).

kylecorry31 avatar Jan 13 '24 17:01 kylecorry31

If you add Bluetooth permissions in the future, connect/disconnect of devices would also be a good trigger, #1223. If you don't want to add permissions, that's also reasonable.

michaelblyons avatar Jan 13 '24 18:01 michaelblyons

Good idea, thanks!

kylecorry31 avatar Jan 13 '24 20:01 kylecorry31