Skip to content

Colota - Android GPS Location tracker

refactor: remove redundant Home Assistant API template

Max Dietrich808483737e41
diff --git a/apps/mobile/src/types/__tests__/defaults.test.ts b/apps/mobile/src/types/__tests__/defaults.test.ts
index afe100ca..1af64828 100644
--- a/apps/mobile/src/types/__tests__/defaults.test.ts
+++ b/apps/mobile/src/types/__tests__/defaults.test.ts
@@ -125,15 +125,7 @@ describe("TRACKING_PRESETS", () => {
})
describe("API_TEMPLATES", () => {
- const templateNames = [
- "dawarich",
- "geopulse",
- "homeassistant",
- "owntracks",
- "phonetrack",
- "reitti",
- "traccar"
- ] as const
+ const templateNames = ["dawarich", "geopulse", "owntracks", "phonetrack", "reitti", "traccar"] as const
it.each(templateNames)("%s has valid fieldMap with required keys", (name) => {
const template = API_TEMPLATES[name]
@@ -142,14 +134,7 @@ describe("API_TEMPLATES", () => {
expect(template.fieldMap).toHaveProperty("acc")
})
- const templatesWithCustomFields = [
- "dawarich",
- "homeassistant",
- "owntracks",
- "phonetrack",
- "reitti",
- "traccar"
- ] as const
+ const templatesWithCustomFields = ["dawarich", "owntracks", "phonetrack", "reitti", "traccar"] as const
it.each(templatesWithCustomFields)("%s has non-empty customFields", (name) => {
expect(API_TEMPLATES[name].customFields.length).toBeGreaterThan(0)
@@ -187,12 +172,6 @@ describe("API_TEMPLATES", () => {
expect(API_TEMPLATES.traccar.httpMethod).toBe("GET")
})
- it("homeassistant uses default field names and includes tid", () => {
- expect(API_TEMPLATES.homeassistant.fieldMap.lat).toBe("lat")
- expect(API_TEMPLATES.homeassistant.fieldMap.lon).toBe("lon")
- expect(API_TEMPLATES.homeassistant.customFields).toEqual([{ key: "tid", value: "colota" }])
- })
-
it("traccar maps fields for OsmAnd protocol", () => {
expect(API_TEMPLATES.traccar.fieldMap.acc).toBe("accuracy")
expect(API_TEMPLATES.traccar.fieldMap.alt).toBe("altitude")
diff --git a/apps/mobile/src/types/global.ts b/apps/mobile/src/types/global.ts
index 928ebe50..afa3063d 100644
--- a/apps/mobile/src/types/global.ts
+++ b/apps/mobile/src/types/global.ts
@@ -103,15 +103,7 @@ export type HttpMethod = "POST" | "GET"
export type SyncCondition = "any" | "wifi_any" | "wifi_ssid" | "vpn"
-export type ApiTemplateName =
- | "custom"
- | "dawarich"
- | "geopulse"
- | "homeassistant"
- | "owntracks"
- | "phonetrack"
- | "reitti"
- | "traccar"
+export type ApiTemplateName = "custom" | "dawarich" | "geopulse" | "owntracks" | "phonetrack" | "reitti" | "traccar"
export interface ApiTemplate {
name: ApiTemplateName
@@ -140,23 +132,6 @@ export const API_TEMPLATES: Record<Exclude<ApiTemplateName, "custom">, ApiTempla
},
customFields: []
},
- homeassistant: {
- name: "homeassistant",
- label: "Home Assistant",
- description: "Colota webhook for Home Assistant",
- fieldMap: {
- lat: "lat",
- lon: "lon",
- acc: "acc",
- alt: "alt",
- vel: "vel",
- batt: "batt",
- bs: "bs",
- tst: "tst",
- bear: "bear"
- },
- customFields: [{ key: "tid", value: "colota" }]
- },
dawarich: {
name: "dawarich",
label: "Dawarich",
diff --git a/apps/mobile/src/utils/__tests__/healthCheck.test.ts b/apps/mobile/src/utils/__tests__/healthCheck.test.ts
index 1b8f716e..287bd112 100644
--- a/apps/mobile/src/utils/__tests__/healthCheck.test.ts
+++ b/apps/mobile/src/utils/__tests__/healthCheck.test.ts
@@ -43,12 +43,6 @@ describe("resolveHealthUrls", () => {
])
})
- it("homeassistant: uses webhook URL directly (server returns 405 which counts as reachable)", () => {
- expect(resolveHealthUrls("http://192.168.50.186:8123/api/webhook/abc123", "homeassistant")).toEqual([
- "http://192.168.50.186:8123/api/webhook/abc123"
- ])
- })
-
it("custom: tries /health then origin regardless of endpoint path", () => {
expect(resolveHealthUrls("https://custom.example.com/track", "custom")).toEqual([
"https://custom.example.com/health",
diff --git a/apps/mobile/src/utils/healthCheck.ts b/apps/mobile/src/utils/healthCheck.ts
index 6f00b753..93672d68 100644
--- a/apps/mobile/src/utils/healthCheck.ts
+++ b/apps/mobile/src/utils/healthCheck.ts
@@ -18,9 +18,6 @@ export function resolveHealthUrls(endpoint: string, apiTemplate: ApiTemplateName
}
case "dawarich":
return [`${origin}/api/v1/health`, origin]
- case "homeassistant":
- // HEAD request to the webhook URL itself to confirm reachability
- return [endpoint]
case "owntracks":
// /api/0/version for OwnTracks Recorder; Home Assistant responds at root if that 404s
return [`${origin}/api/0/version`, origin]