Merge pull request #2420 from rejas/issue_2416

Add new Notification CURRENTWEATHER_TYPE
This commit is contained in:
Michael Teeuw 2021-01-21 15:05:09 +01:00 committed by GitHub
commit 684dfb643b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 202 additions and 97 deletions

View File

@ -12,7 +12,8 @@ _This release is scheduled to be released on 2021-04-01._
### Added ### Added
- Added GitHub workflows for automated testing and changelog enforcement. - Added GitHub workflows for automated testing and changelog enforcement.
- Add CodeCov badge to Readme. - Added CodeCov badge to Readme.
- Added CURRENTWEATHER_TYPE notification to currentweather and weather module, use it in compliments module
### Updated ### Updated

View File

@ -182,34 +182,14 @@ Module.register("compliments", {
}, },
// From data currentweather set weather type // From data currentweather set weather type
setCurrentWeatherType: function (data) { setCurrentWeatherType: function (type) {
var weatherIconTable = { this.currentWeatherType = type;
"01d": "day_sunny",
"02d": "day_cloudy",
"03d": "cloudy",
"04d": "cloudy_windy",
"09d": "showers",
"10d": "rain",
"11d": "thunderstorm",
"13d": "snow",
"50d": "fog",
"01n": "night_clear",
"02n": "night_cloudy",
"03n": "night_cloudy",
"04n": "night_cloudy",
"09n": "night_showers",
"10n": "night_rain",
"11n": "night_thunderstorm",
"13n": "night_snow",
"50n": "night_alt_cloudy_windy"
};
this.currentWeatherType = weatherIconTable[data.weather[0].icon];
}, },
// Override notification handler. // Override notification handler.
notificationReceived: function (notification, payload, sender) { notificationReceived: function (notification, payload, sender) {
if (notification === "CURRENTWEATHER_DATA") { if (notification === "CURRENTWEATHER_TYPE") {
this.setCurrentWeatherType(payload.data); this.setCurrentWeatherType(payload.type);
} }
} }
}); });

View File

