Skip to content
Download

Geofence

Starts when the device enters, exits or dwells inside a circular area, or once it has been away from one for a while.

A trigger in the Location group. Its type is trigger.geofence.

Port Label Flow Type
out out execution out
event Event data out Object{triggerNodeId: String, transition: String, latitude: Double, longitude: Double, accuracyMeters: Float, timestamp: DateTime}
Field Key Default Notes
Place placeId chosen from GEOFENCE_PLACE
On enter onEnter true
On exit onExit false
On dwell onDwell false
Dwell delay (ms) dwellDelayMs 30000 shown when onDwell is true
On staying away onAway false
Away for (minutes) awayMinutes 30 shown when onAway is true
  • location access
  • location access set to “Allow all the time”

A missing permission is flagged in the editor rather than blocking the macro — the graph is fine, the phone is not, and granting it starts the node working with no edit here at all.

Geofence starts a workflow when the phone crosses the edge of a saved circular area, such as home or the office. It can also fire after you have been inside one for a while, or away from one for a while.

  • The area comes from the places library. The node only points at it.
  • Four switches decide which crossings it listens for.
  • Android watches the circle and reports enter, exit and dwell.
  • Away is this app’s own timer, started when you leave.
  • Only the switches you turn on are registered.
  • The transition field of event says which of the four fired.
  • On enter fires as you cross in. It is the only switch that starts on.
  • On exit fires as you cross out.
  • On dwell fires after Dwell delay, which defaults to 30 seconds. Use it to tell “arrived” from “drove past”.
  • On staying away fires after Away for minutes, which default to 30. Exit is the moment of leaving; away is the state of having been gone a while.

Note: with all four switched off the node registers nothing and can never fire. The editor warns about it.

Location access is the obvious grant. Location access set to “Allow all the time” is a second one, is not offered in the first dialog on modern Android, and has to be turned on in Settings.

Without it the geofence is never registered. Nothing crashes and nothing is logged, so it looks identical to a geofence that is waiting. That is why the node badges itself in the Problems panel.

  • Save a place called Home in the places library.
  • Point Place at it and leave On enter on.
  • Wire out to the light action.

Explanation:

  • To catch arriving rather than driving past, switch On enter off and On dwell on.
  • Moving house means editing the place once. Every macro that references it follows.
  • Arming a macro while the phone is already inside the area fires On enter at once.
  • Android trades promptness against battery, so expect a lag of up to a couple of minutes.
  • Pick a radius comfortably larger than the accuracy in the event. A hundred metres is usually the smallest that behaves.
  • The away event carries no position. Its latitude, longitude and accuracyMeters are empty.