martijndierckx před 5 roky
rodič
revize
eb0fe93c48

+ 1 - 1
dist/Hydrawise.d.ts

@@ -96,7 +96,7 @@ export declare class Hydrawise {
      * @param {boolean} [onlyConfigured = true] - Only return zones/relays which have been configured
      * @return {Promise} A Promise which will be resolved when all zones have been retrieved
      */
-    getZones(onlyConfigured?: boolean): Promise<HydrawiseZone[]>;
+    getZones(): Promise<HydrawiseZone[]>;
     /**
      * Retrieves all controllers known to the Hydrawise cloud
      * @return {Promise} A Promise which will be resolved when all controllers have been retrieved

Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 0 - 0
dist/Hydrawise.d.ts.map


+ 4 - 4
dist/Hydrawise.js

@@ -26,7 +26,7 @@ class Hydrawise {
     constructor(options) {
         this.cloudUrl = 'https://app.hydrawise.com/api/v1/';
         this.type = options.type || HydrawiseConnectionType_1.HydrawiseConnectionType.CLOUD; // CLOUD or LOCAL 
-        this.url = options.host ? 'http://' + options.host + '/' : this.cloudUrl;
+        this.url = (this.type == HydrawiseConnectionType_1.HydrawiseConnectionType.LOCAL ? 'http://' + options.host + '/' : this.cloudUrl);
         // Local Auth
         this.localAuthUsername = options.user || 'admin';
         this.localAuthPassword = options.password || '';
@@ -57,7 +57,7 @@ class Hydrawise {
             }
             // API key auth for cloud binding
             else {
-                options.qs.api_key = this.cloudAuthAPIkey;
+                options.params.api_key = this.cloudAuthAPIkey;
             }
             // Send request
             axios_1.default(options).then((response) => {
@@ -191,7 +191,7 @@ class Hydrawise {
      * @param {boolean} [onlyConfigured = true] - Only return zones/relays which have been configured
      * @return {Promise} A Promise which will be resolved when all zones have been retrieved
      */
-    getZones(onlyConfigured = true) {
+    getZones() {
         let that = this;
         // Get started
         let promise = new Promise((resolve, reject) => {
@@ -201,7 +201,7 @@ class Hydrawise {
                 // Check every returned relay
                 data.relays.map((z) => {
                     // Only configured zones
-                    if (onlyConfigured && z.type != 110) {
+                    if (that.type == HydrawiseConnectionType_1.HydrawiseConnectionType.CLOUD || z.lastwaterepoch != 0) {
                         // Zone
                         let zone = {
                             apiBinding: that,

Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 0 - 0
dist/Hydrawise.js.map


+ 2 - 2
dist/HydrawiseZone.d.ts

@@ -32,7 +32,7 @@ export declare class HydrawiseZone {
      * @param {number} [duration] - How long should the command be executed
      * @return {Promise} A Promise which will be resolved when the command has been executed.
      */
-    run(duration: number): Promise<any>;
+    run(duration?: number): Promise<any>;
     /**
      * Sends the stop command to the zone/relay
      * @return {Promise} A Promise which will be resolved when the command has been executed.
@@ -43,6 +43,6 @@ export declare class HydrawiseZone {
      * @param {number} [duration] - How long should the command be executed
      * @return {Promise} A Promise which will be resolved when the command has been executed.
      */
-    suspend(duration: number): Promise<any>;
+    suspend(duration?: number): Promise<any>;
 }
 //# sourceMappingURL=HydrawiseZone.d.ts.map

+ 1 - 1
dist/HydrawiseZone.d.ts.map

@@ -1 +1 @@
-{"version":3,"file":"HydrawiseZone.d.ts","sourceRoot":"","sources":["../src/HydrawiseZone.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,0CAA0C;AAC1C,qBAAa,aAAa;IAElB,UAAU,EAAE,SAAS,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,IAAI,CAAC;IAChB,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,EAAE,OAAO,CAAC;IACrB,SAAS,EAAE,OAAO,CAAC;IACnB,oBAAoB,EAAE,MAAM,CAAC;IAEpC;;;;;;;;;;;;OAYG;gBACS,OAAO,EAAE,GAAG;IAYxB;;;;OAIG;IACH,GAAG,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;IAInC;;;OAGG;IACH,IAAI,IAAI,OAAO,CAAC,GAAG,CAAC;IAIpB;;;;OAIG;IACH,OAAO,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;CAGvC"}
+{"version":3,"file":"HydrawiseZone.d.ts","sourceRoot":"","sources":["../src/HydrawiseZone.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,0CAA0C;AAC1C,qBAAa,aAAa;IAElB,UAAU,EAAE,SAAS,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,IAAI,CAAC;IAChB,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,EAAE,OAAO,CAAC;IACrB,SAAS,EAAE,OAAO,CAAC;IACnB,oBAAoB,EAAE,MAAM,CAAC;IAEpC;;;;;;;;;;;;OAYG;gBACS,OAAO,EAAE,GAAG;IAYxB;;;;OAIG;IACH,GAAG,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;IAIpC;;;OAGG;IACH,IAAI,IAAI,OAAO,CAAC,GAAG,CAAC;IAIpB;;;;OAIG;IACH,OAAO,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;CAGxC"}

+ 1 - 1
dist/HydrawiseZone.js.map

@@ -1 +1 @@
-{"version":3,"file":"HydrawiseZone.js","sourceRoot":"","sources":["../src/HydrawiseZone.ts"],"names":[],"mappings":";AAAA;;GAEG;;AAIH,0CAA0C;AAC1C,MAAa,aAAa;IAYzB;;;;;;;;;;;;OAYG;IACH,YAAY,OAAY;QACvB,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;QACrC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;QAC/B,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;QACzB,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;QAC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,OAAO,CAAC,WAAW,CAAC;QACvC,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;QACnC,IAAI,CAAC,oBAAoB,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAC1D,CAAC;IAED;;;;OAIG;IACH,GAAG,CAAC,QAAiB;QACpB,OAAO,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,KAAK,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC;IAC3D,CAAC;IAED;;;OAGG;IACH,IAAI;QACH,OAAO,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IAClD,CAAC;IAED;;;;OAIG;IACH,OAAO,CAAC,QAAiB;QACxB,OAAO,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,SAAS,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC;IAC/D,CAAC;CACD;AA9DD,sCA8DC"}

+ 4 - 4
src/Hydrawise.ts

@@ -38,7 +38,7 @@ export class Hydrawise {
 	 */
 	constructor(options: HydrawiseConfiguration) {
 		this.type = options.type || HydrawiseConnectionType.CLOUD; // CLOUD or LOCAL 
-		this.url = options.host ? 'http://'+options.host+'/' : this.cloudUrl;
+		this.url = (this.type == HydrawiseConnectionType.LOCAL ? 'http://'+options.host+'/' : this.cloudUrl);
 		
 		// Local Auth
 		this.localAuthUsername = options.user || 'admin';
@@ -74,7 +74,7 @@ export class Hydrawise {
 			}
 			// API key auth for cloud binding
 			else {
-				options.qs.api_key = this.cloudAuthAPIkey;
+				options.params.api_key = this.cloudAuthAPIkey;
 			}
 
 			// Send request
@@ -231,7 +231,7 @@ export class Hydrawise {
 	 * @param {boolean} [onlyConfigured = true] - Only return zones/relays which have been configured
 	 * @return {Promise} A Promise which will be resolved when all zones have been retrieved
 	 */
-	public getZones(onlyConfigured: boolean = true): Promise<HydrawiseZone[]> {
+	public getZones(): Promise<HydrawiseZone[]> {
 		let that = this;
 	
 		// Get started
@@ -245,7 +245,7 @@ export class Hydrawise {
 				data.relays.map((z: any) => {
 					
 					// Only configured zones
-					if(onlyConfigured && z.type != 110) {
+					if(that.type == HydrawiseConnectionType.CLOUD || z.lastwaterepoch != 0){
 					
 						// Zone
 						let zone: any = {

+ 2 - 2
src/HydrawiseZone.ts

@@ -47,7 +47,7 @@ export class HydrawiseZone {
 	 * @param {number} [duration] - How long should the command be executed
 	 * @return {Promise} A Promise which will be resolved when the command has been executed.
 	 */
-	run(duration: number): Promise<any> {
+	run(duration?: number): Promise<any> {
 		return this.apiBinding.commandZone('run', this, duration);
 	}
 
@@ -64,7 +64,7 @@ export class HydrawiseZone {
 	 * @param {number} [duration] - How long should the command be executed
 	 * @return {Promise} A Promise which will be resolved when the command has been executed.
 	 */
-	suspend(duration: number): Promise<any> {
+	suspend(duration?: number): Promise<any> {
 		return this.apiBinding.commandZone('suspend', this, duration);
 	}
 }

Některé soubory nejsou zobrazeny, neboť je v těchto rozdílových datech změněno mnoho souborů