Skip to content

Commit

Permalink
fixing readme and analysis
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaelsepulvedaB committed Jul 14, 2023
1 parent 500fa46 commit b4341f3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ You can just upload the `analysis.js` file.

or

You can run locally, you should have last node version and install all dependencies running `npm install` on your terminal in this project folder,
after that, you can run the project just calling analysis, `node analysis.js`;
Run it locally, you should have lastest node version and install all the dependencies by running `npm install` in your terminal in the project's directory,
after that, you can run the project by calling the analysis, `node analysis.js`;

## What this does
## What the analysis does

This analysis must run by Time Interval. It checks if devices with given Tags had communication in the past minutes. If not, it sends an email or sms alert.
This analysis must run by triggered by a Time Interval. It checks whether devices with given Tags checked in, in the past minutes. If not, it sends an email or sms alert.

This comment has been minimized.

Copy link
@Freddyminu

Freddyminu Jul 17, 2023

This analysis must be triggered by a Time Interval. It checks whether devices with given Tags checked in, in the past minutes. If not, it sends an email or sms alert.


## How to use on TagoIO
## How to use this analysis internally at TagoIO servers

In order to use this analysis, you must to add a new policy in your account and setup the Environment Variable table.<br>

Expand All @@ -25,14 +25,14 @@ Environment Variables:

4 - email_list: Email list comma separated.

5 - sms_list: Phone number list comma separated. The phone number must include the country code
5 - sms_list: Phone number list comma separated. The phone number must include the country code.


Steps to add a new policy:

1 - Click the button "Add Policy" at this url: https://admin.tago.io/am;

2 - In the Target selector, select the Analysis with the field set as "ID" and choose your Analysis in the list;
2 - In the Target selector, with the field set as "ID", choose your Analysis in the list;

3 - Click the "Click to add a new permission" element and select "Device" with the rule "Access" with the field as "Any";

Expand Down
6 changes: 2 additions & 4 deletions analysis.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
** How to use:
** To analysis works, you need to add a new policy in your account. Steps to add a new policy:
** 1 - Click the button "Add Policy" at this url: https://admin.tago.io/am;
** 2 - In the Target selector, select the Analysis with the field set as "ID" and choose your Analysis in the list;
** 2 - In the Target selector, with the field set as "ID", choose your Analysis in the list;
** 3 - Click the "Click to add a new permission" element and select "Device" with the rule "Access" with the field as "Any";
** 4 - To save your new Policy, click the save button in the bottom right corner;
*/
Expand All @@ -29,9 +29,7 @@ async function myAnalysis(context) {
// Transform all Environment Variable to JSON.
const env = Utils.envToJson(context.environment);

if (!env.account_token) {
return context.log("You must setup an account_token in the Environment Variables.");
} else if (!env.checkin_time) {
if (!env.checkin_time) {
return context.log("You must setup a checkin_time in the Environment Variables.");
} else if (!env.tag_key) {
return context.log("You must setup a tag_key in the Environment Variables.");
Expand Down

0 comments on commit b4341f3

Please sign in to comment.