@kohost/api-client 3.0.0-beta.26 → 3.0.0-beta.28

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.
@@ -92,7 +92,8 @@ var require_common = __commonJS({
92
92
  "ecobee",
93
93
  "igor",
94
94
  "kohost-k7",
95
- "kohost-pms",
95
+ "kohost",
96
+ "lg",
96
97
  "lirc",
97
98
  "mews",
98
99
  "pelican-wireless",
@@ -186,6 +187,11 @@ var require_device = __commonJS({
186
187
  type: "number",
187
188
  minimum: 0,
188
189
  maximum: 100
190
+ },
191
+ watts: {
192
+ type: "number",
193
+ minimum: 0,
194
+ default: 0
189
195
  }
190
196
  }
191
197
  };
@@ -258,6 +264,9 @@ var require_switch = __commonJS({
258
264
  },
259
265
  systemData: {
260
266
  $ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/systemData"
267
+ },
268
+ watts: {
269
+ "#ref": "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/watts"
261
270
  }
262
271
  },
263
272
  additionalProperties: false,
@@ -453,7 +462,7 @@ var require_kohost = __commonJS({
453
462
  if (!this.validator) {
454
463
  throw new Error("Validator is not defined");
455
464
  }
456
- const isNew = (data == null ? void 0 : data.id) ? false : true;
465
+ const isNew = data?.id ? false : true;
457
466
  this._setId(data);
458
467
  this._validate(data);
459
468
  this._setProperties(data);
@@ -500,10 +509,9 @@ var require_kohost = __commonJS({
500
509
  return id;
501
510
  }
502
511
  static getActionDelta(old, _new) {
503
- var _a;
504
512
  const delta = {};
505
513
  for (const action in _new) {
506
- if ((_a = this.actionProperties) == null ? void 0 : _a.includes(action)) {
514
+ if (this.actionProperties?.includes(action)) {
507
515
  if (old[action] !== _new[action]) {
508
516
  delta[action] = 1;
509
517
  }
@@ -647,6 +655,9 @@ var require_alarm = __commonJS({
647
655
  items: {
648
656
  $ref: "#/properties/supportedTroubles/items"
649
657
  }
658
+ },
659
+ watts: {
660
+ "#ref": "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/watts"
650
661
  }
651
662
  },
652
663
  additionalProperties: false,
@@ -731,6 +742,9 @@ var require_dimmer = __commonJS({
731
742
  },
732
743
  systemData: {
733
744
  $ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/systemData"
745
+ },
746
+ watts: {
747
+ "#ref": "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/watts"
734
748
  }
735
749
  },
736
750
  additionalProperties: false,
@@ -752,10 +766,9 @@ var require_dimmer2 = __commonJS({
752
766
  super(data);
753
767
  }
754
768
  static getActionDelta(old, _new) {
755
- var _a;
756
769
  const delta = {};
757
770
  for (const action in _new) {
758
- if ((_a = this.actionProperties) == null ? void 0 : _a.includes(action)) {
771
+ if (this.actionProperties?.includes(action)) {
759
772
  if (action === "level") {
760
773
  const oldLevel = old[action];
761
774
  const newLevel = _new[action];
@@ -824,6 +837,9 @@ var require_lock = __commonJS({
824
837
  },
825
838
  systemData: {
826
839
  $ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/systemData"
840
+ },
841
+ watts: {
842
+ "#ref": "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/watts"
827
843
  }
828
844
  },
829
845
  additionalProperties: false,
@@ -971,6 +987,9 @@ var require_thermostat = __commonJS({
971
987
  systemData: {
972
988
  $ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/systemData",
973
989
  default: {}
990
+ },
991
+ watts: {
992
+ "#ref": "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/watts"
974
993
  }
975
994
  },
976
995
  additionalProperties: false,
@@ -1130,6 +1149,9 @@ var require_windowCovering = __commonJS({
1130
1149
  },
1131
1150
  systemData: {
1132
1151
  $ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/systemData"
1152
+ },
1153
+ watts: {
1154
+ "#ref": "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/watts"
1133
1155
  }
1134
1156
  },
1135
1157
  additionalProperties: false,
@@ -1151,10 +1173,9 @@ var require_windowCovering2 = __commonJS({
1151
1173
  super(data);
1152
1174
  }
1153
1175
  static getActionDelta(old, _new) {
1154
- var _a;
1155
1176
  const delta = {};
1156
1177
  for (const action in _new) {
1157
- if ((_a = this.actionProperties) == null ? void 0 : _a.includes(action)) {
1178
+ if (this.actionProperties?.includes(action)) {
1158
1179
  if (action === "position") {
1159
1180
  const oldPos = old[action];
1160
1181
  const newPos = _new[action];
@@ -1712,6 +1733,9 @@ var require_courtesy = __commonJS({
1712
1733
  },
1713
1734
  systemData: {
1714
1735
  $ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/systemData"
1736
+ },
1737
+ watts: {
1738
+ "#ref": "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/watts"
1715
1739
  }
1716
1740
  },
1717
1741
  additionalProperties: false,
@@ -1797,6 +1821,9 @@ var require_camera = __commonJS({
1797
1821
  },
1798
1822
  systemData: {
1799
1823
  $ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/systemData"
1824
+ },
1825
+ watts: {
1826
+ "#ref": "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/watts"
1800
1827
  }
1801
1828
  },
1802
1829
  additionalProperties: false,
@@ -1861,6 +1888,9 @@ var require_motionSensor = __commonJS({
1861
1888
  },
1862
1889
  notification: {
1863
1890
  $ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/notification"
1891
+ },
1892
+ watts: {
1893
+ "#ref": "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/watts"
1864
1894
  }
1865
1895
  },
1866
1896
  additionalProperties: false,
@@ -2075,6 +2105,9 @@ var require_mediaSource = __commonJS({
2075
2105
  },
2076
2106
  systemData: {
2077
2107
  $ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/systemData"
2108
+ },
2109
+ watts: {
2110
+ "#ref": "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/watts"
2078
2111
  }
2079
2112
  },
2080
2113
  additionalProperties: false
@@ -2475,50 +2508,40 @@ var require_room2 = __commonJS({
2475
2508
  }
2476
2509
  }
2477
2510
  get hasDimmer() {
2478
- var _a;
2479
- return ((_a = this.dimmers) == null ? void 0 : _a.length) > 0;
2511
+ return this.dimmers?.length > 0;
2480
2512
  }
2481
2513
  get hasSwitch() {
2482
- var _a;
2483
- return ((_a = this.switches) == null ? void 0 : _a.length) > 0;
2514
+ return this.switches?.length > 0;
2484
2515
  }
2485
2516
  get hasWindowCovering() {
2486
- var _a;
2487
- return ((_a = this.windowCoverings) == null ? void 0 : _a.length) > 0;
2517
+ return this.windowCoverings?.length > 0;
2488
2518
  }
2489
2519
  get hasShade() {
2490
2520
  return this.hasWindowCovering;
2491
2521
  }
2492
2522
  get hasThermostat() {
2493
- var _a;
2494
- return ((_a = this.thermostats) == null ? void 0 : _a.length) > 0;
2523
+ return this.thermostats?.length > 0;
2495
2524
  }
2496
2525
  get hasClimate() {
2497
2526
  return this.hasThermostat;
2498
2527
  }
2499
2528
  get hasLock() {
2500
- var _a;
2501
- return ((_a = this.locks) == null ? void 0 : _a.length) > 0;
2529
+ return this.locks?.length > 0;
2502
2530
  }
2503
2531
  get hasCourtesy() {
2504
- var _a;
2505
- return ((_a = this.courtesy) == null ? void 0 : _a.length) > 0;
2532
+ return this.courtesy?.length > 0;
2506
2533
  }
2507
2534
  get hasCamera() {
2508
- var _a;
2509
- return ((_a = this.cameras) == null ? void 0 : _a.length) > 0;
2535
+ return this.cameras?.length > 0;
2510
2536
  }
2511
2537
  get hasAlarm() {
2512
- var _a;
2513
- return ((_a = this.alarms) == null ? void 0 : _a.length) > 0;
2538
+ return this.alarms?.length > 0;
2514
2539
  }
2515
2540
  get hasMedia() {
2516
- var _a;
2517
- return ((_a = this.mediaSources) == null ? void 0 : _a.length) > 0;
2541
+ return this.mediaSources?.length > 0;
2518
2542
  }
2519
2543
  get hasLight() {
2520
- var _a;
2521
- const hasSubTypeLight = (_a = this.switches) == null ? void 0 : _a.some((sw) => {
2544
+ const hasSubTypeLight = this.switches?.some((sw) => {
2522
2545
  return sw.subType === "light" || sw.subType === "fan";
2523
2546
  });
2524
2547
  return this.hasDimmer || hasSubTypeLight;
@@ -2543,69 +2566,68 @@ var require_room2 = __commonJS({
2543
2566
  value: Object.keys(schema.properties)
2544
2567
  });
2545
2568
  function mapRoomData(data) {
2546
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
2547
2569
  const roomData = cloneDeep(data);
2548
- (_a = roomData.dimmers) == null ? void 0 : _a.map((dimmer) => {
2570
+ roomData.dimmers?.map((dimmer) => {
2549
2571
  if (dimmer instanceof Dimmer2)
2550
2572
  return dimmer;
2551
2573
  else
2552
2574
  return new Dimmer2(dimmer);
2553
2575
  });
2554
- (_b = roomData.switches) == null ? void 0 : _b.map((switch_) => {
2576
+ roomData.switches?.map((switch_) => {
2555
2577
  if (switch_ instanceof Switch2)
2556
2578
  return switch_;
2557
2579
  else
2558
2580
  return new Switch2(switch_);
2559
2581
  });
2560
- (_c = roomData.windowCoverings) == null ? void 0 : _c.map((windowCovering) => {
2582
+ roomData.windowCoverings?.map((windowCovering) => {
2561
2583
  if (windowCovering instanceof WindowCovering2)
2562
2584
  return windowCovering;
2563
2585
  else
2564
2586
  return new WindowCovering2(windowCovering);
2565
2587
  });
2566
- (_d = roomData.thermostats) == null ? void 0 : _d.map((thermostat) => {
2588
+ roomData.thermostats?.map((thermostat) => {
2567
2589
  if (thermostat instanceof Thermostat2)
2568
2590
  return thermostat;
2569
2591
  else
2570
2592
  return new Thermostat2(thermostat);
2571
2593
  });
2572
- (_e = roomData.locks) == null ? void 0 : _e.map((lock) => {
2594
+ roomData.locks?.map((lock) => {
2573
2595
  if (lock instanceof Lock2)
2574
2596
  return lock;
2575
2597
  else
2576
2598
  return new Lock2(lock);
2577
2599
  });
2578
- (_f = roomData.courtesy) == null ? void 0 : _f.map((courtesy) => {
2600
+ roomData.courtesy?.map((courtesy) => {
2579
2601
  if (courtesy instanceof Courtesy2)
2580
2602
  return courtesy;
2581
2603
  else
2582
2604
  return new Courtesy2(courtesy);
2583
2605
  });
2584
- (_g = roomData.sources) == null ? void 0 : _g.map((source) => {
2606
+ roomData.sources?.map((source) => {
2585
2607
  if (source instanceof Source)
2586
2608
  return source;
2587
2609
  else
2588
2610
  return new Source(source);
2589
2611
  });
2590
- (_h = roomData.cameras) == null ? void 0 : _h.map((camera) => {
2612
+ roomData.cameras?.map((camera) => {
2591
2613
  if (camera instanceof Camera2)
2592
2614
  return camera;
2593
2615
  else
2594
2616
  return new Camera2(camera);
2595
2617
  });
2596
- (_i = roomData.alarms) == null ? void 0 : _i.map((alarm) => {
2618
+ roomData.alarms?.map((alarm) => {
2597
2619
  if (alarm instanceof Alarm2)
2598
2620
  return alarm;
2599
2621
  else
2600
2622
  return new Alarm2(alarm);
2601
2623
  });
2602
- (_j = roomData.motionSensors) == null ? void 0 : _j.map((motionSensor) => {
2624
+ roomData.motionSensors?.map((motionSensor) => {
2603
2625
  if (motionSensor instanceof MotionSensor2)
2604
2626
  return motionSensor;
2605
2627
  else
2606
2628
  return new MotionSensor2(motionSensor);
2607
2629
  });
2608
- (_k = roomData.scenes) == null ? void 0 : _k.map((scene) => {
2630
+ roomData.scenes?.map((scene) => {
2609
2631
  if (scene instanceof Scene2)
2610
2632
  return scene;
2611
2633
  else
@@ -2757,8 +2779,7 @@ var require_reservation2 = __commonJS({
2757
2779
  return this.adultCount + this.childCount;
2758
2780
  }
2759
2781
  get hasPayment() {
2760
- var _a;
2761
- return ((_a = this.paymentId) == null ? void 0 : _a.length) > 0;
2782
+ return this.paymentId?.length > 0;
2762
2783
  }
2763
2784
  range(tz) {
2764
2785
  const start = new Date(this.checkInDateTime);
@@ -3013,9 +3034,8 @@ var require_space2 = __commonJS({
3013
3034
  value: Object.keys(schema.properties)
3014
3035
  });
3015
3036
  function mapSpaceData(data) {
3016
- var _a;
3017
3037
  const spaceData = cloneDeep(data);
3018
- if ((_a = spaceData.rooms) == null ? void 0 : _a.length) {
3038
+ if (spaceData.rooms?.length) {
3019
3039
  spaceData.rooms.map((room) => {
3020
3040
  if (typeof room === "string")
3021
3041
  return room;
@@ -3295,6 +3315,9 @@ var require_gateway = __commonJS({
3295
3315
  },
3296
3316
  driver: {
3297
3317
  $ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/driver"
3318
+ },
3319
+ watts: {
3320
+ "#ref": "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/watts"
3298
3321
  }
3299
3322
  },
3300
3323
  additionalProperties: false,
@@ -3616,6 +3639,393 @@ var require_shortLink2 = __commonJS({
3616
3639
  }
3617
3640
  });
3618
3641
 
3642
+ // src/schemas/energyReportShard.json
3643
+ var require_energyReportShard = __commonJS({
3644
+ "src/schemas/energyReportShard.json"(exports2, module2) {
3645
+ module2.exports = {
3646
+ $schema: "http://json-schema.org/draft-07/schema",
3647
+ $id: "https://api.kohost.io/schemas/v3/energyReportShard.json",
3648
+ title: "Energy Report Shard",
3649
+ description: "Shard used for Energy Reports",
3650
+ type: "object",
3651
+ required: ["id", "type", "roomId", "first", "last", "data", "ndata", "expires"],
3652
+ properties: {
3653
+ id: {
3654
+ $ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/id"
3655
+ },
3656
+ type: {
3657
+ type: "string",
3658
+ enum: [
3659
+ "energyReportShard"
3660
+ ],
3661
+ default: "energyReportShard"
3662
+ },
3663
+ roomId: {
3664
+ $ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/id"
3665
+ },
3666
+ first: {
3667
+ type: ["string", "object"],
3668
+ format: "date-time"
3669
+ },
3670
+ last: {
3671
+ type: ["string", "object"],
3672
+ format: "date-time"
3673
+ },
3674
+ data: {
3675
+ type: "array",
3676
+ items: {
3677
+ type: "object",
3678
+ required: ["time", "watts", "id", "type", "value"],
3679
+ properties: {
3680
+ time: {
3681
+ type: ["string", "object"],
3682
+ format: "date-time"
3683
+ },
3684
+ watts: {
3685
+ "#ref": "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/watts"
3686
+ },
3687
+ id: {
3688
+ $ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/id"
3689
+ },
3690
+ type: {
3691
+ $ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/type"
3692
+ },
3693
+ value: {
3694
+ type: "number",
3695
+ minimum: 0,
3696
+ maximum: 1
3697
+ }
3698
+ }
3699
+ }
3700
+ },
3701
+ ndata: {
3702
+ type: "integer",
3703
+ minimum: 0,
3704
+ maximum: 1e5,
3705
+ default: 0
3706
+ },
3707
+ expires: {
3708
+ type: ["string", "object"],
3709
+ format: "date-time"
3710
+ }
3711
+ }
3712
+ };
3713
+ }
3714
+ });
3715
+
3716
+ // src/Models/energyReportShard.js
3717
+ var require_energyReportShard2 = __commonJS({
3718
+ "src/Models/energyReportShard.js"(exports2, module2) {
3719
+ var schemas = require_schema();
3720
+ var schema = require_energyReportShard();
3721
+ var Kohost = require_kohost();
3722
+ schemas.add(schema);
3723
+ var validator = schemas.compile(schema);
3724
+ var EnergyReportShard2 = class extends Kohost {
3725
+ constructor(data) {
3726
+ super(data);
3727
+ }
3728
+ };
3729
+ __name(EnergyReportShard2, "EnergyReportShard");
3730
+ Object.defineProperty(EnergyReportShard2.prototype, "schema", {
3731
+ value: schema
3732
+ });
3733
+ Object.defineProperty(EnergyReportShard2.prototype, "validator", {
3734
+ get: function() {
3735
+ return validator;
3736
+ }
3737
+ });
3738
+ Object.defineProperty(EnergyReportShard2, "validProperties", {
3739
+ value: Object.keys(schema.properties)
3740
+ });
3741
+ Object.defineProperty(EnergyReportShard2, "actionProperties", {
3742
+ value: ["state"]
3743
+ });
3744
+ module2.exports = EnergyReportShard2;
3745
+ var shard = new EnergyReportShard2({
3746
+ "id": "ShardId1",
3747
+ "type": "energyReportShard",
3748
+ "roomId": "TestRoom",
3749
+ "first": /* @__PURE__ */ new Date(),
3750
+ "last": /* @__PURE__ */ new Date(),
3751
+ "data": [{
3752
+ "time": /* @__PURE__ */ new Date(),
3753
+ "watts": 100,
3754
+ "id": "1",
3755
+ "type": "dimmer",
3756
+ "value": 0.121315
3757
+ }],
3758
+ "ndata": 1,
3759
+ "expires": /* @__PURE__ */ new Date()
3760
+ });
3761
+ console.log(shard);
3762
+ }
3763
+ });
3764
+
3765
+ // src/schemas/energyReportHourly.json
3766
+ var require_energyReportHourly = __commonJS({
3767
+ "src/schemas/energyReportHourly.json"(exports2, module2) {
3768
+ module2.exports = {
3769
+ $schema: "http://json-schema.org/draft-07/schema",
3770
+ $id: "https://api.kohost.io/schemas/v3/energyReportHourly.json",
3771
+ title: "Energy Report Hourly",
3772
+ description: "Hourly Report for Energy based on energy report shards",
3773
+ type: "object",
3774
+ required: ["id", "type", "roomId", "first", "last", "consumption", "totals", "costPerKw"],
3775
+ properties: {
3776
+ id: {
3777
+ $ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/id"
3778
+ },
3779
+ type: {
3780
+ type: "string",
3781
+ enum: [
3782
+ "energyReportHourly"
3783
+ ],
3784
+ default: "energyReportHourly"
3785
+ },
3786
+ roomId: {
3787
+ $ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/id"
3788
+ },
3789
+ first: {
3790
+ type: ["string", "object"],
3791
+ format: "date-time"
3792
+ },
3793
+ last: {
3794
+ type: ["string", "object"],
3795
+ format: "date-time"
3796
+ },
3797
+ consumption: {
3798
+ type: "array",
3799
+ items: {
3800
+ type: "object",
3801
+ required: ["id", "type", "kwh"],
3802
+ properties: {
3803
+ id: {
3804
+ $ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/id"
3805
+ },
3806
+ type: {
3807
+ $ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/type"
3808
+ },
3809
+ kwh: {
3810
+ type: "number",
3811
+ minimum: 0
3812
+ }
3813
+ }
3814
+ }
3815
+ },
3816
+ totals: {
3817
+ type: "array",
3818
+ items: {
3819
+ type: "object",
3820
+ required: ["lights", "climate", "media"],
3821
+ properties: {
3822
+ lights: {
3823
+ type: "number",
3824
+ minimum: 0
3825
+ },
3826
+ climate: {
3827
+ type: "number",
3828
+ minimum: 0
3829
+ },
3830
+ media: {
3831
+ type: "number",
3832
+ minimum: 0
3833
+ }
3834
+ }
3835
+ }
3836
+ },
3837
+ costPerKw: {
3838
+ type: "number",
3839
+ minimum: 0
3840
+ }
3841
+ }
3842
+ };
3843
+ }
3844
+ });
3845
+
3846
+ // src/Models/energyReportHourly.js
3847
+ var require_energyReportHourly2 = __commonJS({
3848
+ "src/Models/energyReportHourly.js"(exports2, module2) {
3849
+ var schemas = require_schema();
3850
+ var schema = require_energyReportHourly();
3851
+ var Kohost = require_kohost();
3852
+ schemas.add(schema);
3853
+ var validator = schemas.compile(schema);
3854
+ var EnergyReportHourly2 = class extends Kohost {
3855
+ constructor(data) {
3856
+ super(data);
3857
+ }
3858
+ };
3859
+ __name(EnergyReportHourly2, "EnergyReportHourly");
3860
+ Object.defineProperty(EnergyReportHourly2.prototype, "schema", {
3861
+ value: schema
3862
+ });
3863
+ Object.defineProperty(EnergyReportHourly2.prototype, "validator", {
3864
+ get: function() {
3865
+ return validator;
3866
+ }
3867
+ });
3868
+ Object.defineProperty(EnergyReportHourly2, "validProperties", {
3869
+ value: Object.keys(schema.properties)
3870
+ });
3871
+ Object.defineProperty(EnergyReportHourly2, "actionProperties", {
3872
+ value: ["state"]
3873
+ });
3874
+ module2.exports = EnergyReportHourly2;
3875
+ var hourlyShardReport = new EnergyReportHourly2({
3876
+ "id": "RepIdHr1",
3877
+ "type": "energyReportHourly",
3878
+ "roomId": "TestRoom",
3879
+ "first": /* @__PURE__ */ new Date(),
3880
+ "last": /* @__PURE__ */ new Date(),
3881
+ "consumption": [{
3882
+ "id": "1",
3883
+ "type": "dimmer",
3884
+ "kwh": 0.121315
3885
+ }],
3886
+ "totals": [{
3887
+ "lights": 10,
3888
+ "climate": 10,
3889
+ "media": 10
3890
+ }],
3891
+ "costPerKw": 0.14
3892
+ });
3893
+ console.log(hourlyShardReport);
3894
+ }
3895
+ });
3896
+
3897
+ // src/schemas/energyReportDaily.json
3898
+ var require_energyReportDaily = __commonJS({
3899
+ "src/schemas/energyReportDaily.json"(exports2, module2) {
3900
+ module2.exports = {
3901
+ $schema: "http://json-schema.org/draft-07/schema",
3902
+ $id: "https://api.kohost.io/schemas/v3/energyReportDaily.json",
3903
+ title: "Energy Report Daily",
3904
+ description: "Daily Report for Energy based on energy report shards",
3905
+ type: "object",
3906
+ required: ["id", "type", "roomId", "first", "last", "consumption", "totals", "costPerKw"],
3907
+ properties: {
3908
+ id: {
3909
+ $ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/id"
3910
+ },
3911
+ type: {
3912
+ type: "string",
3913
+ enum: [
3914
+ "energyReportDaily"
3915
+ ],
3916
+ default: "energyReportDaily"
3917
+ },
3918
+ roomId: {
3919
+ $ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/id"
3920
+ },
3921
+ first: {
3922
+ type: ["string", "object"],
3923
+ format: "date-time"
3924
+ },
3925
+ last: {
3926
+ type: ["string", "object"],
3927
+ format: "date-time"
3928
+ },
3929
+ consumption: {
3930
+ type: "array",
3931
+ items: {
3932
+ type: "object",
3933
+ required: ["id", "type", "kwh"],
3934
+ properties: {
3935
+ id: {
3936
+ $ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/id"
3937
+ },
3938
+ type: {
3939
+ $ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/type"
3940
+ },
3941
+ kwh: {
3942
+ type: "number",
3943
+ minimum: 0
3944
+ }
3945
+ }
3946
+ }
3947
+ },
3948
+ totals: {
3949
+ type: "array",
3950
+ items: {
3951
+ type: "object",
3952
+ required: ["lights", "climate", "media"],
3953
+ properties: {
3954
+ lights: {
3955
+ type: "number",
3956
+ minimum: 0
3957
+ },
3958
+ climate: {
3959
+ type: "number",
3960
+ minimum: 0
3961
+ },
3962
+ media: {
3963
+ type: "number",
3964
+ minimum: 0
3965
+ }
3966
+ }
3967
+ }
3968
+ },
3969
+ costPerKw: {
3970
+ type: "number",
3971
+ minimum: 0
3972
+ }
3973
+ }
3974
+ };
3975
+ }
3976
+ });
3977
+
3978
+ // src/Models/energyReportDaily.js
3979
+ var require_energyReportDaily2 = __commonJS({
3980
+ "src/Models/energyReportDaily.js"(exports2, module2) {
3981
+ var schemas = require_schema();
3982
+ var schema = require_energyReportDaily();
3983
+ var Kohost = require_kohost();
3984
+ schemas.add(schema);
3985
+ var validator = schemas.compile(schema);
3986
+ var energyReportDaily = class extends Kohost {
3987
+ constructor(data) {
3988
+ super(data);
3989
+ }
3990
+ };
3991
+ __name(energyReportDaily, "energyReportDaily");
3992
+ Object.defineProperty(energyReportDaily.prototype, "schema", {
3993
+ value: schema
3994
+ });
3995
+ Object.defineProperty(energyReportDaily.prototype, "validator", {
3996
+ get: function() {
3997
+ return validator;
3998
+ }
3999
+ });
4000
+ Object.defineProperty(energyReportDaily, "validProperties", {
4001
+ value: Object.keys(schema.properties)
4002
+ });
4003
+ Object.defineProperty(energyReportDaily, "actionProperties", {
4004
+ value: ["state"]
4005
+ });
4006
+ module2.exports = energyReportDaily;
4007
+ var dailyShardReport = new energyReportDaily({
4008
+ "id": "RepIdHr1",
4009
+ "type": "energyReportDaily",
4010
+ "roomId": "TestRoom",
4011
+ "first": /* @__PURE__ */ new Date(),
4012
+ "last": /* @__PURE__ */ new Date(),
4013
+ "consumption": [{
4014
+ "id": "1",
4015
+ "type": "dimmer",
4016
+ "kwh": 0.121315
4017
+ }],
4018
+ "totals": [{
4019
+ "lights": 10,
4020
+ "climate": 10,
4021
+ "media": 10
4022
+ }],
4023
+ "costPerKw": 0.14
4024
+ });
4025
+ console.log(dailyShardReport);
4026
+ }
4027
+ });
4028
+
3619
4029
  // src/schemas/property.json
3620
4030
  var require_property = __commonJS({
3621
4031
  "src/schemas/property.json"(exports2, module2) {
@@ -3966,6 +4376,9 @@ var Product = require_product2();
3966
4376
  var DiscoveredDevice = require_discoveredDevice2();
3967
4377
  var Credential = require_credential2();
3968
4378
  var ShortLink = require_shortLink2();
4379
+ var EnergyReportShard = require_energyReportShard2();
4380
+ var EnergyReportHourly = require_energyReportHourly2();
4381
+ var EnergyReportDaily = require_energyReportDaily2();
3969
4382
  var Property = require_property2();
3970
4383
  var Organization = require_organization2();
3971
4384
  module.exports = {
@@ -3994,5 +4407,8 @@ module.exports = {
3994
4407
  DiscoveredDevice,
3995
4408
  Reservation,
3996
4409
  Credential,
3997
- ShortLink
4410
+ ShortLink,
4411
+ EnergyReportShard,
4412
+ EnergyReportHourly,
4413
+ EnergyReportDaily
3998
4414
  };