homey-api 3.18.2 → 3.19.0

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.
@@ -0,0 +1,36 @@
1
+ {
2
+ "host": "solar-forecast-api.athom.com",
3
+ "basePath": "/api/v1/",
4
+ "operations": {
5
+ "getSolarForecast": {
6
+ "path": "/forecast/solar",
7
+ "method": "get",
8
+ "private": true,
9
+ "parameters": {
10
+ "secret": {
11
+ "in": "query",
12
+ "type": "string",
13
+ "required": true
14
+ },
15
+ "lat": {
16
+ "in": "query",
17
+ "type": "number",
18
+ "required": true
19
+ },
20
+ "lng": {
21
+ "in": "query",
22
+ "type": "number",
23
+ "required": true
24
+ },
25
+ "strategy": {
26
+ "in": "query",
27
+ "type": "string"
28
+ },
29
+ "panels": {
30
+ "in": "query",
31
+ "type": "array"
32
+ }
33
+ }
34
+ }
35
+ }
36
+ }
@@ -5209,6 +5209,40 @@ export class AthomSetupAPI {
5209
5209
  getTimezone(): Promise<any>;
5210
5210
  }
5211
5211
 
5212
+ export class AthomSolarForecastAPI {
5213
+ constructor(opts?: {
5214
+ baseUrl?: string;
5215
+
5216
+ debug?: boolean;
5217
+
5218
+ secret?: string;
5219
+ });
5220
+
5221
+ getSolarForecast(opts: {
5222
+ secret: string;
5223
+
5224
+ lat: number;
5225
+
5226
+ lng: number;
5227
+
5228
+ strategy?: string;
5229
+
5230
+ panels?: Array<any>;
5231
+ }): Promise<any>;
5232
+
5233
+ getSolarForecast(opts: {
5234
+ secret: string;
5235
+
5236
+ lat: number;
5237
+
5238
+ lng: number;
5239
+
5240
+ strategy?: string;
5241
+
5242
+ panels?: Array<any>;
5243
+ }): Promise<any>;
5244
+ }
5245
+
5212
5246
  export class AthomStoreAPI {
5213
5247
  constructor(opts?: {
5214
5248
  baseUrl?: string;
@@ -8729,6 +8763,40 @@ export class AthomSetupAPI {
8729
8763
  getTimezone(): Promise<any>;
8730
8764
  }
8731
8765
 
8766
+ export class AthomSolarForecastAPI {
8767
+ constructor(opts?: {
8768
+ baseUrl?: string;
8769
+
8770
+ debug?: boolean;
8771
+
8772
+ secret?: string;
8773
+ });
8774
+
8775
+ getSolarForecast(opts: {
8776
+ secret: string;
8777
+
8778
+ lat: number;
8779
+
8780
+ lng: number;
8781
+
8782
+ strategy?: string;
8783
+
8784
+ panels?: Array<any>;
8785
+ }): Promise<any>;
8786
+
8787
+ getSolarForecast(opts: {
8788
+ secret: string;
8789
+
8790
+ lat: number;
8791
+
8792
+ lng: number;
8793
+
8794
+ strategy?: string;
8795
+
8796
+ panels?: Array<any>;
8797
+ }): Promise<any>;
8798
+ }
8799
+
8732
8800
  export class AthomStoreAPI {
8733
8801
  constructor(opts?: {
8734
8802
  baseUrl?: string;
package/index.js CHANGED
@@ -21,6 +21,7 @@ module.exports.AthomWeatherAPI = require('./lib/AthomWeatherAPI');
21
21
  module.exports.AthomWebhooksAPI = require('./lib/AthomWebhooksAPI');
22
22
  module.exports.AthomEnergyAPI = require('./lib/AthomEnergyAPI');
23
23
  module.exports.AthomDeviceFirmwareAPI = require('./lib/AthomDeviceFirmwareAPI');
24
+ module.exports.AthomSolarForecastAPI = require('./lib/AthomSolarForecastAPI');
24
25
 
25
26
  // Homey Cloud
26
27
  module.exports.HomeyCloudAPI = require('./lib/HomeyCloudAPI');
@@ -0,0 +1,13 @@
1
+ 'use strict';
2
+
3
+ const API = require('./API');
4
+
5
+ class AthomSolarForecastAPI extends API {
6
+
7
+ static SPECIFICATION = require('../assets/specifications/AthomSolarForecastAPI.json');
8
+ static SPECIFICATION_URL = 'https://solar-forecast-api.athom.com/api/v1/specification.json';
9
+ static JSDOC_PRIVATE = true;
10
+
11
+ }
12
+
13
+ module.exports = AthomSolarForecastAPI;
@@ -102,9 +102,14 @@ class DeviceCapability extends EventEmitter {
102
102
  return;
103
103
  }
104
104
 
105
- const nextLastChanged = new Date(transactionTime);
106
-
107
- if (this.lastChanged != null && nextLastChanged.getTime() === this.lastChanged.getTime()) {
105
+ const currentLastChanged = this.lastChanged;
106
+ const nextLastChanged = transactionTime == null
107
+ ? null
108
+ : new Date(transactionTime);
109
+
110
+ if (currentLastChanged != null
111
+ && nextLastChanged != null
112
+ && nextLastChanged.getTime() === currentLastChanged.getTime()) {
108
113
  return;
109
114
  }
110
115
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "homey-api",
3
- "version": "3.18.2",
3
+ "version": "3.19.0",
4
4
  "description": "Homey API",
5
5
  "main": "index.js",
6
6
  "license": "SEE LICENSE",