@ -47,24 +47,24 @@ Module.register("currentweather", {
roundTemp: false, roundTemp: false,
iconTable: { iconTable: {
"01d": "wi-day-sunny", "01d": "day-sunny",
"02d": "wi-day-cloudy", "02d": "day-cloudy",
"03d": "wi-cloudy", "03d": "cloudy",
"04d": "wi-cloudy-windy", "04d": "cloudy-windy",
"09d": "wi-showers", "09d": "showers",
"10d": "wi-rain", "10d": "rain",
"11d": "wi-thunderstorm", "11d": "thunderstorm",
"13d": "wi-snow", "13d": "snow",
"50d": "wi-fog", "50d": "fog",
"01n": "wi-night-clear", "01n": "night-clear",
"02n": "wi-night-cloudy", "02n": "night-cloudy",
"03n": "wi-night-cloudy", "03n": "night-cloudy",
"04n": "wi-night-cloudy", "04n": "night-cloudy",
"09n": "wi-night-showers", "09n": "night-showers",
"10n": "wi-night-rain", "10n": "night-rain",
"11n": "wi-night-thunderstorm", "11n": "night-thunderstorm",
"13n": "wi-night-snow", "13n": "night-snow",
"50n": "wi-night-alt-cloudy-windy" "50n": "night-alt-cloudy-windy"
} }
}, },
@ -219,7 +219,7 @@ Module.register("currentweather", {
if (this.config.hideTemp === false) { if (this.config.hideTemp === false) {
var weatherIcon = document.createElement("span"); var weatherIcon = document.createElement("span");
weatherIcon.className = "wi weathericon " + this.weatherType; weatherIcon.className = "wi weathericon wi-" + this.weatherType;
large.appendChild(weatherIcon); large.appendChild(weatherIcon);
var temperature = document.createElement("span"); var temperature = document.createElement("span");
@ -502,6 +502,7 @@ Module.register("currentweather", {
this.loaded = true; this.loaded = true;
this.updateDom(this.config.animationSpeed); this.updateDom(this.config.animationSpeed);
this.sendNotification("CURRENTWEATHER_DATA", { data: data }); this.sendNotification("CURRENTWEATHER_DATA", { data: data });
this.sendNotification("CURRENTWEATHER_TYPE", { type: this.config.iconTable[data.weather[0].icon].replace("-", "_") });
}, },
/* scheduleUpdate() /* scheduleUpdate()

View File

@ -154,6 +154,10 @@ Module.register("weather", {
Log.log("New weather information available."); Log.log("New weather information available.");
this.updateDom(0); this.updateDom(0);
this.scheduleUpdate(); this.scheduleUpdate();
if (this.weatherProvider.currentWeather()) {
this.sendNotification("CURRENTWEATHER_TYPE", { type: this.weatherProvider.currentWeather().weatherType.replace("-", "_") });
}
}, },
scheduleUpdate: function (delay = null) { scheduleUpdate: function (delay = null) {

148
package-lock.json generated
View File

@ -266,9 +266,9 @@
} }
}, },
"@eslint/eslintrc": { "@eslint/eslintrc": {
"version": "0.2.2", "version": "0.3.0",
"resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-0.2.2.tgz", "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-0.3.0.tgz",
"integrity": "sha512-EfB5OHNYp1F4px/LI/FEnGylop7nOqkQ1LRzCM0KccA2U8tvV8w01KBv37LbO7nW4H+YhKyo2LcJhRwjjV17QQ==", "integrity": "sha512-1JTKgrOKAHVivSvOYw+sJOunkBjUOvjqWk1DPja7ZFhIS2mX/4EgTT8M7eTK9jrKhL/FvXXEbQwIs3pg1xp3dg==",
"requires": { "requires": {
"ajv": "^6.12.4", "ajv": "^6.12.4",
"debug": "^4.1.1", "debug": "^4.1.1",
@ -277,7 +277,7 @@
"ignore": "^4.0.6", "ignore": "^4.0.6",
"import-fresh": "^3.2.1", "import-fresh": "^3.2.1",
"js-yaml": "^3.13.1", "js-yaml": "^3.13.1",
"lodash": "^4.17.19", "lodash": "^4.17.20",
"minimatch": "^3.0.4", "minimatch": "^3.0.4",
"strip-json-comments": "^3.1.1" "strip-json-comments": "^3.1.1"
} }
@ -1270,9 +1270,9 @@
} }
}, },
"comment-parser": { "comment-parser": {
"version": "0.7.6", "version": "1.1.0",
"resolved": "https://registry.npmjs.org/comment-parser/-/comment-parser-0.7.6.tgz", "resolved": "https://registry.npmjs.org/comment-parser/-/comment-parser-1.1.0.tgz",
"integrity": "sha512-GKNxVA7/iuTnAqGADlTWX4tkhzxZKXp5fLJqKTlQLHkE65XDUKutZ3BHaJC5IGcper2tT3QRD1xr4o3jNpgXXg==", "integrity": "sha512-Q4dQ9niTWOF01ufvH/z6Z3RsBkwr7G42IsaFjuNliL6CY9ZeOEU3jRwTNY2mTY1ibAsASMrXnlQtx2tOb7Q8MA==",
"dev": true "dev": true
}, },
"commondir": { "commondir": {
@ -1966,9 +1966,9 @@
} }
}, },
"engine.io": { "engine.io": {
"version": "4.0.6", "version": "4.1.0",
"resolved": "https://registry.npmjs.org/engine.io/-/engine.io-4.0.6.tgz", "resolved": "https://registry.npmjs.org/engine.io/-/engine.io-4.1.0.tgz",
"integrity": "sha512-rf7HAVZpcRrcKEKddgIzYUnwg0g5HE1RvJaTLwkcfJmce4g+po8aMuE6vxzp6JwlK8FEq/vi0KWN6tA585DjaA==", "integrity": "sha512-vW7EAtn0HDQ4MtT5QbmCHF17TaYLONv2/JwdYsq9USPRZVM4zG7WB3k0Nc321z8EuSOlhGokrYlYx4176QhD0A==",
"requires": { "requires": {
"accepts": "~1.3.4", "accepts": "~1.3.4",
"base64id": "2.0.0", "base64id": "2.0.0",
@ -2119,12 +2119,12 @@
} }
}, },
"eslint": { "eslint": {
"version": "7.17.0", "version": "7.18.0",
"resolved": "https://registry.npmjs.org/eslint/-/eslint-7.17.0.tgz", "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.18.0.tgz",
"integrity": "sha512-zJk08MiBgwuGoxes5sSQhOtibZ75pz0J35XTRlZOk9xMffhpA9BTbQZxoXZzOl5zMbleShbGwtw+1kGferfFwQ==", "integrity": "sha512-fbgTiE8BfUJZuBeq2Yi7J3RB3WGUQ9PNuNbmgi6jt9Iv8qrkxfy19Ds3OpL1Pm7zg3BtTVhvcUZbIRQ0wmSjAQ==",
"requires": { "requires": {
"@babel/code-frame": "^7.0.0", "@babel/code-frame": "^7.0.0",
"@eslint/eslintrc": "^0.2.2", "@eslint/eslintrc": "^0.3.0",
"ajv": "^6.10.0", "ajv": "^6.10.0",
"chalk": "^4.0.0", "chalk": "^4.0.0",
"cross-spawn": "^7.0.2", "cross-spawn": "^7.0.2",
@ -2148,7 +2148,7 @@
"js-yaml": "^3.13.1", "js-yaml": "^3.13.1",
"json-stable-stringify-without-jsonify": "^1.0.1", "json-stable-stringify-without-jsonify": "^1.0.1",
"levn": "^0.4.1", "levn": "^0.4.1",
"lodash": "^4.17.19", "lodash": "^4.17.20",
"minimatch": "^3.0.4", "minimatch": "^3.0.4",
"natural-compare": "^1.4.0", "natural-compare": "^1.4.0",
"optionator": "^0.9.1", "optionator": "^0.9.1",
@ -2235,12 +2235,12 @@
"dev": true "dev": true
}, },
"eslint-plugin-jsdoc": { "eslint-plugin-jsdoc": {
"version": "30.7.13", "version": "31.0.6",
"resolved": "https://registry.npmjs.org/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-30.7.13.tgz", "resolved": "https://registry.npmjs.org/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-31.0.6.tgz",
"integrity": "sha512-YM4WIsmurrp0rHX6XiXQppqKB8Ne5ATiZLJe2+/fkp9l9ExXFr43BbAbjZaVrpCT+tuPYOZ8k1MICARHnURUNQ==", "integrity": "sha512-wGd83EcR+M0HHBgVx3f4gf78z5gMyEil6fqebpAFPeG9fgbUcP1XiWikTWSW3rJrjj7rQvCud6A/IRFMFzanLQ==",
"dev": true, "dev": true,
"requires": { "requires": {
"comment-parser": "^0.7.6", "comment-parser": "1.1.0",
"debug": "^4.3.1", "debug": "^4.3.1",
"jsdoctypeparser": "^9.0.0", "jsdoctypeparser": "^9.0.0",
"lodash": "^4.17.20", "lodash": "^4.17.20",
@ -2693,12 +2693,12 @@
} }
}, },
"find-versions": { "find-versions": {
"version": "3.2.0", "version": "4.0.0",
"resolved": "https://registry.npmjs.org/find-versions/-/find-versions-3.2.0.tgz", "resolved": "https://registry.npmjs.org/find-versions/-/find-versions-4.0.0.tgz",
"integrity": "sha512-P8WRou2S+oe222TOCHitLy8zj+SIsVJh52VP4lvXkaFVnOFFdoWv1H1Jjvel1aI6NCFOAaeAVm8qrI0odiLcww==", "integrity": "sha512-wgpWy002tA+wgmO27buH/9KzyEOQnKsG/R0yrcjPT9BOFm0zRBVQbZ95nRGXWMywS8YR5knRbpohio0bcJABxQ==",
"dev": true, "dev": true,
"requires": { "requires": {
"semver-regex": "^2.0.0" "semver-regex": "^3.1.2"
} }
}, },
"flat": { "flat": {
@ -3218,18 +3218,18 @@
"dev": true "dev": true
}, },
"husky": { "husky": {
"version": "4.3.6", "version": "4.3.8",
"resolved": "https://registry.npmjs.org/husky/-/husky-4.3.6.tgz", "resolved": "https://registry.npmjs.org/husky/-/husky-4.3.8.tgz",
"integrity": "sha512-o6UjVI8xtlWRL5395iWq9LKDyp/9TE7XMOTvIpEVzW638UcGxTmV5cfel6fsk/jbZSTlvfGVJf2svFtybcIZag==", "integrity": "sha512-LCqqsB0PzJQ/AlCgfrfzRe3e3+NvmefAdKQhRYpxS4u6clblBoDdzzvHi8fmxKRzvMxPY/1WZWzomPZww0Anow==",
"dev": true, "dev": true,
"requires": { "requires": {
"chalk": "^4.0.0", "chalk": "^4.0.0",
"ci-info": "^2.0.0", "ci-info": "^2.0.0",
"compare-versions": "^3.6.0", "compare-versions": "^3.6.0",
"cosmiconfig": "^7.0.0", "cosmiconfig": "^7.0.0",
"find-versions": "^3.2.0", "find-versions": "^4.0.0",
"opencollective-postinstall": "^2.0.2", "opencollective-postinstall": "^2.0.2",
"pkg-dir": "^4.2.0", "pkg-dir": "^5.0.0",
"please-upgrade-node": "^3.2.0", "please-upgrade-node": "^3.2.0",
"slash": "^3.0.0", "slash": "^3.0.0",
"which-pm-runs": "^1.0.0" "which-pm-runs": "^1.0.0"
@ -3269,12 +3269,64 @@
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
"dev": true "dev": true
}, },
"find-up": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz",
"integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==",
"dev": true,
"requires": {
"locate-path": "^6.0.0",
"path-exists": "^4.0.0"
}
},
"has-flag": { "has-flag": {
"version": "4.0.0", "version": "4.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
"integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
"dev": true "dev": true
}, },
"locate-path": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz",
"integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==",
"dev": true,
"requires": {
"p-locate": "^5.0.0"
}
},
"p-limit": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz",
"integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==",
"dev": true,
"requires": {
"yocto-queue": "^0.1.0"
}
},
"p-locate": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz",
"integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==",
"dev": true,
"requires": {
"p-limit": "^3.0.2"
}
},
"path-exists": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz",
"integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==",
"dev": true
},
"pkg-dir": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-5.0.0.tgz",
"integrity": "sha512-NPE8TDbzl/3YQYY7CSS228s3g2ollTFnc+Qi3tqmqJp9Vg2ovUpixcJEo2HJScN2Ez+kEaal6y70c0ehqJBJeA==",
"dev": true,
"requires": {
"find-up": "^5.0.0"
}
},
"supports-color": { "supports-color": {
"version": "7.2.0", "version": "7.2.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
@ -5940,9 +5992,9 @@
"integrity": "sha1-De4hahyUGrN+nvsXiPavxf9VN/w=" "integrity": "sha1-De4hahyUGrN+nvsXiPavxf9VN/w="
}, },
"semver-regex": { "semver-regex": {
"version": "2.0.0", "version": "3.1.2",
"resolved": "https://registry.npmjs.org/semver-regex/-/semver-regex-2.0.0.tgz", "resolved": "https://registry.npmjs.org/semver-regex/-/semver-regex-3.1.2.tgz",
"integrity": "sha512-mUdIBBvdn0PLOeP3TEkMH7HHeUP3GjsXCwKarjv/kGmUFOYg1VqEemKhoQpWMu6X2I8kHeuVdGibLGkVK+/5Qw==", "integrity": "sha512-bXWyL6EAKOJa81XG1OZ/Yyuq+oT0b2YLlxx7c+mrdYPaPbnj6WgVULXhinMIeZGufuUBu/eVRqXEhiv4imfwxA==",
"dev": true "dev": true
}, },
"send": { "send": {
@ -6142,9 +6194,9 @@
} }
}, },
"socket.io": { "socket.io": {
"version": "3.0.5", "version": "3.1.0",
"resolved": "https://registry.npmjs.org/socket.io/-/socket.io-3.0.5.tgz", "resolved": "https://registry.npmjs.org/socket.io/-/socket.io-3.1.0.tgz",
"integrity": "sha512-5yWQ43P/4IttmPCGKDQ3CVocBiJWGpibyhYJxgUhf69EHMzmK8XW0DkmHIoYdLmZaVZJyiEkUqpeC7rSCIqekw==", "integrity": "sha512-Aqg2dlRh6xSJvRYK31ksG65q4kmBOqU4g+1ukhPcoT6wNGYoIwSYPlCPuRwOO9pgLUajojGFztl6+V2opmKcww==",
"requires": { "requires": {
"@types/cookie": "^0.4.0", "@types/cookie": "^0.4.0",
"@types/cors": "^2.8.8", "@types/cors": "^2.8.8",
@ -6152,15 +6204,15 @@
"accepts": "~1.3.4", "accepts": "~1.3.4",
"base64id": "~2.0.0", "base64id": "~2.0.0",
"debug": "~4.3.1", "debug": "~4.3.1",
"engine.io": "~4.0.6", "engine.io": "~4.1.0",
"socket.io-adapter": "~2.0.3", "socket.io-adapter": "~2.1.0",
"socket.io-parser": "~4.0.3" "socket.io-parser": "~4.0.3"
}, },
"dependencies": { "dependencies": {
"@types/node": { "@types/node": {
"version": "14.14.20", "version": "14.14.21",
"resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.20.tgz", "resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.21.tgz",
"integrity": "sha512-Y93R97Ouif9JEOWPIUyU+eyIdyRqQR0I8Ez1dzku4hDx34NWh4HbtIc3WNzwB1Y9ULvNGeu5B8h8bVL5cAk4/A==" "integrity": "sha512-cHYfKsnwllYhjOzuC5q1VpguABBeecUp24yFluHpn/BQaVxB1CuQ1FSRZCzrPxrkIfWISXV2LbeoBthLWg0+0A=="
}, },
"debug": { "debug": {
"version": "4.3.1", "version": "4.3.1",
@ -6173,14 +6225,14 @@
} }
}, },
"socket.io-adapter": { "socket.io-adapter": {
"version": "2.0.3", "version": "2.1.0",
"resolved": "https://registry.npmjs.org/socket.io-adapter/-/socket.io-adapter-2.0.3.tgz", "resolved": "https://registry.npmjs.org/socket.io-adapter/-/socket.io-adapter-2.1.0.tgz",
"integrity": "sha512-2wo4EXgxOGSFueqvHAdnmi5JLZzWqMArjuP4nqC26AtLh5PoCPsaRbRdah2xhcwTAMooZfjYiNVNkkmmSMaxOQ==" "integrity": "sha512-+vDov/aTsLjViYTwS9fPy5pEtTkrbEKsw2M+oVSoFGw6OD1IpvlV1VPhUzNbofCQ8oyMbdYJqDtGdmHQK6TdPg=="
}, },
"socket.io-parser": { "socket.io-parser": {
"version": "4.0.3", "version": "4.0.4",
"resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-4.0.3.tgz", "resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-4.0.4.tgz",
"integrity": "sha512-m4ybFiP4UYVORRt7jcdqf8UWx+ywVdAqqsJyruXxAdD3Sv6MDemijWij34mOWdMJ55bEdIb9jACBhxUgNK6sxw==", "integrity": "sha512-t+b0SS+IxG7Rxzda2EVvyBZbvFPBCjJoyHuE0P//7OAsN23GItzDRdWa6ALxZI/8R5ygK7jAR6t028/z+7295g==",
"requires": { "requires": {
"@types/component-emitter": "^1.2.10", "@types/component-emitter": "^1.2.10",
"component-emitter": "~1.3.0", "component-emitter": "~1.3.0",
@ -7819,6 +7871,12 @@
"fd-slicer": "~1.1.0" "fd-slicer": "~1.1.0"
} }
}, },
"yocto-queue": {
"version": "0.1.0",
"resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz",
"integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==",
"dev": true
},
"zip-stream": { "zip-stream": {
"version": "1.2.0", "version": "1.2.0",
"resolved": "https://registry.npmjs.org/zip-stream/-/zip-stream-1.2.0.tgz", "resolved": "https://registry.npmjs.org/zip-stream/-/zip-stream-1.2.0.tgz",

View File

@ -45,10 +45,10 @@
"chai": "^4.2.0", "chai": "^4.2.0",
"chai-as-promised": "^7.1.1", "chai-as-promised": "^7.1.1",
"eslint-config-prettier": "^7.1.0", "eslint-config-prettier": "^7.1.0",
"eslint-plugin-jsdoc": "^30.7.13", "eslint-plugin-jsdoc": "^31.0.6",
"eslint-plugin-prettier": "^3.3.1", "eslint-plugin-prettier": "^3.3.1",
"express-basic-auth": "^1.2.0", "express-basic-auth": "^1.2.0",
"husky": "^4.3.6", "husky": "^4.3.8",
"jsdom": "^16.4.0", "jsdom": "^16.4.0",
"lodash": "^4.17.20", "lodash": "^4.17.20",
"mocha": "^8.2.1", "mocha": "^8.2.1",
@ -69,7 +69,7 @@
"dependencies": { "dependencies": {
"colors": "^1.4.0", "colors": "^1.4.0",
"console-stamp": "^3.0.0-rc4.2", "console-stamp": "^3.0.0-rc4.2",
"eslint": "^7.17.0", "eslint": "^7.18.0",
"express": "^4.17.1", "express": "^4.17.1",
"express-ipfilter": "^1.1.2", "express-ipfilter": "^1.1.2",
"feedme": "^2.0.2", "feedme": "^2.0.2",
@ -83,7 +83,7 @@
"rrule": "^2.6.6", "rrule": "^2.6.6",
"rrule-alt": "^2.2.8", "rrule-alt": "^2.2.8",
"simple-git": "^2.31.0", "simple-git": "^2.31.0",
"socket.io": "^3.0.5", "socket.io": "^3.1.0",
"valid-url": "^1.0.9" "valid-url": "^1.0.9"
}, },
"_moduleAliases": { "_moduleAliases": {

View File

@ -0,0 +1,48 @@
/* Magic Mirror Test config current weather compliments
*
* By rejas https://github.com/rejas
*
* MIT Licensed.
*/
let config = {
port: 8080,
ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"],
language: "en",
timeFormat: 24,
units: "metric",
electronOptions: {
fullscreen: false,
webPreferences: {
nodeIntegration: true
}
},
modules: [
{
module: "compliments",
position: "top_bar",
config: {
compliments: {
snow: ["snow"]
},
updateInterval: 4000
}
},
{
module: "weather",
position: "bottom_bar",
config: {
location: "Munich",
apiKey: "fake key",
initialLoadDelay: 3000
}
}
]
};
/*************** DO NOT EDIT THE LINE BELOW ***************/
if (typeof module !== "undefined") {
module.exports = config;
}

View File

@ -87,6 +87,19 @@ describe("Weather module", function () {
}); });
}); });
describe("Compliments Integration", function () {
before(function () {
process.env.MM_CONFIG_FILE = "tests/configs/modules/weather/currentweather_compliments.js";
});
it("should render a compliment based on the current weather", async function () {
const weather = generateWeather();
await setup({ template, data: weather });
return app.client.waitUntilTextExists(".compliments .module-content span", "snow", 10000);
});
});
describe("Configuration Options", function () { describe("Configuration Options", function () {
before(function () { before(function () {
process.env.MM_CONFIG_FILE = "tests/configs/modules/weather/currentweather_options.js"; process.env.MM_CONFIG_FILE = "tests/configs/modules/weather/currentweather_options.js";

6
vendor/package-lock.json generated vendored
View File

@ -4,9 +4,9 @@
"lockfileVersion": 1, "lockfileVersion": 1,
"dependencies": { "dependencies": {
"@fortawesome/fontawesome-free": { "@fortawesome/fontawesome-free": {
"version": "5.15.1", "version": "5.15.2",
"resolved": "https://registry.npmjs.org/@fortawesome/fontawesome-free/-/fontawesome-free-5.15.1.tgz", "resolved": "https://registry.npmjs.org/@fortawesome/fontawesome-free/-/fontawesome-free-5.15.2.tgz",
"integrity": "sha512-OEdH7SyC1suTdhBGW91/zBfR6qaIhThbcN8PUXtXilY4GYnSBbVqOntdHbC1vXwsDnX0Qix2m2+DSU1J51ybOQ==" "integrity": "sha512-7l/AX41m609L/EXI9EKH3Vs3v0iA8tKlIOGtw+kgcoanI7p+e4I4GYLqW3UXWiTnjSFymKSmTTPKYrivzbxxqA=="
}, },
"a-sync-waterfall": { "a-sync-waterfall": {
"version": "1.0.1", "version": "1.0.1",

2
vendor/package.json vendored
View File

@ -10,7 +10,7 @@
"url": "https://github.com/MichMich/MagicMirror/issues" "url": "https://github.com/MichMich/MagicMirror/issues"
}, },
"dependencies": { "dependencies": {
"@fortawesome/fontawesome-free": "^5.15.1", "@fortawesome/fontawesome-free": "^5.15.2",
"moment": "^2.29.1", "moment": "^2.29.1",
"moment-timezone": "^0.5.32", "moment-timezone": "^0.5.32",
"nunjucks": "^3.2.2", "nunjucks": "^3.2.2",