Skip to content

Commit 7a2a322

Browse files
committed
Incorrect function was being called.
1 parent 95d08e3 commit 7a2a322

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/services/alerts/register.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { Data, DataToSend, DeviceListItem } from "@tago-io/sdk/lib/types";
33

44
import { parseTagoObject } from "../../lib/data.logic";
55
import { fetchDeviceList } from "../../lib/fetch-device-list";
6-
import { getDashboardByTagID } from "../../lib/find-resource";
6+
import { getAnalysisByTagID } from "../../lib/find-resource";
77
import { RouterConstructorData } from "../../types";
88
import { checkInAlertSet } from "./check-in-alerts";
99
import { geofenceAlertCreate } from "./geofence-alert";
@@ -154,6 +154,7 @@ async function createAlert({ environment, scope }: RouterConstructorData) {
154154
if (!environment || !scope) {
155155
throw new Error("Missing parameters");
156156
}
157+
const resources = new Resources({ token: environment.ACCOUNT_TOKEN });
157158
const organization_id = scope[0].device;
158159
await Resources.devices.sendDeviceData(organization_id, { variable: "action_validation", value: "#VAL.CREATING_ALERT#", metadata: { type: "warning" } });
159160

@@ -221,7 +222,7 @@ async function createAlert({ environment, scope }: RouterConstructorData) {
221222
device_list = await getGroupDevices(group_id, groupKey);
222223
}
223224

224-
const script_id = await getDashboardByTagID("alertTrigger");
225+
const script_id = await getAnalysisByTagID(resources, "alertTrigger");
225226

226227
if (!action_sendto?.value) {
227228
throw "Missing action_sendto";

0 commit comments

Comments
 (0)