iobroker.weatherflow-tempest-api
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -80,4 +80,4 @@ { | ||
"lastUpdate": "letzte Aktualisierung der Daten", | ||
"updateInterval": "Aktualisierungsintervall (Min.)", | ||
"updateInterval": "Update intervall (Min.)", | ||
"You like the adapter? Then support me.": "Dir gefällt der Adapter? Dann unterstütze mich." | ||
} |
@@ -5,9 +5,12 @@ { | ||
"items": { | ||
"updateInterval": { | ||
"type": "number", | ||
"label": "updateInterval", | ||
"min": 10, | ||
"step": 1, | ||
"donation_link": { | ||
"type": "staticLink", | ||
"text": "You like the adapter? Then support me.", | ||
"sm": 12, | ||
"md": 2 | ||
"button": true, | ||
"newLine": true, | ||
"href": "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=VWAXSTS634G88&source=url", | ||
"style": { | ||
"justifyContent": "flex-start !important" | ||
} | ||
}, | ||
@@ -31,4 +34,12 @@ "dividerCredentials": { | ||
"sm": 12, | ||
"md": 4 | ||
"md": 3 | ||
}, | ||
"updateInterval": { | ||
"type": "number", | ||
"label": "updateInterval", | ||
"min": 10, | ||
"step": 1, | ||
"sm": 12, | ||
"md": 1 | ||
}, | ||
"dividerUnits": { | ||
@@ -192,14 +203,3 @@ "newLine": true, | ||
}, | ||
"donation_link": { | ||
"type": "staticLink", | ||
"text": "You like the adapter? Then support me.", | ||
"sm": 12, | ||
"button": true, | ||
"newLine": true, | ||
"href": "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=VWAXSTS634G88&source=url", | ||
"style": { | ||
"justifyContent": "flex-start !important" | ||
} | ||
} | ||
} | ||
} |
@@ -25,3 +25,3 @@ "use strict"; | ||
function zeroPad(source, places) { | ||
var zero = places - source.toString().length + 1; | ||
let zero = places - source.toString().length + 1; | ||
return Array(+(zero > 0 && zero)).join("0") + source; | ||
@@ -28,0 +28,0 @@ } |
@@ -25,3 +25,2 @@ "use strict"; | ||
var utils = __toESM(require("@iobroker/adapter-core")); | ||
var import_xmlhttprequest_ts = require("xmlhttprequest-ts"); | ||
var import_moment = __toESM(require("moment")); | ||
@@ -120,10 +119,14 @@ var forecCastTypes = __toESM(require("./lib/foreCastTypes")); | ||
try { | ||
await this.updateForeCast(); | ||
if (this.updateIntervalTimeout) { | ||
this.clearTimeout(this.updateIntervalTimeout); | ||
this.updateIntervalTimeout = null; | ||
if (this.config.stationId && this.config.accessToken) { | ||
await this.updateForeCast(); | ||
if (this.updateIntervalTimeout) { | ||
this.clearTimeout(this.updateIntervalTimeout); | ||
this.updateIntervalTimeout = null; | ||
} | ||
this.updateIntervalTimeout = this.setTimeout(() => { | ||
this.updateData(); | ||
}, this.config.updateInterval * 1e3 * 60); | ||
} else { | ||
this.log.error(`${logPrefix} station id and / or access token missing. Please check your adapter configuration!`); | ||
} | ||
this.updateIntervalTimeout = this.setTimeout(() => { | ||
this.updateData(); | ||
}, this.config.updateInterval * 1e3 * 60); | ||
} catch (error) { | ||
@@ -139,6 +142,6 @@ this.log.error(`${logPrefix} error: ${error}, stack: ${error.stack}`); | ||
const data = await this.downloadData(url); | ||
this.log.info(`${logPrefix} update ForeCast data...`); | ||
this.log.silly(JSON.stringify(data)); | ||
if (data && data.current_conditions) { | ||
await this.updateForeCastCurrent(data.current_conditions); | ||
this.log.info(`${logPrefix} ForeCast data - current conditions updated`); | ||
} else { | ||
@@ -149,3 +152,5 @@ this.log.error(`${logPrefix} Tempest Forecast has no current condition data`); | ||
await this.updateForeCastHourly(data.forecast.hourly); | ||
this.log.info(`${logPrefix} ForeCast data - hourly updated`); | ||
await this.updateForeCastDaily(data.forecast.daily); | ||
this.log.info(`${logPrefix} ForeCast data - daily updated`); | ||
} else { | ||
@@ -170,3 +175,5 @@ this.log.error(`${logPrefix} Tempest Forecast has no forecast data`); | ||
if (!forecCastTypes.stateDefinition[key].ignore) { | ||
await this.createOrUpdateState(idChannelPrefix, forecCastTypes.stateDefinition[key], val, key) ? statesChanged = true : null; | ||
const res = await this.createOrUpdateState(idChannelPrefix, forecCastTypes.stateDefinition[key], val, key); | ||
if (res === true) | ||
statesChanged = true; | ||
} else { | ||
@@ -182,3 +189,3 @@ this.log.debug(`${logPrefix} state '${key}' will be ignored`); | ||
this.createOrUpdateState(idChannelPrefix, forecCastTypes.stateDefinition["lastUpdate"], now, "lastUpdate"); | ||
this.log.debug(`${logPrefix} current data changed -> update state '${idChannelPrefix}.lastUpdate' ${import_moment.default.unix(Number(now)).format(`ddd ${this.dateFormat} HH:mm`)} `); | ||
this.log.debug(`${logPrefix} current data changed -> update state '${idChannelPrefix}.lastUpdate' - ${import_moment.default.unix(Number(now)).format(`ddd ${this.dateFormat} HH:mm`)} `); | ||
} | ||
@@ -206,3 +213,3 @@ } else { | ||
let statesChanged = false; | ||
for (var i = 0; i <= data.length - 1; i++) { | ||
for (let i = 0; i <= data.length - 1; i++) { | ||
const item = data[i]; | ||
@@ -218,3 +225,5 @@ const timestamp = import_moment.default.unix(item.time); | ||
if (!forecCastTypes.stateDefinition[key].ignore) { | ||
await this.createOrUpdateState(idChannel, forecCastTypes.stateDefinition[key], val, key) ? statesChanged = true : null; | ||
const res = await this.createOrUpdateState(idChannel, forecCastTypes.stateDefinition[key], val, key); | ||
if (res === true) | ||
statesChanged = true; | ||
} else { | ||
@@ -238,3 +247,3 @@ this.log.debug(`${logPrefix} state '${key}' will be ignored`); | ||
this.createOrUpdateState(idChannelPrefix, forecCastTypes.stateDefinition["lastUpdate"], now, "lastUpdate"); | ||
this.log.debug(`${logPrefix} hourly data changed -> update state '${idChannelPrefix}.lastUpdate' ${import_moment.default.unix(Number(now)).format(`ddd ${this.dateFormat} HH:mm`)} `); | ||
this.log.debug(`${logPrefix} hourly data changed -> update state '${idChannelPrefix}.lastUpdate' - ${import_moment.default.unix(Number(now)).format(`ddd ${this.dateFormat} HH:mm`)} `); | ||
} | ||
@@ -262,3 +271,3 @@ } else { | ||
let statesChanged = false; | ||
for (var i = 0; i <= data.length - 1; i++) { | ||
for (let i = 0; i <= data.length - 1; i++) { | ||
const item = data[i]; | ||
@@ -274,3 +283,5 @@ const timestamp = import_moment.default.unix(item.day_start_local); | ||
if (!forecCastTypes.stateDefinition[key].ignore) { | ||
await this.createOrUpdateState(idChannel, forecCastTypes.stateDefinition[key], val, key) ? statesChanged = true : null; | ||
const res = await this.createOrUpdateState(idChannel, forecCastTypes.stateDefinition[key], val, key); | ||
if (res === true) | ||
statesChanged = true; | ||
} else { | ||
@@ -294,3 +305,3 @@ this.log.debug(`${logPrefix} state '${key}' will be ignored`); | ||
this.createOrUpdateState(idChannelPrefix, forecCastTypes.stateDefinition["lastUpdate"], now, "lastUpdate"); | ||
this.log.debug(`${logPrefix} daily data changed -> update state '${idChannelPrefix}.lastUpdate' ${import_moment.default.unix(Number(now)).format(`ddd ${this.dateFormat} HH:mm`)} `); | ||
this.log.debug(`${logPrefix} daily data changed -> update state '${idChannelPrefix}.lastUpdate' - ${import_moment.default.unix(Number(now)).format(`ddd ${this.dateFormat} HH:mm`)} `); | ||
} | ||
@@ -384,10 +395,8 @@ } else { | ||
try { | ||
let xhr = new import_xmlhttprequest_ts.XMLHttpRequest(); | ||
xhr.open("GET", url, false); | ||
xhr.send(); | ||
if (xhr.status === 200) { | ||
const response = await fetch(url); | ||
if (response.status === 200) { | ||
this.log.debug(`${logPrefix} Tempest ForeCast data successfully received`); | ||
return JSON.parse(xhr.responseText); | ||
return await response.json(); | ||
} else { | ||
this.log.error(`${logPrefix} Tempest Forecast error, code: ${xhr.status}`); | ||
this.log.error(`${logPrefix} Tempest Forecast error, code: ${response.status}`); | ||
} | ||
@@ -394,0 +403,0 @@ } catch (error) { |
{ | ||
"common": { | ||
"name": "weatherflow-tempest-api", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"news": { | ||
"1.0.1": { | ||
"en": "bug fixes\ndependencies updated", | ||
"de": "fehlerbehebungen\naktualisierte abhängigkeiten", | ||
"ru": "исправления ошибок\nобновленная информация о зависимостях", | ||
"pt": "correções de bugs\ndependências atualizadas", | ||
"nl": "foutherstel\nafhankelijkheden bijgewerkt", | ||
"fr": "corrections des bogues\ndépendances mises à jour", | ||
"it": "correzioni di bug\ndipendenze aggiornate", | ||
"es": "bug fixes\ndependencias actualizadas", | ||
"pl": "poprawki błędów\nzaktualizowane zależności", | ||
"uk": "виправлення помилок\nоновлені залежності", | ||
"zh-cn": "错误修正\n更新依赖关系" | ||
}, | ||
"1.0.0": { | ||
@@ -7,0 +20,0 @@ "en": "forecast api integrated\ninitial release", |
{ | ||
"name": "iobroker.weatherflow-tempest-api", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "WeatherFlow Tempest API", | ||
@@ -27,3 +27,2 @@ "author": { | ||
"@iobroker/adapter-core": "^3.1.6", | ||
"xmlhttprequest-ts": "^1.0.1", | ||
"moment": "^2.30.1" | ||
@@ -37,15 +36,15 @@ }, | ||
"@iobroker/adapter-dev": "^1.3.0", | ||
"@iobroker/testing": "^4.1.3", | ||
"@iobroker/testing": "^5.0.0", | ||
"@tsconfig/node18": "^18.2.4", | ||
"@types/chai-as-promised": "^7.1.8", | ||
"@types/chai": "^4.3.19", | ||
"@types/chai-as-promised": "^8.0.0", | ||
"@types/mocha": "^10.0.8", | ||
"@types/node": "^18.19.50", | ||
"@types/node": "^22.5.5", | ||
"@types/proxyquire": "^1.3.31", | ||
"@types/sinon": "^17.0.3", | ||
"@types/sinon-chai": "^3.2.12", | ||
"@typescript-eslint/eslint-plugin": "^7.18.0", | ||
"@typescript-eslint/parser": "^7.18.0", | ||
"chai-as-promised": "^7.1.2", | ||
"@typescript-eslint/eslint-plugin": "^8.5.0", | ||
"@typescript-eslint/parser": "^8.5.0", | ||
"chai": "^4.5.0", | ||
"chai-as-promised": "^8.0.0", | ||
"eslint": "^8.57.0", | ||
@@ -59,3 +58,3 @@ "mocha": "^10.7.3", | ||
"ts-node": "^10.9.2", | ||
"typescript": "~5.0.4" | ||
"typescript": "~5.6.2" | ||
}, | ||
@@ -62,0 +61,0 @@ "main": "build/main.js", |
@@ -143,2 +143,7 @@ ![Logo](admin/weatherflow-tempest-api.png) | ||
--> | ||
### 1.0.1 (2024-09-15) | ||
- (Scrounger) bug fixes | ||
- (Scrounger) dependencies updated | ||
### 1.0.0 (2024-09-15) | ||
@@ -145,0 +150,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
134620
2
1778
176
1
- Removedxmlhttprequest-ts@^1.0.1
- Removed@angular/common@19.0.0(transitive)
- Removed@angular/core@19.0.0(transitive)
- Removedrxjs@7.8.1(transitive)
- Removedtslib@1.14.12.8.1(transitive)
- Removedxmlhttprequest-ts@1.0.1(transitive)
- Removedzone.js@0.15.0(transitive)