mirror of
https://github.com/netbymatt/ws4kp.git
synced 2026-04-17 09:09:30 -07:00
Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
872162080d | ||
|
|
69d2b0f40b | ||
|
|
37193112a7 | ||
|
|
0d9c445919 | ||
|
|
6c9fb4cf68 | ||
|
|
59b10ae222 |
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "ws4kp",
|
"name": "ws4kp",
|
||||||
"version": "6.4.0",
|
"version": "6.4.3",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "ws4kp",
|
"name": "ws4kp",
|
||||||
"version": "6.4.0",
|
"version": "6.4.3",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"dotenv": "^17.0.1",
|
"dotenv": "^17.0.1",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "ws4kp",
|
"name": "ws4kp",
|
||||||
"version": "6.4.0",
|
"version": "6.4.3",
|
||||||
"description": "Welcome to the WeatherStar 4000+ project page!",
|
"description": "Welcome to the WeatherStar 4000+ project page!",
|
||||||
"main": "index.mjs",
|
"main": "index.mjs",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
|
|||||||
@@ -324,7 +324,7 @@ const backfill = (data) => {
|
|||||||
// backfill each property
|
// backfill each property
|
||||||
Object.keys(sortedData[0].properties).forEach((key) => {
|
Object.keys(sortedData[0].properties).forEach((key) => {
|
||||||
// qualify the key (must have value)
|
// qualify the key (must have value)
|
||||||
if (Object.hasOwn(sortedData[0].properties[key], 'value')) {
|
if (Object.hasOwn(sortedData[0].properties?.[key] ?? {}, 'value')) {
|
||||||
// backfill this property
|
// backfill this property
|
||||||
result[key] = backfillProperty(sortedData, key);
|
result[key] = backfillProperty(sortedData, key);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ class HourlyGraph extends WeatherDisplay {
|
|||||||
// calculate temperature scale for min and max of dewpoint and temperature
|
// calculate temperature scale for min and max of dewpoint and temperature
|
||||||
const minScale = Math.min(...this.data.dewpoint, ...this.data.temperature);
|
const minScale = Math.min(...this.data.dewpoint, ...this.data.temperature);
|
||||||
const maxScale = Math.max(...this.data.dewpoint, ...this.data.temperature);
|
const maxScale = Math.max(...this.data.dewpoint, ...this.data.temperature);
|
||||||
const thirdScale = (minScale + maxScale) / 3;
|
const thirdScale = (maxScale - minScale) / 3;
|
||||||
const midScale1 = Math.round(minScale + thirdScale);
|
const midScale1 = Math.round(minScale + thirdScale);
|
||||||
const midScale2 = Math.round(minScale + (thirdScale * 2));
|
const midScale2 = Math.round(minScale + (thirdScale * 2));
|
||||||
const tempScale = calcScale(minScale, availableHeight - 10, maxScale, 10);
|
const tempScale = calcScale(minScale, availableHeight - 10, maxScale, 10);
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ const largeIcon = (link, _isNightTime) => {
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.warn(`largeIcon: ${error.message}`);
|
console.warn(`largeIcon: ${error.message}`);
|
||||||
// Return a fallback icon to prevent downstream errors
|
// Return a fallback icon to prevent downstream errors
|
||||||
return addPath(`No-Data.gif?${conditionIcon}${isNightTime ? '-n' : ''}`);
|
return addPath(`No-Data-Large.gif?${conditionIcon}${isNightTime ? '-n' : ''}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// find the icon
|
// find the icon
|
||||||
@@ -102,6 +102,8 @@ const largeIcon = (link, _isNightTime) => {
|
|||||||
|
|
||||||
case 'snow_fzra':
|
case 'snow_fzra':
|
||||||
case 'snow_fzra-n':
|
case 'snow_fzra-n':
|
||||||
|
case 'winter_mix':
|
||||||
|
case 'winter_mix-n':
|
||||||
return addPath('Freezing-Rain-Snow.gif');
|
return addPath('Freezing-Rain-Snow.gif');
|
||||||
|
|
||||||
case 'fzra':
|
case 'fzra':
|
||||||
@@ -141,6 +143,8 @@ const largeIcon = (link, _isNightTime) => {
|
|||||||
return addPath('Thunderstorm.gif');
|
return addPath('Thunderstorm.gif');
|
||||||
|
|
||||||
case 'wind_skc':
|
case 'wind_skc':
|
||||||
|
case 'wind_':
|
||||||
|
case 'wind_-n':
|
||||||
return addPath('Windy.gif');
|
return addPath('Windy.gif');
|
||||||
|
|
||||||
case 'wind_skc-n':
|
case 'wind_skc-n':
|
||||||
@@ -169,7 +173,7 @@ const largeIcon = (link, _isNightTime) => {
|
|||||||
default: {
|
default: {
|
||||||
console.warn(`Unknown weather condition '${conditionIcon}' from ${link}; using fallback icon`);
|
console.warn(`Unknown weather condition '${conditionIcon}' from ${link}; using fallback icon`);
|
||||||
// Return a reasonable fallback instead of false to prevent downstream errors
|
// Return a reasonable fallback instead of false to prevent downstream errors
|
||||||
return addPath(`No-Data.gif?${conditionIcon}${isNightTime ? '-n' : ''}`);
|
return addPath(`No-Data-Large.gif?${conditionIcon}${isNightTime ? '-n' : ''}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -133,6 +133,7 @@ const smallIcon = (link, _isNightTime) => {
|
|||||||
|
|
||||||
case 'wind_few':
|
case 'wind_few':
|
||||||
case 'wind_few-n':
|
case 'wind_few-n':
|
||||||
|
case 'wind_':
|
||||||
return addPath('Wind.gif');
|
return addPath('Wind.gif');
|
||||||
|
|
||||||
case 'wind_sct':
|
case 'wind_sct':
|
||||||
@@ -170,7 +171,7 @@ const smallIcon = (link, _isNightTime) => {
|
|||||||
|
|
||||||
case 'blizzard':
|
case 'blizzard':
|
||||||
case 'blizzard-n':
|
case 'blizzard-n':
|
||||||
return addPath('Blowing Snow.gif');
|
return addPath('Blowing-Snow.gif');
|
||||||
|
|
||||||
default:
|
default:
|
||||||
console.warn(`Unknown weather condition '${conditionIcon}' from ${link}; using fallback icon`);
|
console.warn(`Unknown weather condition '${conditionIcon}' from ${link}; using fallback icon`);
|
||||||
|
|||||||
Reference in New Issue
Block a user