milesight-powermeter-api 0.0.2-0 → 2024.9.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +49 -46
- package/npm-shrinkwrap.json +19165 -27
- package/package.json +7 -1
- package/src/config/configurations/.gitkeep +0 -0
- package/src/config/index.ts +15 -0
- package/src/config/schema.ts +117 -0
- package/src/controller/milesight.controller.spec.ts +101 -0
- package/src/controller/milesight.controller.ts +61 -0
- package/src/dto/index.ts +1 -0
- package/src/dto/milesight.dto.ts +31 -0
- package/src/helper/initapm.ts +11 -0
- package/src/main.ts +6 -3
- package/src/modules/downlink.module.ts +8 -0
- package/src/modules/milesight-powermeter.module.ts +11 -0
- package/src/service/downlink.service.ts +66 -0
- package/src/service/milesight.service.spec.ts +113 -0
- package/src/service/milesight.service.ts +64 -0
- package/src/types.ts +0 -0
- package/timestamp.sh +1 -1
package/README.md
CHANGED
@@ -1,38 +1,43 @@
|
|
1
|
-
|
2
|
-
<a href="http://nestjs.com/" target="blank"><img src="https://nestjs.com/img/logo-small.svg" width="120" alt="Nest Logo" /></a>
|
3
|
-
</p>
|
4
|
-
|
5
|
-
[circleci-image]: https://img.shields.io/circleci/build/github/nestjs/nest/master?token=abc123def456
|
6
|
-
[circleci-url]: https://circleci.com/gh/nestjs/nest
|
7
|
-
|
8
|
-
<p align="center">A progressive <a href="http://nodejs.org" target="_blank">Node.js</a> framework for building efficient and scalable server-side applications.</p>
|
9
|
-
<p align="center">
|
10
|
-
<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/v/@nestjs/core.svg" alt="NPM Version" /></a>
|
11
|
-
<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/l/@nestjs/core.svg" alt="Package License" /></a>
|
12
|
-
<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/dm/@nestjs/common.svg" alt="NPM Downloads" /></a>
|
13
|
-
<a href="https://circleci.com/gh/nestjs/nest" target="_blank"><img src="https://img.shields.io/circleci/build/github/nestjs/nest/master" alt="CircleCI" /></a>
|
14
|
-
<a href="https://coveralls.io/github/nestjs/nest?branch=master" target="_blank"><img src="https://coveralls.io/repos/github/nestjs/nest/badge.svg?branch=master#9" alt="Coverage" /></a>
|
15
|
-
<a href="https://discord.gg/G7Qnnhy" target="_blank"><img src="https://img.shields.io/badge/discord-online-brightgreen.svg" alt="Discord"/></a>
|
16
|
-
<a href="https://opencollective.com/nest#backer" target="_blank"><img src="https://opencollective.com/nest/backers/badge.svg" alt="Backers on Open Collective" /></a>
|
17
|
-
<a href="https://opencollective.com/nest#sponsor" target="_blank"><img src="https://opencollective.com/nest/sponsors/badge.svg" alt="Sponsors on Open Collective" /></a>
|
18
|
-
<a href="https://paypal.me/kamilmysliwiec" target="_blank"><img src="https://img.shields.io/badge/Donate-PayPal-ff3f59.svg" alt="Donate us"/></a>
|
19
|
-
<a href="https://opencollective.com/nest#sponsor" target="_blank"><img src="https://img.shields.io/badge/Support%20us-Open%20Collective-41B883.svg" alt="Support us"></a>
|
20
|
-
<a href="https://twitter.com/nestframework" target="_blank"><img src="https://img.shields.io/twitter/follow/nestframework.svg?style=social&label=Follow" alt="Follow us on Twitter"></a>
|
21
|
-
</p>
|
22
|
-
<!--[](https://opencollective.com/nest#backer)
|
23
|
-
[](https://opencollective.com/nest#sponsor)-->
|
1
|
+
# Milesight Powermeter Api
|
24
2
|
|
25
3
|
## Description
|
26
4
|
|
27
|
-
|
5
|
+
The Milesight Powermeter API is an internal tool exclusively accessible to our backend team. It serves as a command hub for the Milesight CT10x powermeter using lorawan downlink commands.
|
28
6
|
|
29
|
-
##
|
7
|
+
## Requirements
|
8
|
+
- RabbitMQ 3.9.11
|
9
|
+
- Node 20.15.0
|
10
|
+
|
11
|
+
## Installation
|
30
12
|
|
31
13
|
```bash
|
32
14
|
$ npm install
|
33
15
|
```
|
34
16
|
|
35
|
-
##
|
17
|
+
## Configuration
|
18
|
+
|
19
|
+
- AWS_ACCESS_KEY_ID
|
20
|
+
- AWS Access Key ID
|
21
|
+
- AWS_SECRET_ACCESS_KEY
|
22
|
+
- AWS Secret Key
|
23
|
+
|
24
|
+
- NODE_ENV
|
25
|
+
- Node environment
|
26
|
+
- LOG_LEVEL
|
27
|
+
- value can be debug, info, error and verbose.
|
28
|
+
- MILESIGHT_POWERMETER_API_PORT
|
29
|
+
- configurable host port and has a default of `9059`
|
30
|
+
|
31
|
+
- AMQP_HOST
|
32
|
+
- rabbitmq host
|
33
|
+
- AMQP_USERNAME
|
34
|
+
- rabbitmq user
|
35
|
+
- AMQP_PASSWORD
|
36
|
+
- rabbitmq password
|
37
|
+
- AMQP_PORT
|
38
|
+
- rabbitmq port
|
39
|
+
|
40
|
+
## Running the app
|
36
41
|
|
37
42
|
```bash
|
38
43
|
# development
|
@@ -45,7 +50,7 @@ $ npm run start:dev
|
|
45
50
|
$ npm run start:prod
|
46
51
|
```
|
47
52
|
|
48
|
-
##
|
53
|
+
## Test
|
49
54
|
|
50
55
|
```bash
|
51
56
|
# unit tests
|
@@ -57,29 +62,27 @@ $ npm run test:e2e
|
|
57
62
|
# test coverage
|
58
63
|
$ npm run test:cov
|
59
64
|
```
|
65
|
+
## REST API
|
60
66
|
|
61
|
-
|
62
|
-
|
63
|
-
Check out a few resources that may come in handy when working with NestJS:
|
67
|
+
### Get lorawan powermeter list
|
64
68
|
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
- Visualize your application graph and interact with the NestJS application in real-time using [NestJS Devtools](https://devtools.nestjs.com).
|
69
|
-
- Need help with your project (part-time to full-time)? Check out our official [enterprise support](https://enterprise.nestjs.com).
|
70
|
-
- To stay in the loop and get updates, follow us on [X](https://x.com/nestframework) and [LinkedIn](https://linkedin.com/company/nestjs).
|
71
|
-
- Looking for a job, or have a job to offer? Check out our official [Jobs board](https://jobs.nestjs.com).
|
72
|
-
|
73
|
-
## Support
|
69
|
+
```
|
70
|
+
GET powermeter/milesight
|
71
|
+
```
|
74
72
|
|
75
|
-
|
73
|
+
`maxResult`(optional) range from 1-255 (default is 25)
|
74
|
+
`nextToken`(optional) token for the succeeding page/request
|
76
75
|
|
77
|
-
|
76
|
+
### Reboot the powermeter
|
78
77
|
|
79
|
-
|
80
|
-
|
81
|
-
- Twitter - [@nestframework](https://twitter.com/nestframework)
|
78
|
+
```
|
79
|
+
POST powermeter/milesight/reboot
|
82
80
|
|
83
|
-
|
81
|
+
Body: {
|
82
|
+
deviceEui: string;
|
83
|
+
serialNumber?: string;
|
84
|
+
}
|
85
|
+
```
|
86
|
+
`deviceEui`(required) device eui of the milesight powermeter<br />
|
87
|
+
`serialNumber`(optional) serial number of the milesight powermeter<br />
|
84
88
|
|
85
|
-
Nest is [MIT licensed](https://github.com/nestjs/nest/blob/master/LICENSE).
|