@golemio/energetics 1.3.7-dev.1315648116 → 1.3.7-dev.1317526410
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/db/example/04_measurements.sql +27 -0
- package/db/migrations/postgresql/20240531150935-measurements-partitions.js +53 -0
- package/db/migrations/postgresql/sqls/20240531150935-measurements-partitions-down.sql +9 -0
- package/db/migrations/postgresql/sqls/20240531150935-measurements-partitions-up.sql +47 -0
- package/dist/output-gateway/constants/Links.d.ts +1 -0
- package/dist/output-gateway/constants/Links.js +2 -1
- package/dist/output-gateway/constants/Links.js.map +1 -1
- package/dist/output-gateway/{routers/helpers/parseParams.d.ts → controllers/helpers/parsePaginationParams.d.ts} +1 -1
- package/dist/output-gateway/{routers/helpers/parseParams.js → controllers/helpers/parsePaginationParams.js} +5 -5
- package/dist/output-gateway/controllers/helpers/parsePaginationParams.js.map +1 -0
- package/dist/output-gateway/controllers/interfaces/IMeasurementsParams.d.ts +15 -0
- package/dist/output-gateway/controllers/interfaces/IMeasurementsParams.js +3 -0
- package/dist/output-gateway/controllers/interfaces/IMeasurementsParams.js.map +1 -0
- package/dist/output-gateway/controllers/interfaces/IPaginationParams.js.map +1 -0
- package/dist/output-gateway/controllers/v2/V2DevicesController.js +2 -2
- package/dist/output-gateway/controllers/v2/V2DevicesController.js.map +1 -1
- package/dist/output-gateway/controllers/v2/V2MeasurementsController.d.ts +9 -0
- package/dist/output-gateway/controllers/v2/V2MeasurementsController.js +70 -0
- package/dist/output-gateway/controllers/v2/V2MeasurementsController.js.map +1 -0
- package/dist/output-gateway/controllers/v2/V2OrganizationsController.js +2 -2
- package/dist/output-gateway/controllers/v2/V2OrganizationsController.js.map +1 -1
- package/dist/output-gateway/index.d.ts +2 -1
- package/dist/output-gateway/index.js +3 -2
- package/dist/output-gateway/index.js.map +1 -1
- package/dist/output-gateway/ioc/Di.js +11 -3
- package/dist/output-gateway/ioc/Di.js.map +1 -1
- package/dist/output-gateway/ioc/ModuleContainerToken.d.ts +4 -0
- package/dist/output-gateway/ioc/ModuleContainerToken.js +4 -0
- package/dist/output-gateway/ioc/ModuleContainerToken.js.map +1 -1
- package/dist/output-gateway/models/BuildingsSecondaryModel.d.ts +1 -1
- package/dist/output-gateway/models/BuildingsSecondaryModel.js.map +1 -1
- package/dist/output-gateway/repositories/DevicesRepository.d.ts +1 -1
- package/dist/output-gateway/repositories/MeasurementRepository.d.ts +10 -0
- package/dist/output-gateway/repositories/MeasurementRepository.js +101 -0
- package/dist/output-gateway/repositories/MeasurementRepository.js.map +1 -0
- package/dist/output-gateway/repositories/OrganizationsRepository.d.ts +1 -1
- package/dist/output-gateway/routers/interfaces/IMeasurementResponse.d.ts +8 -0
- package/dist/output-gateway/routers/interfaces/IMeasurementResponse.js +3 -0
- package/dist/output-gateway/routers/interfaces/IMeasurementResponse.js.map +1 -0
- package/dist/output-gateway/routers/v2/{BuildingsRouter.d.ts → V2BuildingsRouter.d.ts} +1 -3
- package/dist/output-gateway/routers/v2/{BuildingsRouter.js → V2BuildingsRouter.js} +18 -7
- package/dist/output-gateway/routers/v2/V2BuildingsRouter.js.map +1 -0
- package/dist/output-gateway/routers/v2/V2MeasurementsRouter.d.ts +7 -0
- package/dist/output-gateway/routers/v2/V2MeasurementsRouter.js +66 -0
- package/dist/output-gateway/routers/v2/V2MeasurementsRouter.js.map +1 -0
- package/dist/schema-definitions/models/MeasurementsModel.js +3 -2
- package/dist/schema-definitions/models/MeasurementsModel.js.map +1 -1
- package/dist/schema-definitions/models/constants/MeasurementConstants.d.ts +2 -0
- package/dist/schema-definitions/models/constants/MeasurementConstants.js +19 -0
- package/dist/schema-definitions/models/constants/MeasurementConstants.js.map +1 -0
- package/docs/implementation_documentation.md +8 -0
- package/docs/openapi-output.yaml +210 -22
- package/package.json +1 -1
- package/dist/output-gateway/routers/helpers/parseParams.js.map +0 -1
- package/dist/output-gateway/routers/interfaces/IPaginationParams.js.map +0 -1
- package/dist/output-gateway/routers/v2/BuildingsRouter.js.map +0 -1
- /package/dist/output-gateway/{routers → controllers}/interfaces/IPaginationParams.d.ts +0 -0
- /package/dist/output-gateway/{routers → controllers}/interfaces/IPaginationParams.js +0 -0
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
12
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
13
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
14
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
15
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
16
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
17
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
21
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
22
|
+
};
|
|
23
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
+
exports.MeasurementRepository = void 0;
|
|
25
|
+
const _sch_1 = require("../../schema-definitions");
|
|
26
|
+
const output_gateway_1 = require("@golemio/core/dist/output-gateway");
|
|
27
|
+
const sequelize_1 = __importDefault(require("@golemio/core/dist/shared/sequelize"));
|
|
28
|
+
const tsyringe_1 = require("@golemio/core/dist/shared/tsyringe");
|
|
29
|
+
const golemio_errors_1 = require("@golemio/core/dist/shared/golemio-errors");
|
|
30
|
+
const MeasurementsModel_1 = require("../../schema-definitions/models/MeasurementsModel");
|
|
31
|
+
let MeasurementRepository = exports.MeasurementRepository = class MeasurementRepository extends output_gateway_1.SequelizeModel {
|
|
32
|
+
constructor() {
|
|
33
|
+
super("MeasurementsRepository", MeasurementsModel_1.MeasurementModel.tableName, MeasurementsModel_1.MeasurementModel.attributeModel, {
|
|
34
|
+
schema: _sch_1.EnergeticsSchema.pgSchema,
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
getMeasurements(options) {
|
|
38
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
39
|
+
try {
|
|
40
|
+
const where = {
|
|
41
|
+
[sequelize_1.default.Op.and]: [
|
|
42
|
+
...(options.variable ? [{ var: { [sequelize_1.default.Op.eq]: options.variable } }] : []),
|
|
43
|
+
...(options.type ? [{ type: { [sequelize_1.default.Op.eq]: options.type } }] : []),
|
|
44
|
+
...(options.addr1 && options.addr2
|
|
45
|
+
? [{ addr: { [sequelize_1.default.Op.like]: sequelize_1.default.literal(`'/${options.addr1}/${options.addr2}/%'`) } }]
|
|
46
|
+
: []),
|
|
47
|
+
...(options.dateFrom ? [{ timestamp: { [sequelize_1.default.Op.gte]: options.dateFrom } }] : []),
|
|
48
|
+
...(options.dateTo ? [{ timestamp: { [sequelize_1.default.Op.lte]: options.dateTo } }] : []),
|
|
49
|
+
],
|
|
50
|
+
};
|
|
51
|
+
return yield this.sequelizeModel.findAll({
|
|
52
|
+
attributes: [["timestamp", "time"], "value", "addr", "meter", "type", "var"],
|
|
53
|
+
where,
|
|
54
|
+
order: [["timestamp", "DESC"]],
|
|
55
|
+
limit: options.limit,
|
|
56
|
+
offset: options.offset,
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
catch (err) {
|
|
60
|
+
throw new golemio_errors_1.GeneralError("MeasurementsRepository error - getMeasurements", this.name, err, 500);
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
getMonthlyReadings(options) {
|
|
65
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
66
|
+
try {
|
|
67
|
+
const where = {
|
|
68
|
+
[sequelize_1.default.Op.and]: {
|
|
69
|
+
var: { [sequelize_1.default.Op.eq]: options.variable },
|
|
70
|
+
addr: { [sequelize_1.default.Op.eq]: options.address },
|
|
71
|
+
timestamp: { [sequelize_1.default.Op.between]: [options.from, options.to] },
|
|
72
|
+
},
|
|
73
|
+
};
|
|
74
|
+
return yield this.sequelizeModel.findAll({
|
|
75
|
+
attributes: [[sequelize_1.default.fn("SUM", sequelize_1.default.col("value")), "value"], "meter", "type", "addr", "var"],
|
|
76
|
+
where,
|
|
77
|
+
raw: true,
|
|
78
|
+
group: ["meter", "type", "addr", "var"],
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
catch (err) {
|
|
82
|
+
throw new golemio_errors_1.GeneralError("MeasurementsRepository error - getMonthlyReadings", this.name, err, 500);
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
GetAll() {
|
|
87
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
88
|
+
throw new Error("MeasurementsRepository - GetOne not implemented");
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
GetOne() {
|
|
92
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
93
|
+
throw new Error("MeasurementsRepository - GetOne not implemented");
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
exports.MeasurementRepository = MeasurementRepository = __decorate([
|
|
98
|
+
(0, tsyringe_1.injectable)(),
|
|
99
|
+
__metadata("design:paramtypes", [])
|
|
100
|
+
], MeasurementRepository);
|
|
101
|
+
//# sourceMappingURL=MeasurementRepository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MeasurementRepository.js","sourceRoot":"","sources":["../../../src/output-gateway/repositories/MeasurementRepository.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,mDAAwC;AACxC,sEAAmE;AACnE,oFAA4D;AAC5D,iEAAgE;AAChE,6EAAwE;AAGxE,yFAAiE;AAG1D,IAAM,qBAAqB,mCAA3B,MAAM,qBAAsB,SAAQ,+BAAc;IACrD;QACI,KAAK,CAAC,wBAAwB,EAAE,oCAAgB,CAAC,SAAS,EAAE,oCAAgB,CAAC,cAAc,EAAE;YACzF,MAAM,EAAE,uBAAgB,CAAC,QAAQ;SACpC,CAAC,CAAC;IACP,CAAC;IAEY,eAAe,CAAC,OAAsB;;YAC/C,IAAI;gBACA,MAAM,KAAK,GAA2B;oBAClC,CAAC,mBAAS,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE;wBAChB,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,EAAE,CAAC,mBAAS,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;wBAC/E,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,CAAC,mBAAS,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;wBACxE,GAAG,CAAC,OAAO,CAAC,KAAK,IAAI,OAAO,CAAC,KAAK;4BAC9B,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,CAAC,mBAAS,CAAC,EAAE,CAAC,IAAI,C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C,EAAE,CAAC,EAAE,CAAC,EAAE,OAAO,CAAC,QAAQ,EAAE;wBAC5C,IAAI,EAAE,EAAE,CAAC,mBAAS,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,OAAO,CAAC,OAAO,EAAE;wBAC5C,SAAS,EAAE,EAAE,CAAC,mBAAS,CAAC,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,EAAE,CAAC,EAAE;qBACpE;iBACJ,CAAC;gBAEF,OAAO,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC;oBACrC,UAAU,EAAE,CAAC,CAAC,mBAAS,CAAC,EAAE,CAAC,KAAK,EAAE,mBAAS,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,EAAE,OAAO,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC;oBACpG,KAAK;oBACL,GAAG,EAAE,IAAI;oBACT,KAAK,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC;iBAC1C,CAAC,CAAC;aACN;YAAC,OAAO,GAAG,EAAE;gBACV,MAAM,IAAI,6BAAY,CAAC,mDAAmD,EAAE,IAAI,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;aACpG;QACL,CAAC;KAAA;IAEY,MAAM;;YACf,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;QACvE,CAAC;KAAA;IAEY,MAAM;;YACf,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;QACvE,CAAC;KAAA;CACJ,CAAA;gCA7DY,qBAAqB;IADjC,IAAA,qBAAU,GAAE;;GACA,qBAAqB,CA6DjC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SequelizeModel } from "@golemio/core/dist/output-gateway";
|
|
2
|
-
import { IPaginationParams } from "../
|
|
2
|
+
import { IPaginationParams } from "../controllers/interfaces/IPaginationParams";
|
|
3
3
|
import { OrganizationResponsibleUsersRepository } from "./OrganizationResponsibleUsersRepository";
|
|
4
4
|
import { IOrganizationDto } from "./interfaces/IOrganizationDto";
|
|
5
5
|
import { IOrganizationDetailDto } from "./interfaces/IOrganizationDetailDto";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IMeasurementResponse.js","sourceRoot":"","sources":["../../../../src/output-gateway/routers/interfaces/IMeasurementResponse.ts"],"names":[],"mappings":""}
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { AbstractRouter } from "@golemio/core/dist/helpers/routing/AbstractRouter";
|
|
2
|
-
export declare class
|
|
2
|
+
export declare class V2BuildingsRouter extends AbstractRouter {
|
|
3
3
|
private controller;
|
|
4
4
|
private cacheHeaderMiddleware;
|
|
5
5
|
private maxAge;
|
|
6
6
|
constructor();
|
|
7
7
|
protected initRoutes(): void;
|
|
8
8
|
}
|
|
9
|
-
declare const v2BuildingsRouter: AbstractRouter;
|
|
10
|
-
export { v2BuildingsRouter };
|
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
2
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
12
|
+
exports.V2BuildingsRouter = void 0;
|
|
4
13
|
const Links_1 = require("../../constants/Links");
|
|
5
14
|
const RouteVersion_1 = require("../../constants/RouteVersion");
|
|
6
15
|
const BuildingsController_1 = require("../../controllers/v2/BuildingsController");
|
|
@@ -9,7 +18,8 @@ const AbstractRouter_1 = require("@golemio/core/dist/helpers/routing/AbstractRou
|
|
|
9
18
|
const Validation_1 = require("@golemio/core/dist/output-gateway/Validation");
|
|
10
19
|
const ioc_1 = require("@golemio/core/dist/output-gateway/ioc");
|
|
11
20
|
const express_validator_1 = require("@golemio/core/dist/shared/express-validator");
|
|
12
|
-
|
|
21
|
+
const tsyringe_1 = require("@golemio/core/dist/shared/tsyringe");
|
|
22
|
+
let V2BuildingsRouter = exports.V2BuildingsRouter = class V2BuildingsRouter extends AbstractRouter_1.AbstractRouter {
|
|
13
23
|
constructor() {
|
|
14
24
|
super(RouteVersion_1.RouteVersion.v2, Links_1.BUILDING_PATH);
|
|
15
25
|
this.maxAge = 6 * 60 * 60; // 6 hours
|
|
@@ -21,8 +31,9 @@ class BuildingsRouter extends AbstractRouter_1.AbstractRouter {
|
|
|
21
31
|
this.router.get("/", this.cacheHeaderMiddleware.getMiddleware(this.maxAge), this.controller.getAll);
|
|
22
32
|
this.router.get("/:id", this.cacheHeaderMiddleware.getMiddleware(this.maxAge), (0, express_validator_1.param)("id").exists().isNumeric().not().isArray(), Validation_1.checkErrors, this.controller.getOne);
|
|
23
33
|
}
|
|
24
|
-
}
|
|
25
|
-
exports.
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
34
|
+
};
|
|
35
|
+
exports.V2BuildingsRouter = V2BuildingsRouter = __decorate([
|
|
36
|
+
(0, tsyringe_1.injectable)(),
|
|
37
|
+
__metadata("design:paramtypes", [])
|
|
38
|
+
], V2BuildingsRouter);
|
|
39
|
+
//# sourceMappingURL=V2BuildingsRouter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"V2BuildingsRouter.js","sourceRoot":"","sources":["../../../../src/output-gateway/routers/v2/V2BuildingsRouter.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,iDAAoD;AACpD,+DAA0D;AAC1D,kFAA6E;AAC7E,qCAAmD;AACnD,sFAAmF;AAEnF,6EAA2E;AAC3E,+DAAuE;AACvE,mFAAoE;AACpE,iEAAgE;AAGzD,IAAM,iBAAiB,+BAAvB,MAAM,iBAAkB,SAAQ,+BAAc;IAKjD;QACI,KAAK,CAAC,2BAAY,CAAC,EAAE,EAAE,qBAAa,CAAC,CAAC;QAHlC,WAAM,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC,UAAU;QAIpC,IAAI,CAAC,UAAU,GAAG,IAAI,yCAAmB,EAAE,CAAC;QAC5C,IAAI,CAAC,qBAAqB,GAAG,0BAAqB,CAAC,OAAO,CAAwB,oBAAc,CAAC,qBAAqB,CAAC,CAAC;QACxH,IAAI,CAAC,UAAU,EAAE,CAAC;IACtB,CAAC;IAES,UAAU;QAChB,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,qBAAqB,CAAC,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;QACpG,IAAI,CAAC,MAAM,CAAC,GAAG,CACX,MAAM,EACN,IAAI,CAAC,qBAAqB,CAAC,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,EACrD,IAAA,yBAAK,EAAC,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC,SAAS,EAAE,CAAC,GAAG,EAAE,CAAC,OAAO,EAAE,EAChD,wBAAW,EACX,IAAI,CAAC,UAAU,CAAC,MAAM,CACzB,CAAC;IACN,CAAC;CACJ,CAAA;4BAtBY,iBAAiB;IAD7B,IAAA,qBAAU,GAAE;;GACA,iBAAiB,CAsB7B"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { AbstractRouter } from "@golemio/core/dist/helpers/routing/AbstractRouter";
|
|
2
|
+
import { V2MeasurementsController } from "../../controllers/v2/V2MeasurementsController";
|
|
3
|
+
export declare class V2MeasurementsRouter extends AbstractRouter {
|
|
4
|
+
private controller;
|
|
5
|
+
constructor(controller: V2MeasurementsController);
|
|
6
|
+
protected initRoutes(): void;
|
|
7
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.V2MeasurementsRouter = void 0;
|
|
16
|
+
const AbstractRouter_1 = require("@golemio/core/dist/helpers/routing/AbstractRouter");
|
|
17
|
+
const output_gateway_1 = require("@golemio/core/dist/output-gateway");
|
|
18
|
+
const Validation_1 = require("@golemio/core/dist/output-gateway/Validation");
|
|
19
|
+
const express_validator_1 = require("@golemio/core/dist/shared/express-validator");
|
|
20
|
+
const V2MeasurementsController_1 = require("../../controllers/v2/V2MeasurementsController");
|
|
21
|
+
const RouteVersion_1 = require("../../constants/RouteVersion");
|
|
22
|
+
const tsyringe_1 = require("@golemio/core/dist/shared/tsyringe");
|
|
23
|
+
const ModuleContainerToken_1 = require("../../ioc/ModuleContainerToken");
|
|
24
|
+
const Links_1 = require("../../constants/Links");
|
|
25
|
+
const MeasurementConstants_1 = require("../../../schema-definitions/models/constants/MeasurementConstants");
|
|
26
|
+
let V2MeasurementsRouter = exports.V2MeasurementsRouter = class V2MeasurementsRouter extends AbstractRouter_1.AbstractRouter {
|
|
27
|
+
constructor(controller) {
|
|
28
|
+
super(RouteVersion_1.RouteVersion.v2, Links_1.MEASUREMENTS_PATH);
|
|
29
|
+
this.controller = controller;
|
|
30
|
+
this.initRoutes();
|
|
31
|
+
}
|
|
32
|
+
initRoutes() {
|
|
33
|
+
this.router.get("/", [
|
|
34
|
+
(0, express_validator_1.query)("variable")
|
|
35
|
+
.optional()
|
|
36
|
+
.not()
|
|
37
|
+
.isEmpty({ ignore_whitespace: true })
|
|
38
|
+
.not()
|
|
39
|
+
.isArray()
|
|
40
|
+
.isIn(MeasurementConstants_1.MEASUREMENT_VARIABLES),
|
|
41
|
+
(0, express_validator_1.query)("type").optional().not().isEmpty({ ignore_whitespace: true }).not().isArray().isIn(MeasurementConstants_1.MEASUREMENT_TYPES),
|
|
42
|
+
(0, express_validator_1.oneOf)([
|
|
43
|
+
[
|
|
44
|
+
(0, express_validator_1.query)("addr1").exists().not().isEmpty({ ignore_whitespace: true }).not().isArray(),
|
|
45
|
+
(0, express_validator_1.query)("addr2").exists().not().isEmpty({ ignore_whitespace: true }).not().isArray(),
|
|
46
|
+
],
|
|
47
|
+
[(0, express_validator_1.query)("addr1").not().exists(), (0, express_validator_1.query)("addr2").not().exists()],
|
|
48
|
+
]),
|
|
49
|
+
(0, express_validator_1.query)("dateFrom").optional().isISO8601().not().isArray(),
|
|
50
|
+
(0, express_validator_1.query)("dateTo").optional().isISO8601().not().isArray(),
|
|
51
|
+
], Validation_1.checkErrors, (0, Validation_1.paginationLimitMiddleware)(this.path), (0, output_gateway_1.useCacheMiddleware)(), this.controller.getMeasurements);
|
|
52
|
+
this.router.get("/monthly-reading", [
|
|
53
|
+
(0, express_validator_1.query)("addr1").exists().not().isEmpty({ ignore_whitespace: true }).not().isArray(),
|
|
54
|
+
(0, express_validator_1.query)("addr2").exists().not().isEmpty({ ignore_whitespace: true }).not().isArray(),
|
|
55
|
+
(0, express_validator_1.query)("variable").exists().not().isEmpty({ ignore_whitespace: true }).not().isArray().isIn(MeasurementConstants_1.MEASUREMENT_VARIABLES),
|
|
56
|
+
(0, express_validator_1.query)("year").exists().isInt().not().isArray(),
|
|
57
|
+
(0, express_validator_1.query)("month").exists().isInt({ min: 1, max: 12 }).not().isArray(),
|
|
58
|
+
], Validation_1.checkErrors, (0, Validation_1.paginationLimitMiddleware)(this.path), (0, output_gateway_1.useCacheMiddleware)(), this.controller.getMonthlyReadings);
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
exports.V2MeasurementsRouter = V2MeasurementsRouter = __decorate([
|
|
62
|
+
(0, tsyringe_1.injectable)(),
|
|
63
|
+
__param(0, (0, tsyringe_1.inject)(ModuleContainerToken_1.ModuleContainerToken.V2MeasurementsController)),
|
|
64
|
+
__metadata("design:paramtypes", [V2MeasurementsController_1.V2MeasurementsController])
|
|
65
|
+
], V2MeasurementsRouter);
|
|
66
|
+
//# sourceMappingURL=V2MeasurementsRouter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"V2MeasurementsRouter.js","sourceRoot":"","sources":["../../../../src/output-gateway/routers/v2/V2MeasurementsRouter.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,sFAAmF;AACnF,sEAAuE;AACvE,6EAAkH;AAClH,mFAA2E;AAC3E,4FAAuF;AACvF,+DAA0D;AAC1D,iEAAwE;AACxE,yEAAoE;AACpE,iDAAwD;AACxD,4GAAsG;AAG/F,IAAM,oBAAoB,kCAA1B,MAAM,oBAAqB,SAAQ,+BAAc;IACpD,YAA2E,UAAoC;QAC3G,KAA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,EACpB,IAAI,CAAC,UAAU,CAAC,kBAAkB,CACrC,CAAC;IACN,CAAC;CACJ,CAAA;+BAlDY,oBAAoB;IADhC,IAAA,qBAAU,GAAE;IAEI,WAAA,IAAA,iBAAM,EAAC,2CAAoB,CAAC,wBAAwB,CAAC,CAAA;qCAAqB,mDAAwB;GADtG,oBAAoB,CAkDhC"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.MeasurementModel = void 0;
|
|
4
4
|
const sequelize_1 = require("@golemio/core/dist/shared/sequelize");
|
|
5
|
+
const MeasurementConstants_1 = require("./constants/MeasurementConstants");
|
|
5
6
|
class MeasurementModel extends sequelize_1.Model {
|
|
6
7
|
}
|
|
7
8
|
exports.MeasurementModel = MeasurementModel;
|
|
@@ -44,8 +45,8 @@ MeasurementModel.arrayJsonSchema = {
|
|
|
44
45
|
},
|
|
45
46
|
value: { type: "number" },
|
|
46
47
|
addr: { type: "string" },
|
|
47
|
-
variable: { type: "string" },
|
|
48
|
-
type: { type: "string" },
|
|
48
|
+
variable: { type: "string", enum: MeasurementConstants_1.MEASUREMENT_VARIABLES },
|
|
49
|
+
type: { type: "string", enum: MeasurementConstants_1.MEASUREMENT_TYPES },
|
|
49
50
|
meter: { type: "string" },
|
|
50
51
|
source: { type: "string" },
|
|
51
52
|
measurement_category: { type: "string" },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MeasurementsModel.js","sourceRoot":"","sources":["../../../src/schema-definitions/models/MeasurementsModel.ts"],"names":[],"mappings":";;;AACA,mEAAwF;
|
|
1
|
+
{"version":3,"file":"MeasurementsModel.js","sourceRoot":"","sources":["../../../src/schema-definitions/models/MeasurementsModel.ts"],"names":[],"mappings":";;;AACA,mEAAwF;AAExF,2EAAsG;AAEtG,MAAa,gBAAiB,SAAQ,iBAAwC;;AAA9E,4CA6DC;AA5DiB,0BAAS,GAAG,iCAAiC,CAAC;AAW9C,+BA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,IAAI,EAAE,wCAAiB,EAAE;YACjD,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;YACzB,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;YAC1B,oBAAoB,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;SAC3C;QACD,QAAQ,EAAE,CAAC,WAAW,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,sBAAsB,CAAC;KAC1G;CACJ,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MEASUREMENT_TYPES = exports.MEASUREMENT_VARIABLES = void 0;
|
|
4
|
+
exports.MEASUREMENT_VARIABLES = [
|
|
5
|
+
"core",
|
|
6
|
+
"core2",
|
|
7
|
+
"EFwActi",
|
|
8
|
+
"EFwActiVT",
|
|
9
|
+
"ERvReact",
|
|
10
|
+
"EFwReact",
|
|
11
|
+
"raw",
|
|
12
|
+
"T",
|
|
13
|
+
"CO2",
|
|
14
|
+
"RH",
|
|
15
|
+
"EFwActiNT",
|
|
16
|
+
"VOC",
|
|
17
|
+
];
|
|
18
|
+
exports.MEASUREMENT_TYPES = ["monthly_reading", "provider_value", "dotcontrols_value"];
|
|
19
|
+
//# sourceMappingURL=MeasurementConstants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MeasurementConstants.js","sourceRoot":"","sources":["../../../../src/schema-definitions/models/constants/MeasurementConstants.ts"],"names":[],"mappings":";;;AAAa,QAAA,qBAAqB,GAAG;IACjC,MAAM;IACN,OAAO;IACP,SAAS;IACT,WAAW;IACX,UAAU;IACV,UAAU;IACV,KAAK;IACL,GAAG;IACH,KAAK;IACL,IAAI;IACJ,WAAW;IACX,KAAK;CACR,CAAC;AAEW,QAAA,iBAAiB,GAAG,CAAC,iBAAiB,EAAE,gBAAgB,EAAE,mBAAmB,CAAC,CAAC"}
|
|
@@ -400,3 +400,11 @@ Metoda sbírá historická data
|
|
|
400
400
|
|
|
401
401
|
- zdrojové tabulky
|
|
402
402
|
- consumption_energy_devices
|
|
403
|
+
|
|
404
|
+
|
|
405
|
+
#### _/v2/energetics/measurements_
|
|
406
|
+
|
|
407
|
+
#### _/v2/energetics/measurements/monthly-reading_
|
|
408
|
+
|
|
409
|
+
- zdrojové tabulky
|
|
410
|
+
- consumption_energy_consumption
|
package/docs/openapi-output.yaml
CHANGED
|
@@ -9,9 +9,9 @@ info:
|
|
|
9
9
|
email: golemio@operatorict.cz
|
|
10
10
|
url: https://golemio.cz
|
|
11
11
|
servers:
|
|
12
|
-
- url: https://rabin.golemio.cz
|
|
12
|
+
- url: https://rabin.golemio.cz
|
|
13
13
|
description: Test (development) server
|
|
14
|
-
- url: https://api.golemio.cz
|
|
14
|
+
- url: https://api.golemio.cz
|
|
15
15
|
description: Main (production) server
|
|
16
16
|
tags:
|
|
17
17
|
- name: ⚡ Energetics (v2)
|
|
@@ -39,7 +39,7 @@ paths:
|
|
|
39
39
|
schema:
|
|
40
40
|
type: array
|
|
41
41
|
items:
|
|
42
|
-
$ref: "#/components/schemas/
|
|
42
|
+
$ref: "#/components/schemas/EnergeticsBuildingShort"
|
|
43
43
|
|
|
44
44
|
/v2/energetics/buildings/{id}:
|
|
45
45
|
get:
|
|
@@ -59,7 +59,7 @@ paths:
|
|
|
59
59
|
content:
|
|
60
60
|
application/json:
|
|
61
61
|
schema:
|
|
62
|
-
$ref: "#/components/schemas/
|
|
62
|
+
$ref: "#/components/schemas/EnergeticsBuildingFull"
|
|
63
63
|
|
|
64
64
|
/v2/energetics/devices:
|
|
65
65
|
get:
|
|
@@ -170,6 +170,151 @@ paths:
|
|
|
170
170
|
"500":
|
|
171
171
|
$ref: "#/components/responses/ServerError"
|
|
172
172
|
|
|
173
|
+
/v2/energetics/measurements:
|
|
174
|
+
get:
|
|
175
|
+
tags:
|
|
176
|
+
- ⚡ Energetics (v2)
|
|
177
|
+
summary: Measurements
|
|
178
|
+
parameters:
|
|
179
|
+
- name: variable
|
|
180
|
+
in: query
|
|
181
|
+
required: false
|
|
182
|
+
schema:
|
|
183
|
+
$ref: '#/components/schemas/EnergeticsVariables'
|
|
184
|
+
description: >-
|
|
185
|
+
core - Kumulovaný objem [m3]<br />
|
|
186
|
+
core2 - Kumulovaný přepočítaný objem [Nm3]<br />
|
|
187
|
+
EFwActi - Odběr činné energie [kWh]<br />
|
|
188
|
+
EFwActiVT - Odběr činné energie, vysoký tarif [kVArh]<br />
|
|
189
|
+
ERvReact - Dodávka jalové energie [kVArh]<br />
|
|
190
|
+
EFwReact - Odběr jalové energie [kVArh]<br />
|
|
191
|
+
raw - Číselník impulzů [imp]<br />
|
|
192
|
+
RSSI - Síla signálu [dBm]<br />
|
|
193
|
+
T - Teplota [°C]<br />
|
|
194
|
+
CO2 - Koncentrace CO2 [ppm]<br />
|
|
195
|
+
RH - Relativní vlhkost [%]<br />
|
|
196
|
+
EFwActiNT - Odběr činné energie, nízký tarif [kVArh]<br />
|
|
197
|
+
VOC - Míra koncentrace těkavých látek [%]<br />
|
|
198
|
+
- name: type
|
|
199
|
+
in: query
|
|
200
|
+
required: false
|
|
201
|
+
schema:
|
|
202
|
+
$ref: '#/components/schemas/EnergeticsTypes'
|
|
203
|
+
description: >-
|
|
204
|
+
monthly_reading - hodnoty sčítané po měsících z 15 minutových spotřeb poskytovaných firmou PRE |<br />
|
|
205
|
+
provider_value - data získaná od poskytovatelů energií |<br />
|
|
206
|
+
dotcontrols_value - data získaná ze systémů VisApp firmy DotControls |<br />
|
|
207
|
+
- name: addr1
|
|
208
|
+
in: query
|
|
209
|
+
required: false
|
|
210
|
+
schema:
|
|
211
|
+
type: string
|
|
212
|
+
example: "2.9"
|
|
213
|
+
- name: addr2
|
|
214
|
+
in: query
|
|
215
|
+
required: false
|
|
216
|
+
schema:
|
|
217
|
+
type: string
|
|
218
|
+
example: "PF1"
|
|
219
|
+
- name: dateFrom
|
|
220
|
+
in: query
|
|
221
|
+
schema:
|
|
222
|
+
type: string
|
|
223
|
+
format: date-time
|
|
224
|
+
example: 2023-05-01T00:00:00.000Z
|
|
225
|
+
- name: dateTo
|
|
226
|
+
in: query
|
|
227
|
+
schema:
|
|
228
|
+
type: string
|
|
229
|
+
format: date-time
|
|
230
|
+
example: 2023-05-02T00:00:00.000Z
|
|
231
|
+
responses:
|
|
232
|
+
'200':
|
|
233
|
+
description: Success
|
|
234
|
+
content:
|
|
235
|
+
application/json:
|
|
236
|
+
schema:
|
|
237
|
+
type: array
|
|
238
|
+
items:
|
|
239
|
+
$ref: '#/components/schemas/EnergeticsMeasurement'
|
|
240
|
+
'400':
|
|
241
|
+
$ref: "#/components/responses/BadRequestError"
|
|
242
|
+
'401':
|
|
243
|
+
$ref: "#/components/responses/UnauthorizedError"
|
|
244
|
+
'500':
|
|
245
|
+
$ref: "#/components/responses/ServerError"
|
|
246
|
+
|
|
247
|
+
/v2/energetics/measurements/monthly-reading:
|
|
248
|
+
get:
|
|
249
|
+
tags:
|
|
250
|
+
- ⚡ Energetics (v2)
|
|
251
|
+
summary: Monthly sums of measurements from devices
|
|
252
|
+
parameters:
|
|
253
|
+
- name: addr1
|
|
254
|
+
in: query
|
|
255
|
+
description: First part of device address
|
|
256
|
+
required: true
|
|
257
|
+
schema:
|
|
258
|
+
type: string
|
|
259
|
+
example: "2.9"
|
|
260
|
+
- name: addr2
|
|
261
|
+
in: query
|
|
262
|
+
description: Second part of device address
|
|
263
|
+
required: true
|
|
264
|
+
schema:
|
|
265
|
+
type: string
|
|
266
|
+
example: "PF1"
|
|
267
|
+
- name: variable
|
|
268
|
+
in: query
|
|
269
|
+
required: true
|
|
270
|
+
schema:
|
|
271
|
+
$ref: '#/components/schemas/EnergeticsVariables'
|
|
272
|
+
description: >-
|
|
273
|
+
core - Kumulovaný objem [m3]<br />
|
|
274
|
+
core2 - Kumulovaný přepočítaný objem [Nm3]<br />
|
|
275
|
+
EFwActi - Odběr činné energie [kWh]<br />
|
|
276
|
+
EFwActiVT - Odběr činné energie, vysoký tarif [kVArh]<br />
|
|
277
|
+
ERvReact - Dodávka jalové energie [kVArh]<br />
|
|
278
|
+
EFwReact - Odběr jalové energie [kVArh]<br />
|
|
279
|
+
raw - Číselník impulzů [imp]<br />
|
|
280
|
+
RSSI - Síla signálu [dBm]<br />
|
|
281
|
+
T - Teplota [°C]<br />
|
|
282
|
+
CO2 - Koncentrace CO2 [ppm]<br />
|
|
283
|
+
RH - Relativní vlhkost [%]<br />
|
|
284
|
+
EFwActiNT - Odběr činné energie, nízký tarif [kVArh]<br />
|
|
285
|
+
VOC - Míra koncentrace těkavých látek [%]<br />
|
|
286
|
+
- name: year
|
|
287
|
+
in: query
|
|
288
|
+
description: Year of measurement
|
|
289
|
+
required: true
|
|
290
|
+
schema:
|
|
291
|
+
type: integer
|
|
292
|
+
format: int32
|
|
293
|
+
example: 2023
|
|
294
|
+
- name: month
|
|
295
|
+
in: query
|
|
296
|
+
description: Month of measurement
|
|
297
|
+
required: true
|
|
298
|
+
schema:
|
|
299
|
+
type: integer
|
|
300
|
+
format: int32
|
|
301
|
+
example: 5
|
|
302
|
+
responses:
|
|
303
|
+
'200':
|
|
304
|
+
description: Success
|
|
305
|
+
content:
|
|
306
|
+
application/json:
|
|
307
|
+
schema:
|
|
308
|
+
type: array
|
|
309
|
+
items:
|
|
310
|
+
$ref: '#/components/schemas/EnergeticsMeasurement'
|
|
311
|
+
'400':
|
|
312
|
+
$ref: "#/components/responses/BadRequestError"
|
|
313
|
+
'401':
|
|
314
|
+
$ref: "#/components/responses/UnauthorizedError"
|
|
315
|
+
'500':
|
|
316
|
+
$ref: "#/components/responses/ServerError"
|
|
317
|
+
|
|
173
318
|
components:
|
|
174
319
|
responses:
|
|
175
320
|
UnauthorizedError:
|
|
@@ -236,7 +381,7 @@ components:
|
|
|
236
381
|
type: string
|
|
237
382
|
|
|
238
383
|
schemas:
|
|
239
|
-
|
|
384
|
+
EnergeticsBuildingShort:
|
|
240
385
|
type: object
|
|
241
386
|
properties:
|
|
242
387
|
id:
|
|
@@ -247,7 +392,7 @@ components:
|
|
|
247
392
|
type: string
|
|
248
393
|
link:
|
|
249
394
|
type: string
|
|
250
|
-
|
|
395
|
+
EnergeticsBuildingFull:
|
|
251
396
|
type: object
|
|
252
397
|
properties:
|
|
253
398
|
id:
|
|
@@ -705,22 +850,6 @@ components:
|
|
|
705
850
|
type: string
|
|
706
851
|
nullable: true
|
|
707
852
|
additionalProperties: false
|
|
708
|
-
EnergeticsBuildingShort:
|
|
709
|
-
type: object
|
|
710
|
-
properties:
|
|
711
|
-
id:
|
|
712
|
-
type: integer
|
|
713
|
-
format: int32
|
|
714
|
-
name:
|
|
715
|
-
type: string
|
|
716
|
-
nullable: true
|
|
717
|
-
building_address_code:
|
|
718
|
-
type: string
|
|
719
|
-
nullable: true
|
|
720
|
-
link:
|
|
721
|
-
type: string
|
|
722
|
-
nullable: true
|
|
723
|
-
additionalProperties: false
|
|
724
853
|
EnergeticsDevice:
|
|
725
854
|
type: object
|
|
726
855
|
properties:
|
|
@@ -852,3 +981,62 @@ components:
|
|
|
852
981
|
example:
|
|
853
982
|
- 14.4633
|
|
854
983
|
- 50.07827
|
|
984
|
+
EnergeticsMeasurement:
|
|
985
|
+
type: object
|
|
986
|
+
properties:
|
|
987
|
+
time:
|
|
988
|
+
type: string
|
|
989
|
+
format: date-time
|
|
990
|
+
value:
|
|
991
|
+
type: string
|
|
992
|
+
addr:
|
|
993
|
+
type: string
|
|
994
|
+
meter:
|
|
995
|
+
type: string
|
|
996
|
+
nullable: true
|
|
997
|
+
type:
|
|
998
|
+
$ref: "#/components/schemas/EnergeticsTypes"
|
|
999
|
+
var:
|
|
1000
|
+
$ref: "#/components/schemas/EnergeticsVariables"
|
|
1001
|
+
additionalProperties: false
|
|
1002
|
+
EnergeticsVariables:
|
|
1003
|
+
type: string
|
|
1004
|
+
example: core
|
|
1005
|
+
enum:
|
|
1006
|
+
- core
|
|
1007
|
+
- core2
|
|
1008
|
+
- EFwActi
|
|
1009
|
+
- EFwActiVT
|
|
1010
|
+
- ERvReact
|
|
1011
|
+
- EFwReact
|
|
1012
|
+
- raw
|
|
1013
|
+
- T
|
|
1014
|
+
- CO2
|
|
1015
|
+
- RH
|
|
1016
|
+
- EFwActiNT
|
|
1017
|
+
- VOC
|
|
1018
|
+
description: >-
|
|
1019
|
+
core - Kumulovaný objem [m3]<br />
|
|
1020
|
+
core2 - Kumulovaný přepočítaný objem [Nm3]<br />
|
|
1021
|
+
EFwActi - Odběr činné energie [kWh]<br />
|
|
1022
|
+
EFwActiVT - Odběr činné energie, vysoký tarif [kVArh]<br />
|
|
1023
|
+
ERvReact - Dodávka jalové energie [kVArh]<br />
|
|
1024
|
+
EFwReact - Odběr jalové energie [kVArh]<br />
|
|
1025
|
+
raw - Číselník impulzů [imp]<br />
|
|
1026
|
+
RSSI - Síla signálu [dBm]<br />
|
|
1027
|
+
T - Teplota [°C]<br />
|
|
1028
|
+
CO2 - Koncentrace CO2 [ppm]<br />
|
|
1029
|
+
RH - Relativní vlhkost [%]<br />
|
|
1030
|
+
EFwActiNT - Odběr činné energie, nízký tarif [kVArh]<br />
|
|
1031
|
+
VOC - Míra koncentrace těkavých látek [%]<br />
|
|
1032
|
+
EnergeticsTypes:
|
|
1033
|
+
type: string
|
|
1034
|
+
example: provider_value
|
|
1035
|
+
enum:
|
|
1036
|
+
- monthly_reading
|
|
1037
|
+
- provider_value
|
|
1038
|
+
- dotcontrols_value
|
|
1039
|
+
description: >-
|
|
1040
|
+
monthly_reading - hodnoty sčítané po měsících z 15 minutových spotřeb poskytovaných firmou PRE |<br />
|
|
1041
|
+
provider_value - data získaná od poskytovatelů energií |<br />
|
|
1042
|
+
dotcontrols_value - data získaná ze systémů VisApp firmy DotControls |<br />
|