Garmin LiveTrack tracking package 🗺️

Did ju change the setting in IMAP config to fetch first 9200 bytes?

hi
i solved it. it works now buyt need to check some errors. my map froze after a couple of minutes. .

Dennis

Hi all and especially @fatuuse, congrats!
I’ve followed all the steps and I believe it’s nearly working, however there might be some issues related to the most recent ways that YAML is written in HA… I’m not an expert, but:

  • I get an email event with details, so IMAP with search works
  • All sensors show up but no sensors get updated upon receiving an email and getting the IMAP event
  • When I check the garmin_livetrack.yaml in VS I get a few error highlights related to “LEGACY_SYNTAX”, screenshot below

Any way how to fix this? I’m asking because it feel I would go in the wrong direction if I did it myself, as for example for platform: state it says to instead use trigger: calendar, which seems far-fetched.

update I checked the automation and while it did receive input there are a few errors especially on the timestamps, but even without the timestamps it should still populate the sensors, shouldn’t it?

>
{
  "trace": {
    "last_step": "action/3/repeat/until/0/conditions/3",
    "run_id": "6e36226a2718c3fdba23e9f95374c99d",
    "state": "stopped",
    "script_execution": "finished",
    "timestamp": {
      "start": "2025-04-08T13:33:10.668369+00:00",
      "finish": "2025-04-08T13:41:42.067694+00:00"
    },
    "domain": "automation",
    "item_id": "garmin_livetrack",
    "trigger": "state of sensor.garmin_livetrack_id",
    "trace": {
      "trigger/0": [
        {
          "path": "trigger/0",
          "timestamp": "2025-04-08T13:33:10.668607+00:00",
          "changed_variables": {
            "this": {
              "entity_id": "automation.garmin_livetrack_new_link",
              "state": "on",
              "attributes": {
                "id": "garmin_livetrack",
                "last_triggered": "2025-04-08T13:23:11.235961+00:00",
                "mode": "restart",
                "current": 0,
                "friendly_name": "Garmin LiveTrack new link"
              },
              "last_changed": "2025-04-08T13:31:47.395671+00:00",
              "last_reported": "2025-04-08T13:31:47.395671+00:00",
              "last_updated": "2025-04-08T13:31:47.395671+00:00",
              "context": {
                "id": "01JRASK3T361N28F9VFSX0DRFS",
                "parent_id": null,
                "user_id": null
              }
            },
            "trigger": {
              "id": "0",
              "idx": "0",
              "alias": null,
              "platform": "state",
              "entity_id": "sensor.garmin_livetrack_id",
              "from_state": {
                "entity_id": "sensor.garmin_livetrack_id",
                "state": "unknown",
                "attributes": {
                  "icon": "mdi:map",
                  "friendly_name": "Garmin LiveTrack id"
                },
                "last_changed": "2025-04-08T13:31:38.306108+00:00",
                "last_reported": "2025-04-08T13:31:38.306108+00:00",
                "last_updated": "2025-04-08T13:31:38.306108+00:00",
                "context": {
                  "id": "01JRASJTY2QE9TFZSQFBTSJ7D5",
                  "parent_id": null,
                  "user_id": null
                }
              },
              "to_state": {
                "entity_id": "sensor.garmin_livetrack_id",
                "state": "unavailable",
                "attributes": {
                  "link": "unavailable/token/",
                  "data_link": "https://livetrack.garmin.com/services/session/unavailable/trackpoints",
                  "session": "",
                  "token": "",
                  "icon": "mdi:map",
                  "friendly_name": "Garmin LiveTrack id"
                },
                "last_changed": "2025-04-08T13:33:10.665533+00:00",
                "last_reported": "2025-04-08T13:33:10.665533+00:00",
                "last_updated": "2025-04-08T13:33:10.665533+00:00",
                "context": {
                  "id": "01JRASNN26ARHBE1FGBTDCTARM",
                  "parent_id": null,
                  "user_id": null
                }
              },
              "for": null,
              "attribute": null,
              "description": "state of sensor.garmin_livetrack_id"
            }
          }
        }
      ],
      "condition/0": [
        {
          "path": "condition/0",
          "timestamp": "2025-04-08T13:33:10.668798+00:00",
          "result": {
            "result": true,
            "entities": []
          }
        }
      ],
      "condition/1": [
        {
          "path": "condition/1",
          "timestamp": "2025-04-08T13:33:10.669988+00:00",
          "result": {
            "result": true,
            "entities": []
          }
        }
      ],
      "condition/2": [
        {
          "path": "condition/2",
          "timestamp": "2025-04-08T13:33:10.671374+00:00",
          "result": {
            "result": true,
            "entities": []
          }
        }
      ],
      "action/0": [
        {
          "path": "action/0",
          "timestamp": "2025-04-08T13:33:10.680526+00:00",
          "changed_variables": {
            "context": {
              "id": "01JRASNN4CZN1R3NHEJ44Q9A54",
              "parent_id": "01JRASNN26ARHBE1FGBTDCTARM",
              "user_id": null
            },
            "update_min": 2
          }
        }
      ],
      "action/1": [
        {
          "path": "action/1",
          "timestamp": "2025-04-08T13:33:10.688692+00:00",
          "result": {
            "params": {
              "domain": "notify",
              "service": "mobile_app_fairphone",
              "service_data": {
                "title": "Garmin LiveTrack",
                "message": "Start",
                "data": {
                  "group": "Garmin",
                  "tag": "garmin_livetrack",
                  "clickAction": "entityId:binary_sensor.garmin_livetrack",
                  "timeout": 180,
                  "notification_icon": "mdi:run-fast",
                  "actions": [
                    {
                      "action": "URI",
                      "uri": "unavailable/token/",
                      "title": "Show Garmin livetrack"
                    }
                  ]
                }
              },
              "target": {}
            },
            "running_script": false
          }
        }
      ],
      "action/2": [
        {
          "path": "action/2",
          "timestamp": "2025-04-08T13:33:11.099850+00:00"
        }
      ],
      "action/2/repeat/sequence/0": [
        {
          "path": "action/2/repeat/sequence/0",
          "timestamp": "2025-04-08T13:33:11.101234+00:00",
          "changed_variables": {
            "repeat": {
              "first": true,
              "index": 1
            }
          },
          "result": {
            "params": {
              "domain": "homeassistant",
              "service": "update_entity",
              "service_data": {},
              "target": {
                "entity_id": [
                  "sensor.garmin_livetrack"
                ]
              }
            },
            "running_script": false
          }
        }
      ],
      "action/2/repeat/sequence/1": [
        {
          "path": "action/2/repeat/sequence/1",
          "timestamp": "2025-04-08T13:33:11.103270+00:00",
          "result": {
            "delay": 15,
            "done": true
          }
        }
      ],
      "action/2/repeat": [
        {
          "path": "action/2/repeat",
          "timestamp": "2025-04-08T13:33:26.117867+00:00",
          "changed_variables": {
            "repeat": {
              "first": true,
              "index": 1
            }
          },
          "result": {
            "result": null
          }
        }
      ],
      "action/2/repeat/until/0": [
        {
          "path": "action/2/repeat/until/0",
          "timestamp": "2025-04-08T13:33:26.118295+00:00",
          "error": "In 'or' (item 1 of 2):\n  In 'template' condition: ValueError: Template error: as_timestamp got invalid input 'unknown' when rendering template '{{ (as_timestamp(states('sensor.garmin_livetrack')) | int(0) ) > 0 }}' but no default was specified"
        }
      ],
      "action/2/repeat/until/0/conditions/0": [
        {
          "path": "action/2/repeat/until/0/conditions/0",
          "timestamp": "2025-04-08T13:33:26.118608+00:00",
          "error": "In 'template' condition: ValueError: Template error: as_timestamp got invalid input 'unknown' when rendering template '{{ (as_timestamp(states('sensor.garmin_livetrack')) | int(0) ) > 0 }}' but no default was specified"
        }
      ],
      "action/2/repeat/until/0/conditions/1": [
        {
          "path": "action/2/repeat/until/0/conditions/1",
          "timestamp": "2025-04-08T13:33:26.125383+00:00",
          "result": {
            "result": false,
            "entities": []
          }
        }
      ],
      "action/3": [
        {
          "path": "action/3",
          "timestamp": "2025-04-08T13:33:26.127858+00:00"
        }
      ],
      "action/3/repeat/sequence/0": [
        {
          "path": "action/3/repeat/sequence/0",
          "timestamp": "2025-04-08T13:33:26.129856+00:00",
          "changed_variables": {
            "repeat": {
              "first": true,
              "index": 1
            }
          },
          "result": {
            "params": {
              "domain": "homeassistant",
              "service": "update_entity",
              "service_data": {},
              "target": {
                "entity_id": [
                  "sensor.garmin_livetrack"
                ]
              }
            },
            "running_script": false
          }
        },
        {
          "path": "action/3/repeat/sequence/0",
          "timestamp": "2025-04-08T13:35:26.144477+00:00",
          "changed_variables": {
            "repeat": {
              "first": false,
              "index": 2
            }
          },
          "result": {
            "params": {
              "domain": "homeassistant",
              "service": "update_entity",
              "service_data": {},
              "target": {
                "entity_id": [
                  "sensor.garmin_livetrack"
                ]
              }
            },
            "running_script": false
          }
        },
        {
          "path": "action/3/repeat/sequence/0",
          "timestamp": "2025-04-08T13:37:26.158514+00:00",
          "changed_variables": {
            "repeat": {
              "first": false,
              "index": 3
            }
          },
          "result": {
            "params": {
              "domain": "homeassistant",
              "service": "update_entity",
              "service_data": {},
              "target": {
                "entity_id": [
                  "sensor.garmin_livetrack"
                ]
              }
            },
            "running_script": false
          }
        },
        {
          "path": "action/3/repeat/sequence/0",
          "timestamp": "2025-04-08T13:39:26.170375+00:00",
          "changed_variables": {
            "repeat": {
              "first": false,
              "index": 4
            }
          },
          "result": {
            "params": {
              "domain": "homeassistant",
              "service": "update_entity",
              "service_data": {},
              "target": {
                "entity_id": [
                  "sensor.garmin_livetrack"
                ]
              }
            },
            "running_script": false
          }
        },
        {
          "path": "action/3/repeat/sequence/0",
          "timestamp": "2025-04-08T13:41:26.183456+00:00",
          "changed_variables": {
            "repeat": {
              "first": false,
              "index": 5
            }
          },
          "result": {
            "params": {
              "domain": "homeassistant",
              "service": "update_entity",
              "service_data": {},
              "target": {
                "entity_id": [
                  "sensor.garmin_livetrack"
                ]
              }
            },
            "running_script": false
          }
        }
      ],
      "action/3/repeat/sequence/1": [
        {
          "path": "action/3/repeat/sequence/1",
          "timestamp": "2025-04-08T13:33:26.132702+00:00",
          "result": {
            "delay": 120,
            "done": true
          }
        },
        {
          "path": "action/3/repeat/sequence/1",
          "timestamp": "2025-04-08T13:35:26.146739+00:00",
          "result": {
            "delay": 120,
            "done": true
          }
        },
        {
          "path": "action/3/repeat/sequence/1",
          "timestamp": "2025-04-08T13:37:26.160729+00:00",
          "result": {
            "delay": 120,
            "done": true
          }
        },
        {
          "path": "action/3/repeat/sequence/1",
          "timestamp": "2025-04-08T13:39:26.173272+00:00",
          "result": {
            "delay": 120,
            "done": true
          }
        },
        {
          "path": "action/3/repeat/sequence/1",
          "timestamp": "2025-04-08T13:41:26.191772+00:00",
          "result": {
            "delay": 120,
            "done": false
          }
        }
      ],
      "action/3/repeat": [
        {
          "path": "action/3/repeat",
          "timestamp": "2025-04-08T13:35:26.138222+00:00",
          "changed_variables": {
            "repeat": {
              "first": true,
              "index": 1
            }
          },
          "result": {
            "result": false
          }
        },
        {
          "path": "action/3/repeat",
          "timestamp": "2025-04-08T13:37:26.149852+00:00",
          "changed_variables": {
            "repeat": {
              "first": false,
              "index": 2
            }
          },
          "result": {
            "result": false
          }
        },
        {
          "path": "action/3/repeat",
          "timestamp": "2025-04-08T13:39:26.163757+00:00",
          "changed_variables": {
            "repeat": {
              "first": false,
              "index": 3
            }
          },
          "result": {
            "result": false
          }
        },
        {
          "path": "action/3/repeat",
          "timestamp": "2025-04-08T13:41:26.177121+00:00",
          "changed_variables": {
            "repeat": {
              "first": false,
              "index": 4
            }
          },
          "result": {
            "result": false
          }
        }
      ],
      "action/3/repeat/until/0": [
        {
          "path": "action/3/repeat/until/0",
          "timestamp": "2025-04-08T13:35:26.138555+00:00",
          "result": {
            "result": false
          }
        },
        {
          "path": "action/3/repeat/until/0",
          "timestamp": "2025-04-08T13:37:26.150127+00:00",
          "result": {
            "result": false
          }
        },
        {
          "path": "action/3/repeat/until/0",
          "timestamp": "2025-04-08T13:39:26.164164+00:00",
          "result": {
            "result": false
          }
        },
        {
          "path": "action/3/repeat/until/0",
          "timestamp": "2025-04-08T13:41:26.177497+00:00",
          "result": {
            "result": false
          }
        }
      ],
      "action/3/repeat/until/0/conditions/0": [
        {
          "path": "action/3/repeat/until/0/conditions/0",
          "timestamp": "2025-04-08T13:35:26.138758+00:00",
          "result": {
            "result": false,
            "entities": [
              "sensor.garmin_livetrack"
            ]
          }
        },
        {
          "path": "action/3/repeat/until/0/conditions/0",
          "timestamp": "2025-04-08T13:37:26.150328+00:00",
          "result": {
            "result": false,
            "entities": [
              "sensor.garmin_livetrack"
            ]
          }
        },
        {
          "path": "action/3/repeat/until/0/conditions/0",
          "timestamp": "2025-04-08T13:39:26.164490+00:00",
          "result": {
            "result": false,
            "entities": [
              "sensor.garmin_livetrack"
            ]
          }
        },
        {
          "path": "action/3/repeat/until/0/conditions/0",
          "timestamp": "2025-04-08T13:41:26.177723+00:00",
          "result": {
            "result": false,
            "entities": [
              "sensor.garmin_livetrack"
            ]
          }
        }
      ],
      "action/3/repeat/until/0/conditions/1": [
        {
          "path": "action/3/repeat/until/0/conditions/1",
          "timestamp": "2025-04-08T13:35:26.140407+00:00",
          "result": {
            "result": false,
            "entities": [
              "sensor.garmin_livetrack"
            ]
          }
        },
        {
          "path": "action/3/repeat/until/0/conditions/1",
          "timestamp": "2025-04-08T13:37:26.151885+00:00",
          "result": {
            "result": false,
            "entities": [
              "sensor.garmin_livetrack"
            ]
          }
        },
        {
          "path": "action/3/repeat/until/0/conditions/1",
          "timestamp": "2025-04-08T13:39:26.166170+00:00",
          "result": {
            "result": false,
            "entities": [
              "sensor.garmin_livetrack"
            ]
          }
        },
        {
          "path": "action/3/repeat/until/0/conditions/1",
          "timestamp": "2025-04-08T13:41:26.179337+00:00",
          "result": {
            "result": false,
            "entities": [
              "sensor.garmin_livetrack"
            ]
          }
        }
      ],
      "action/3/repeat/until/0/conditions/2": [
        {
          "path": "action/3/repeat/until/0/conditions/2",
          "timestamp": "2025-04-08T13:35:26.141768+00:00",
          "result": {
            "result": false,
            "entities": [
              "sensor.garmin_livetrack_id"
            ]
          }
        },
        {
          "path": "action/3/repeat/until/0/conditions/2",
          "timestamp": "2025-04-08T13:37:26.155174+00:00",
          "result": {
            "result": false,
            "entities": [
              "sensor.garmin_livetrack_id"
            ]
          }
        },
        {
          "path": "action/3/repeat/until/0/conditions/2",
          "timestamp": "2025-04-08T13:39:26.167542+00:00",
          "result": {
            "result": false,
            "entities": [
              "sensor.garmin_livetrack_id"
            ]
          }
        },
        {
          "path": "action/3/repeat/until/0/conditions/2",
          "timestamp": "2025-04-08T13:41:26.180531+00:00",
          "result": {
            "result": false,
            "entities": [
              "sensor.garmin_livetrack_id"
            ]
          }
        }
      ],
      "action/3/repeat/until/0/conditions/3": [
        {
          "path": "action/3/repeat/until/0/conditions/3",
          "timestamp": "2025-04-08T13:35:26.142719+00:00",
          "result": {
            "result": false,
            "entities": []
          }
        },
        {
          "path": "action/3/repeat/until/0/conditions/3",
          "timestamp": "2025-04-08T13:37:26.156078+00:00",
          "result": {
            "result": false,
            "entities": []
          }
        },
        {
          "path": "action/3/repeat/until/0/conditions/3",
          "timestamp": "2025-04-08T13:39:26.168587+00:00",
          "result": {
            "result": false,
            "entities": []
          }
        },
        {
          "path": "action/3/repeat/until/0/conditions/3",
          "timestamp": "2025-04-08T13:41:26.181656+00:00",
          "result": {
            "result": false,
            "entities": []
          }
        }
      ]
    },
    "config": {
      "alias": "Garmin LiveTrack new link",
      "id": "garmin_livetrack",
      "mode": "restart",
      "trigger": [
        {
          "platform": "state",
          "entity_id": "sensor.garmin_livetrack_id"
        }
      ],
      "condition": [
        {
          "condition": "template",
          "value_template": "{{ trigger.to_state.state != '' }}"
        },
        {
          "condition": "template",
          "value_template": "{{ trigger.to_state.state != 'unknown' }}"
        },
        {
          "condition": "template",
          "value_template": "{{ trigger.from_state.state != trigger.to_state.state }}"
        }
      ],
      "action": [
        {
          "variables": {
            "update_min": 2
          }
        },
        {
          "alias": "Notify start",
          "data": {
            "title": "Garmin LiveTrack",
            "message": "Start",
            "data": {
              "group": "Garmin",
              "tag": "garmin_livetrack",
              "clickAction": "entityId:binary_sensor.garmin_livetrack",
              "timeout": 180,
              "notification_icon": "mdi:run-fast",
              "actions": [
                {
                  "action": "URI",
                  "uri": "{{ state_attr('sensor.garmin_livetrack_id','link') }}",
                  "title": "Show Garmin livetrack"
                }
              ]
            }
          },
          "action": "notify.mobile_app_fairphone"
        },
        {
          "repeat": {
            "until": [
              {
                "condition": "or",
                "conditions": [
                  {
                    "condition": "template",
                    "value_template": "{{ (as_timestamp(states('sensor.garmin_livetrack')) | int(0) ) > 0 }}"
                  },
                  {
                    "condition": "template",
                    "value_template": "{{ repeat.index >= 10 }}"
                  }
                ]
              }
            ],
            "sequence": [
              {
                "entity_id": "sensor.garmin_livetrack",
                "action": "homeassistant.update_entity"
              },
              {
                "delay": "00:00:15"
              }
            ]
          }
        },
        {
          "repeat": {
            "until": [
              {
                "condition": "or",
                "conditions": [
                  {
                    "condition": "template",
                    "value_template": "{{ 'END' in states.sensor.garmin_livetrack.attributes.fitnessPointData.eventTypes if 'fitnessPointData' in states.sensor.garmin_livetrack.attributes else false }}"
                  },
                  {
                    "condition": "template",
                    "value_template": "{{ as_timestamp(now())-int(as_timestamp(states('sensor.garmin_livetrack'),as_timestamp(now())) ) > 60*30 }}"
                  },
                  {
                    "condition": "template",
                    "value_template": "{{ trigger.to_state.state != states('sensor.garmin_livetrack_id') }}"
                  },
                  {
                    "condition": "template",
                    "value_template": "{{ repeat.index > (11*60/update_min) }}"
                  }
                ]
              }
            ],
            "sequence": [
              {
                "entity_id": "sensor.garmin_livetrack",
                "action": "homeassistant.update_entity"
              },
              {
                "delay": {
                  "minutes": "{{ update_min }}"
                }
              }
            ]
          }
        },
        {
          "alias": "Notify end",
          "data": {
            "title": "Garmin Livetrack",
            "message": "End!\n{{ state_attr('binary_sensor.garmin_livetrack','duration') }}\n{{ state_attr('binary_sensor.garmin_livetrack','distance') }}\n{{ state_attr('binary_sensor.garmin_livetrack','activity') }}\n{{ state_attr('binary_sensor.garmin_livetrack','event') }}\n",
            "data": {
              "group": "Garmin",
              "tag": "garmin_livetrack",
              "clickAction": "entityId:binary_sensor.garmin_livetrack",
              "timeout": 300,
              "notification_icon": "mdi:stop-circle",
              "actions": [
                {
                  "action": "URI",
                  "uri": "{{ state_attr('sensor.garmin_livetrack_id','link') }}"
                }
              ]
            }
          },
          "action": "notify.mobile_app_fairphone"
        }
      ]
    },
    "blueprint_inputs": null,
    "context": {
      "id": "01JRASNN4CZN1R3NHEJ44Q9A54",
      "parent_id": "01JRASNN26ARHBE1FGBTDCTARM",
      "user_id": null
    }
  },
  "logbookEntries": [
    {
      "name": "Garmin LiveTrack new link",
      "message": "triggered by state of sensor.garmin_livetrack_id",
      "source": "state of sensor.garmin_livetrack_id",
      "entity_id": "automation.garmin_livetrack_new_link",
      "context_id": "01JRASNN4CZN1R3NHEJ44Q9A54",
      "domain": "automation",
      "when": 1744119190.6784537
    }
  ]
}

I would say that the current syntax is right.

From your debug, the session id is missing. Something in the regex from IMAP maybe.

Try to copy the link in the mail and put it in the input_text.garmin_livetrack_link text-box. And then look att the sensor sensor.garmin_livetrack_id has all attributes right, session and token.