https://github.com/pierregode/zaptecteamsnotifier
Send notifications of availible Zaptec chargers that are availible in your Zaptec account to Teams
https://github.com/pierregode/zaptecteamsnotifier
Last synced: 22 days ago
JSON representation
Send notifications of availible Zaptec chargers that are availible in your Zaptec account to Teams
- Host: GitHub
- URL: https://github.com/pierregode/zaptecteamsnotifier
- Owner: PierreGode
- License: gpl-3.0
- Created: 2023-10-05T09:16:23.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-10-26T14:27:38.000Z (over 2 years ago)
- Last Synced: 2025-03-02T14:23:40.505Z (over 1 year ago)
- Language: JavaScript
- Size: 86.9 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ZaptecTeamsNotifier

Send notifications of availible Zaptec chargers that are availible in your Zaptec account to Teams
[](https://ko-fi.com/J3J2EARPK)
Create a .env file: At the root of your project, create a file named .env
Clone this repository
```
https://github.com/PierreGode/ZaptecTeamsNotifier.git
```
```
cd ZaptecTeamsNotifier
```
```
npm install axios
```
```
npm install dotenv
```
```
touch .env
```
Add your secrets/configuration: Inside this file, you can set your environment variables as key-value pairs:
```
ZAPTEC_USERNAME=myUsername
ZAPTEC_PASSWORD=myPassword
TEAMS_WEBHOOK_URL=webhookUrl
COMPANY_NAME=word
```
COMPANY_NAME= comapany name or word to be removed from status eg api presents your chargers as company 01 company 02 company 03 company 04 you can remove the word company by adding it to .env COMPANY_NAME=company and the result will be 01 02 03 04
Access in code: With the help of libraries like dotenv, you can easily load these variables into your application's environment. For Node.js applications, after setting up dotenv, you can access these variables using process.env.VARIABLE_NAME.
note that it is never a good practice to store passwords in clear text on a file, this example is to get started locally.
Create a .gitignore file
```
touch .gitignore
```
Add .env to .gitignore: This is crucial. The .gitignore file tells Git which files or directories to ignore in a project. By adding .env to .gitignore, you ensure that the .env file is not committed to your repository, keeping your secrets safe. The .gitignore entry would simply look like:
```
.env
```
By doing this, even if you accidentally try to commit the .env file, Git will ignore it, ensuring that your secrets remain local and are not exposed in the remote repository.
Running the Notifier
Once you've set up the configurations, run the notifier using:
```
node node.js
```
preferably setup an @reboot sleep 60 && /usr/local/bin/node /home/pi/ZaptecSlackNotifier/node.js >> /var/log/slack.log 2>&1 in crontab
ZaptecTeamsNotifier will send notifications about a charger when it becomes available, updates are pulled every 3 minutes but notifications will not be repeated until the status is changed.
notifocation is only sent when OperatingMode == 1 and 1 = Charger is available! and OperatingMode == 3 Charger has stopped charging
Notifications are silenced after work hours 16-06 and weekends. this can be configured in config.js
//@Created By Pierre Gode