Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

iobroker.accuweather

Package Overview
Dependencies
Maintainers
17
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

iobroker.accuweather - npm Package Compare versions

Comparing version 1.0.2 to 1.1.0

lib/summaryObject.json

4

CHANGELOG.md

@@ -9,3 +9,7 @@ # Changelog

## v1.1.0 (2019-11-09)
Summary channel added to support automatic weather device detection by type-detector
## v1.0.2 (2019-09-12)
Production Release

38

io-package.json
{
"common": {
"name": "accuweather",
"version": "1.0.2",
"version": "1.1.0",
"news": {
"1.0.3": {
"en": "Summary channel added to support automatic weather device detection by type-detector",
"de": "Zusammenfassungskanal hinzugefügt, um die automatische Erkennung von Wettergeräten durch den Typdetektor zu unterstützen",
"ru": "Добавлен Summary Channel для поддержки автоматического определения погодных устройств с помощью type-detector",
"pt": "Canal de resumo adicionado para oferecer suporte à detecção automática de dispositivos climáticos por detector de tipo",
"nl": "Overzichtskanaal toegevoegd om automatische weerapparaatdetectie door typedetector te ondersteunen",
"fr": "Chaîne récapitulative ajoutée pour permettre la détection automatique du dispositif météorologique par type",
"it": "Aggiunto il canale di riepilogo per supportare il rilevamento automatico dei dispositivi meteorologici mediante rilevatore di tipo",
"es": "Resumen del canal agregado para admitir la detección automática de dispositivos meteorológicos por detector de tipo",
"pl": "Dodano kanał podsumowania w celu obsługi automatycznego wykrywania urządzenia pogodowego według detektora typu",
"zh-cn": "添加了摘要通道以支持类型检测器自动检测天气设备"
},
"1.0.2": {
"en": "Production release",
"de": "Produktionsfreigabe",
"ru": "Первая Версия",
"pt": "Lançamento de produção",
"nl": "Productie release",
"fr": "Production",
"it": "Rilascio di produzione",
"es": "Lanzamiento de la producción",
"pl": "Dopuszczenie do produkcji",
"zh-cn": "生产发布"
"en": "Production release",
"de": "Produktionsfreigabe",
"ru": "Первая Версия",
"pt": "Lançamento de produção",
"nl": "Productie release",
"fr": "Production",
"it": "Rilascio di produzione",
"es": "Lanzamiento de la producción",
"pl": "Dopuszczenie do produkcji",
"zh-cn": "生产发布"
},

@@ -81,4 +93,4 @@ "0.1.0": {

"enabled": true,
"extIcon": "https://raw.githubusercontent.com/algar42/ioBroker.accuweather/master/admin/accuweather.png",
"readme": "https://github.com/algar42/ioBroker.accuweather/blob/master/README.md",
"extIcon": "https://raw.githubusercontent.com/iobroker-community-adapters/ioBroker.accuweather/master/admin/accuweather.png",
"readme": "https://github.com/iobroker-community-adapters/ioBroker.accuweather/blob/master/README.md",
"loglevel": "info",

@@ -85,0 +97,0 @@ "mode": "daemon",

@@ -9,3 +9,3 @@ {

"write": "false",
"role": "value.datetime"
"role": "date"
},

@@ -43,3 +43,3 @@ "native": {}

"write": "false",
"role": "media.url"
"role": "weather.icon"
},

@@ -55,3 +55,3 @@ "native": {}

"write": "false",
"role": "value"
"role": "weather.state"
},

@@ -101,3 +101,3 @@ "native": {}

"write": "false",
"role": "value.temperature",
"role": "value.temperature.feelslike",
"unit": "°C"

@@ -138,3 +138,3 @@ },

"write": "false",
"role": "value",
"role": "value.speed.wind",
"unit": "km/h"

@@ -151,3 +151,3 @@ },

"write": "false",
"role": "value",
"role": "value.direction.wind",
"unit": "°"

@@ -154,0 +154,0 @@ },

@@ -9,3 +9,3 @@ {

"write": "false",
"role": "value.datetime"
"role": "date"
},

@@ -21,3 +21,3 @@ "native": {}

"write": "false",
"role": "value.datetime"
"role": "date.sunrise"
},

@@ -33,3 +33,3 @@ "native": {}

"write": "false",
"role": "value.datetime"
"role": "date.sunset"
},

@@ -45,3 +45,3 @@ "native": {}

"write": "false",
"role": "value.temperature",
"role": "value.temperature.min",
"unit": "°C"

@@ -58,3 +58,3 @@ },

"write": "false",
"role": "value.temperature",
"role": "value.temperature.max",
"unit": "°C"

@@ -71,3 +71,3 @@ },

"write": "false",
"role": "value.temperature",
"role": "value.temperature.feelslike.min",
"unit": "°C"

@@ -84,3 +84,3 @@ },

"write": "false",
"role": "value.temperature",
"role": "value.temperature.feelslike.max",
"unit": "°C"

@@ -119,3 +119,3 @@ },

"write": "false",
"role": "media.url"
"role": "weather.icon"
},

@@ -131,3 +131,3 @@ "native": {}

"write": "false",
"role": "value"
"role": "weather.state"
},

@@ -154,3 +154,3 @@ "native": {}

"write": "false",
"role": "value"
"role": "weather.state.description"
},

@@ -177,3 +177,3 @@ "native": {}

"write": "false",
"role": "value",
"role": "value.precipitation",
"unit":"%"

@@ -238,3 +238,3 @@ },

"write": "false",
"role": "value",
"role": "value.speed.wind",
"unit": "km/h"

@@ -251,3 +251,3 @@ },

"write": "false",
"role": "value",
"role": "value.direction.wind",
"unit": "°"

@@ -312,3 +312,3 @@ },

"write": "false",
"role": "value",
"role": "value.precipitation",
"unit":"mm"

@@ -315,0 +315,0 @@ },

"use strict";
async function createSummaryObjects(adapter) {
const obj = require("./summaryObject.json");
await adapter.setObjectAsync("Summary", {
type: "channel",
common: {
name: "Weather Summary"
},
native: {},
});
const _obj = Object.assign({}, obj);
for (const key in _obj) {
adapter.setObject(key, _obj[key]);
}
}
async function createNextHourForecatObjects(hour, adapter) {

@@ -12,5 +31,13 @@ const obj = require("./nextHourObject.json");

});
const _obj = Object.assign({}, obj);
for (const key in obj) {
await adapter.setObjectAsync(key.replace("nextHour", "Hourly.h" + hour), obj[key]);
for (const key in _obj) {
const measure = {};
const nkey = key.replace("nextHour", "Hourly.h" + hour);
const role = _obj[key].common.role;
measure[nkey] = Object.assign({}, _obj[key]);
measure[nkey].common = Object.assign({}, _obj[key].common);
if (measure[nkey].common.role) { measure[nkey].common.role = role + ".forecast." + hour; }
adapter.log.debug("key: " + nkey + ", role:" + JSON.stringify(measure[nkey].common.role) + ", base: " + role);
adapter.setObject(nkey, measure[nkey]);
}

@@ -20,2 +47,3 @@

async function createCurrentConditionObjects(adapter) {

@@ -32,3 +60,3 @@ const obj = require("./currentCondObject.json");

for (const key in obj) {
await adapter.setObjectAsync(key.replace("nextHour", "Current"), obj[key]);
adapter.setObject(key.replace("nextHour", "Current"), obj[key]);
}

@@ -49,10 +77,27 @@

});
for (const key in obj) {
if (!key.indexOf("dayPart.")) { await adapter.setObjectAsync(key.replace("dayn.", "Day" + i + "."), obj[key]); }
const _obj = Object.assign({}, obj);
for (const key in _obj) {
const measure = {};
let nkey = "";
const role = _obj[key].common.role;
if (!key.indexOf("dayPart.")) {
nkey = key.replace("dayn.", "Day" + i + ".");
measure[nkey] = Object.assign({}, _obj[key]);
measure[nkey].common = Object.assign({}, _obj[key].common);
if (measure[nkey].common.role) { measure[nkey].common.role = role + ".forecast." + (i - 1); }
adapter.setObject(nkey, measure[nkey]);
}
else {
["Day", "Night"].forEach(async function (dp) {
await adapter.setObjectAsync(key.replace("dayn.", "Day" + i + ".").replace("dayPart.", dp + "."), obj[key]);
["Day", "Night"].forEach(function (dp) {
nkey = key.replace("dayn.", "Day" + i + ".").replace("dayPart.", dp + ".");
measure[nkey] = Object.assign({}, _obj[key]);
measure[nkey].common = Object.assign({}, _obj[key].common);
if (measure[nkey].common.role) { measure[nkey].common.role = role + ".forecast." + (i - 1); }
adapter.setObject(nkey, measure[nkey]);
});
}
}

@@ -66,2 +111,3 @@ }

function createHourlyForecastObjects(adapter) {

@@ -76,2 +122,3 @@ for (let hr = 0; hr < 24; hr++) {

exports.createCurrentConditionObjects = createCurrentConditionObjects;
exports.createDailyForecastObjects = createDailyForecastObjects;
exports.createDailyForecastObjects = createDailyForecastObjects;
exports.createSummaryObjects = createSummaryObjects;

@@ -9,3 +9,3 @@ {

"write": "false",
"role": "value.datetime"
"role": "date"
},

@@ -43,3 +43,3 @@ "native": {}

"write": "false",
"role": "media.url"
"role": "weather.icon"
},

@@ -55,3 +55,3 @@ "native": {}

"write": "false",
"role": "value"
"role": "weather.state"
},

@@ -90,3 +90,3 @@ "native": {}

"write": "false",
"role": "value.temperature",
"role": "value.temperature.feelslike",
"unit": "°C"

@@ -115,3 +115,3 @@ },

"write": "false",
"role": "value",
"role": "value.speed.wind",
"unit": "km/h"

@@ -128,3 +128,3 @@ },

"write": "false",
"role": "value",
"role": "value.direction.wind",
"unit": "°"

@@ -187,3 +187,3 @@ },

"write": "false",
"role": "value",
"role": "value.precipitation",
"unit":"%"

@@ -272,3 +272,3 @@ },

"write": "false",
"role": "value",
"role": "value.precipitation",
"unit":"mm"

@@ -275,0 +275,0 @@ },

@@ -36,27 +36,47 @@ "use strict";

/**
* Is called when databases are connected and adapter received configuration.
*/
getCardinalDirection(angle) {
if (typeof angle === "string") angle = parseInt(angle);
if (angle <= 0 || angle > 360 || typeof angle === "undefined") return "☈";
const arrows = { north: "↑N", north_east: "↗NE", east: "→E", south_east: "↘SE", south: "↓S", south_west: "↙SW", west: "←W", north_west: "↖NW" };
const directions = Object.keys(arrows);
const degree = 360 / directions.length;
angle = angle + degree / 4;
for (let i = 0; i < directions.length; i++) {
if (angle >= (i * degree) && angle < (i + 1) * degree) return arrows[directions[i]];
}
return arrows["north"];
}
async setDailyStates(obj) {
setDailyStates(obj) {
const days = obj.DailyForecasts;
try {
for (let day = 1; day <= 5; day++) {
let json = days[day - 1];
for (let key in json) {
const json = days[day - 1];
for (const key in json) {
let dt = null;
switch (key) {
case "Date":
await this.setStateAsync("Daily.Day" + day + "." + key, { val: json[key], ack: true });
dt = new Date(json[key]);
this.setState("Daily.Day" + day + "." + key, { val: json[key], ack: true });
this.setState("Summary.DateTime_d" + day, { val: json[key], ack: true });
this.setState("Summary.DayOfWeek_d"+day, { val: dt.toLocaleString(this.config.language, {weekday: "short"}), ack: true });
break;
case "Sun":
await this.setStateAsync("Daily.Day" + day + ".Sunrise", { val: json[key]["Rise"], ack: true });
await this.setStateAsync("Daily.Day" + day + ".Sunset", { val: json[key]["Set"], ack: true });
this.setState("Daily.Day" + day + ".Sunrise", { val: json[key]["Rise"], ack: true });
this.setState("Daily.Day" + day + ".Sunset", { val: json[key]["Set"], ack: true });
if (day == 1) {
this.setState("Summary.Sunrise", { val: json[key]["Rise"], ack: true });
this.setState("Summary.Sunset", { val: json[key]["Set"], ack: true });
}
break;
case "Temperature":
await this.setStateAsync("Daily.Day" + day + ".Temperature.Minimum", { val: json[key]["Minimum"].Value, ack: true });
await this.setStateAsync("Daily.Day" + day + ".Temperature.Maximum", { val: json[key]["Maximum"].Value, ack: true });
this.setState("Daily.Day" + day + ".Temperature.Minimum", { val: json[key]["Minimum"].Value, ack: true });
this.setState("Daily.Day" + day + ".Temperature.Maximum", { val: json[key]["Maximum"].Value, ack: true });
this.setState("Summary.TempMin_d" + day, { val: json[key]["Minimum"].Value, ack: true });
this.setState("Summary.TempMax_d" + day, { val: json[key]["Maximum"].Value, ack: true });
break;
case "RealFeelTemperature":
await this.setStateAsync("Daily.Day" + day + ".RealFeelTemperature.Minimum", { val: json[key]["Minimum"].Value, ack: true });
await this.setStateAsync("Daily.Day" + day + ".RealFeelTemperature.Maximum", { val: json[key]["Maximum"].Value, ack: true });
this.setState("Daily.Day" + day + ".RealFeelTemperature.Minimum", { val: json[key]["Minimum"].Value, ack: true });
this.setState("Daily.Day" + day + ".RealFeelTemperature.Maximum", { val: json[key]["Maximum"].Value, ack: true });
break;

@@ -66,12 +86,20 @@ case "Day":

{
let json1 = json[key];
for (let key1 in json1) {
const json1 = json[key];
for (const key1 in json1) {
if (typeof json1[key1] !== "object") {
await this.setStateAsync("Daily.Day" + day + "." + key + "." + key1, { val: json1[key1], ack: true });
if (key1==="Icon") {
await this.setStateAsync("Daily.Day" + day + "." + key + ".IconURL", { val: "https://developer.accuweather.com/sites/default/files/"+String(json1[key1]).padStart(2, "0")+"-s.png", ack: true });
await this.setStateAsync("Daily.Day" + day + "." + key + ".IconURLS", { val: "http://vortex.accuweather.com/adc2010/images/slate/icons/"+String(json1[key1]).padStart(2, "0")+".svg", ack: true });
this.setState("Daily.Day" + day + "." + key + "." + key1, { val: json1[key1], ack: true });
if (key1 === "Icon") {
this.setState("Daily.Day" + day + "." + key + ".IconURL", { val: "https://developer.accuweather.com/sites/default/files/" + String(json1[key1]).padStart(2, "0") + "-s.png", ack: true });
this.setState("Daily.Day" + day + "." + key + ".IconURLS", { val: "http://vortex.accuweather.com/adc2010/images/slate/icons/" + String(json1[key1]).padStart(2, "0") + ".svg", ack: true });
if (key == "Day") {
this.setState("Summary.WeatherIconURL_d" + day, { val: "http://vortex.accuweather.com/adc2010/images/slate/icons/" + String(json1[key1]).padStart(2, "0") + ".svg", ack: true });
this.setState("Summary.WeatherIcon_d"+day, { val: json1[key1], ack: true });
}
} else
if (key == "Day") {
if (key1=="IconPhrase") {
this.setState("Summary.WeatherText_d"+day, { val: json1[key1], ack: true });
} else this.setState("Summary."+key1+"_d"+day, { val: json1[key1], ack: true });
}
//https://developer.accuweather.com/sites/default/files/36-s.png
//http://vortex.accuweather.com/adc2010/images/slate/icons/1.svg
} else

@@ -82,11 +110,15 @@ if (typeof json1[key1] == "object") {

if (["TotalLiquid", "Rain", "Snow", "Ice"].includes(key1)) {
await this.setStateAsync("Daily.Day" + day + "." + key + "." + key1 + "Volume", { val: json1[key1].Value, ack: true });
} else { await this.setStateAsync("Daily.Day" + day + "." + key + "." + key1, { val: json1[key1].Value, ack: true }); }
this.setState("Daily.Day" + day + "." + key + "." + key1 + "Volume", { val: json1[key1].Value, ack: true });
this.setState("Summary." + key1 + "Volume_d" + day, { val: json1[key1].Value, ack: true });
} else { this.setState("Daily.Day" + day + "." + key + "." + key1, { val: json1[key1].Value, ack: true }); }
} else
if (key1 == "Wind") {
await this.setStateAsync("Daily.Day" + day + "." + key + ".WindSpeed", { val: json1[key1].Speed.Value, ack: true });
await this.setStateAsync("Daily.Day" + day + "." + key + ".WindDirection", { val: json1[key1].Direction.Degrees, ack: true });
this.setState("Daily.Day" + day + "." + key + ".WindSpeed", { val: json1[key1].Speed.Value, ack: true });
this.setState("Daily.Day" + day + "." + key + ".WindDirection", { val: json1[key1].Direction.Degrees, ack: true });
this.setState("Summary.WindSpeed_d"+day, { val: json1[key1].Speed.Value, ack: true });
this.setState("Summary.WindDirection_d"+day, { val: json1[key1].Direction.Degrees, ack: true });
this.setState("Summary.WindDirectionStr_d"+day, { val: this.getCardinalDirection(json1[key1].Direction.Degrees), ack: true });
} else
if (key1 == "WindGust") {
await this.setStateAsync("Daily.Day" + day + "." + key + ".WindGust", { val: json1[key1].Speed.Value, ack: true });
this.setState("Daily.Day" + day + "." + key + ".WindGust", { val: json1[key1].Speed.Value, ack: true });
}

@@ -102,15 +134,15 @@ }

}
} catch (err) { this.log.error(err); }
}
async setNextHourStates(obj, item, hour) {
setNextHourStates(obj, item, hour) {
const json = obj[item];
try {
for (let key in json) {
for (const key in json) {
if (typeof json[key] !== "object") {
await this.setStateAsync("Hourly.h" + hour + "." + key, { val: json[key], ack: true });
if (key==="WeatherIcon") {
await this.setStateAsync("Hourly.h" + hour + ".WeatherIconURL", { val: "https://developer.accuweather.com/sites/default/files/"+String(json[key]).padStart(2, "0")+"-s.png", ack: true });
await this.setStateAsync("Hourly.h" + hour + ".WeatherIconURLS", { val: "http://vortex.accuweather.com/adc2010/images/slate/icons/"+String(json[key]).padStart(2, "0")+".svg", ack: true });
this.setState("Hourly.h" + hour + "." + key, { val: json[key], ack: true });
if (key === "WeatherIcon") {
this.setState("Hourly.h" + hour + ".WeatherIconURL", { val: "https://developer.accuweather.com/sites/default/files/" + String(json[key]).padStart(2, "0") + "-s.png", ack: true });
this.setState("Hourly.h" + hour + ".WeatherIconURLS", { val: "http://vortex.accuweather.com/adc2010/images/slate/icons/" + String(json[key]).padStart(2, "0") + ".svg", ack: true });
}

@@ -122,11 +154,11 @@ } else

if (["TotalLiquid", "Rain", "Snow", "Ice"].includes(key)) {
await this.setStateAsync("Hourly.h" + hour + "." + key + "Volume", { val: json[key].Value, ack: true });
} else { await this.setStateAsync("Hourly.h" + hour + "." + key, { val: json[key].Value, ack: true }); }
this.setState("Hourly.h" + hour + "." + key + "Volume", { val: json[key].Value, ack: true });
} else { this.setState("Hourly.h" + hour + "." + key, { val: json[key].Value, ack: true }); }
} else
if (key == "Wind") {
await this.setStateAsync("Hourly.h" + hour + ".WindSpeed", { val: json[key].Speed.Value, ack: true });
await this.setStateAsync("Hourly.h" + hour + ".WindDirection", { val: json[key].Direction.Degrees, ack: true });
this.setState("Hourly.h" + hour + ".WindSpeed", { val: json[key].Speed.Value, ack: true });
this.setState("Hourly.h" + hour + ".WindDirection", { val: json[key].Direction.Degrees, ack: true });
} else
if (key == "WindGust") {
await this.setStateAsync("Hourly.h" + hour + ".WindGust", { val: json[key].Speed.Value, ack: true });
this.setState("Hourly.h" + hour + ".WindGust", { val: json[key].Speed.Value, ack: true });
}

@@ -138,13 +170,26 @@ }

async setCurrentStates(obj) {
setCurrentStates(obj) {
const json = obj[0];
try {
for (let key in json) {
for (const key in json) {
//this.log.debug("Current: " + key + ": " + typeof json[key]);
if (typeof json[key] !== "object" && json[key] !== null) {
await this.setStateAsync("Current." + key, { val: json[key], ack: true });
if (key==="WeatherIcon") {
await this.setStateAsync("Current" + ".WeatherIconURL", { val: "https://developer.accuweather.com/sites/default/files/"+String(json[key]).padStart(2, "0")+"-s.png", ack: true });
await this.setStateAsync("Current" + ".WeatherIconURLS", { val: "http://vortex.accuweather.com/adc2010/images/slate/icons/"+String(json[key]).padStart(2, "0")+".svg", ack: true });
this.setState("Current." + key, { val: json[key], ack: true });
if (key === "WeatherIcon") {
this.setState("Current" + ".WeatherIconURL", { val: "https://developer.accuweather.com/sites/default/files/" + String(json[key]).padStart(2, "0") + "-s.png", ack: true });
this.setState("Current" + ".WeatherIconURLS", { val: "http://vortex.accuweather.com/adc2010/images/slate/icons/" + String(json[key]).padStart(2, "0") + ".svg", ack: true });
this.setState("Summary.WeatherIconURL", { val: "http://vortex.accuweather.com/adc2010/images/slate/icons/" + String(json[key]).padStart(2, "0") + ".svg", ack: true });
this.setState("Summary.WeatherIcon", { val: json[key], ack: true });
} else
if (key === "LocalObservationDateTime") {
const dt = new Date(json[key]);
const dow = dt.toLocaleString(this.config.language, {weekday: "short"});
this.setState("Summary.CurrentDateTime", { val: json[key], ack: true });
this.setState("Summary.DayOfWeek", { val: dow, ack: true });
this.log.debug("Date " + dt + ", dow: "+ dt.toLocaleString(this.config.language, {weekday: "short"}));
}
else {
this.setState("Summary." + key, { val: json[key], ack: true });
}
}

@@ -154,13 +199,17 @@ else if (json[key] !== null) {

//this.log.debug(key + ": " + json[key].Metric.Value);
await this.setStateAsync("Current." + key, { val: json[key].Metric.Value, ack: true });
this.setState("Current." + key, { val: json[key].Metric.Value, ack: true });
this.setState("Summary." + key, { val: json[key].Metric.Value, ack: true });
} else
if (key == "Wind") {
await this.setStateAsync("Current.WindSpeed", { val: json[key].Speed.Metric.Value, ack: true });
await this.setStateAsync("Current.WindDirection", { val: json[key].Direction.Degrees, ack: true });
this.setState("Current.WindSpeed", { val: json[key].Speed.Metric.Value, ack: true });
this.setState("Summary.WindSpeed", { val: json[key].Speed.Metric.Value, ack: true });
this.setState("Current.WindDirection", { val: json[key].Direction.Degrees, ack: true });
this.setState("Summary.WindDirection", { val: json[key].Direction.Degrees, ack: true });
this.setState("Summary.WindDirectionStr", { val: this.getCardinalDirection(json[key].Direction.Degrees), ack: true });
} else
if (key == "WindGust") {
await this.setStateAsync("Current.WindGust", { val: json[key].Speed.Metric.Value, ack: true });
this.setState("Current.WindGust", { val: json[key].Speed.Metric.Value, ack: true });
} else
if (key == "PressureTendency") {
await this.setStateAsync("Current.PressureTendency", { val: json[key].LocalizedText, ack: true });
this.setState("Current.PressureTendency", { val: json[key].LocalizedText, ack: true });
}

@@ -173,3 +222,3 @@ }

setHourlyStates(obj) {
for (let hr in obj) {
for (const hr in obj) {
if (typeof obj[hr] == "object" && obj[hr]["DateTime"]) {

@@ -249,2 +298,3 @@ const d = new Date(obj[hr]["DateTime"]);

nextHour.createDailyForecastObjects(this);
nextHour.createSummaryObjects(this);

@@ -257,9 +307,9 @@ this.log.debug("API: " + this.config.apiKey + "; Loc: " + this.config.loKey + " Lang: " + this.config.language);

setInterval(()=>{
const _this=this;
const cdt=new Date();
if ((cdt.getHours()===7 || cdt.getHours()===20) && cdt.getMinutes() <=5 ) {setTimeout(()=>{_this.requst5Days();},Math.random()*10000+1);}
if (cdt.getMinutes() <=5 && cdt.getMinutes() > 0) {setTimeout(()=>{_this.requstCurrent();},Math.random()*10000+1);}
if ((cdt.getHours()===6 || cdt.getHours()===12 || cdt.getHours()===18 || cdt.getHours()===0) && cdt.getMinutes() <=5) {setTimeout(()=>{_this.requst12Hours();},Math.random()*10000+1);}
setInterval(() => {
const _this = this;
const cdt = new Date();
if ((cdt.getHours() === 7 || cdt.getHours() === 20) && cdt.getMinutes() <= 5) { setTimeout(() => { _this.requst5Days(); }, Math.random() * 10000 + 1); }
if (cdt.getMinutes() <= 5 && cdt.getMinutes() > 0) { setTimeout(() => { _this.requstCurrent(); }, Math.random() * 10000 + 1); }
if ((cdt.getHours() === 6 || cdt.getHours() === 12 || cdt.getHours() === 18 || cdt.getHours() === 0) && cdt.getMinutes() <= 5) { setTimeout(() => { _this.requst12Hours(); }, Math.random() * 10000 + 1); }
}, 300000);

@@ -270,20 +320,3 @@

this.requst5Days();
/*
setInterval(() => {
this.requst12Hours();
}, 21600000);
setInterval(() => {
this.requstCurrent();
}, 3600000);
*/
//this.log.info(fres);
//accu=require('./lib/accuapi')()('GqmgWXup3W4DSrGoHpGdB32MR9bSAlPI');
// Initialize your adapter here
// The adapters config (in the instance object everything under the attribute "native") is accessible via
// this.config:
//this.log.info("config option1: " + this.config.option1);
//this.log.info("config option2: " + this.config.option2);
/*

@@ -295,3 +328,3 @@ For every state in the system there has to be also an object of type state

await this.setObjectAsync("updateCurrent", {

@@ -377,4 +410,4 @@ type: "state",

if (obj) {
this.log.debug(`object ${id} changed: ${JSON.stringify(obj)}`);

@@ -395,5 +428,5 @@ } else {

// The state was changed
if (id.indexOf("updateCurrent")) {this.requstCurrent();} else
if (id.indexOf("updateHourly")) {this.requst12Hours();} else
if (id.indexOf("updateDaily")) {this.requst5Days();}
if (id.indexOf("updateCurrent")) { this.requstCurrent(); } else
if (id.indexOf("updateHourly")) { this.requst12Hours(); } else
if (id.indexOf("updateDaily")) { this.requst5Days(); }
this.log.debug(`state ${id} changed: ${state.val} (ack = ${state.ack})`);

@@ -400,0 +433,0 @@ } else {

{
"name": "iobroker.accuweather",
"version": "1.0.2",
"version": "1.1.0",
"description": "Weather forecast using AccuWeather API",

@@ -9,3 +9,3 @@ "author": {

},
"homepage": "https://github.com/algar42/ioBroker.accuweather",
"homepage": "https://github.com/iobroker-community-adapters/ioBroker.accuweather",
"license": "MIT",

@@ -19,3 +19,3 @@ "keywords": [

"type": "git",
"url": "https://github.com/algar42/ioBroker.accuweather"
"url": "https://github.com/iobroker-community-adapters/ioBroker.accuweather"
},

@@ -33,3 +33,3 @@ "dependencies": {

"@types/mocha": "^5.2.7",
"@types/node": "^10.14.17",
"@types/node": "^12.7.8",
"@types/proxyquire": "^1.3.28",

@@ -63,3 +63,3 @@ "@types/sinon": "^7.0.13",

"bugs": {
"url": "https://github.com/algar42/ioBroker.accuweather/issues"
"url": "https://github.com/iobroker-community-adapters/ioBroker.accuweather/issues"
},

@@ -66,0 +66,0 @@ "publishConfig": {

@@ -11,3 +11,3 @@ ![Logo](admin/accuweather.png)

**Tests:**: [![Travis-CI](http://img.shields.io/travis/algar42/ioBroker.accuweather/master.svg)](https://travis-ci.org/algar42/ioBroker.accuweather)
**Tests:**: [![Travis-CI](http://img.shields.io/travis/algar42/ioBroker.accuweather/master.svg)](https://travis-ci.org/algar42/ioBroker.accuweather) [![Greenkeeper badge](https://badges.greenkeeper.io/iobroker-community-adapters/ioBroker.accuweather.svg)](https://greenkeeper.io/)

@@ -32,11 +32,17 @@ ## accuweather adapter for ioBroker

### Using in Lovelace visualization (starting version 1.1.0)
Summary channel contains current and by-day forecast with role/types of states supported by type-detector.
New feature can be used in order to show weather forecast in Lovelace UI.
For better view a custom lovelace card is created - see https://github.com/algar42/IoB.lovelace.accuweather-card
## Changelog
### 0.1.0
* (algar42) First release
### 1.1.0
* (algar42) Summary channel added to support type-detector and automatic weather device creation
### 0.0.1
* (algar42) initial commit
### 1.0.2
* (algar42) Production Release
## License

@@ -43,0 +49,0 @@ MIT License

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc