From ea88529858893ba370a1422e250add8fd76ac4cc Mon Sep 17 00:00:00 2001 From: RKBoss6 Date: Sat, 28 Jun 2025 14:24:40 -0400 Subject: [PATCH 1/7] Add feels-like temperature display --- apps/weather/app.js | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/apps/weather/app.js b/apps/weather/app.js index 4875a3877a..b33e20a900 100644 --- a/apps/weather/app.js +++ b/apps/weather/app.js @@ -11,7 +11,7 @@ var layout = new Layout({type:"v", bgCol: g.theme.bg, c: [ {type: "h", filly: 0, c: [ {type: "v", width: g.getWidth()/2, c: [ // Vertical container for icon + UV {type: "custom", fillx: 1, height: g.getHeight()/2 - 30, valign: -1, txt: "unknown", id: "icon", - render: l => weather.drawIcon(l, l.x+l.w/2, l.y+l.h/2, l.w/2-10)}, + render: l => weather.drawIcon(l, l.x+l.w/2, l.y+l.h/2.1, l.w/2.1-10)}, {type: "custom", fillx: 1, height: 20, id: "uvDisplay", render: l => { if (!current || current.uv === undefined) return; @@ -29,7 +29,7 @@ var layout = new Layout({type:"v", bgCol: g.theme.bg, c: [ // Calculate centered position (4px block + 1px spacing) * blocks - last spacing const totalW = labelW + uv * 5 - (uv > 0 ? 1 : 0); const x = l.x + (l.w - totalW) / 2; - const y = l.y + l.h; + const y = l.y + l.h+6; // Draw label g.setColor(g.theme.fg).drawString(label, x, y); @@ -43,13 +43,22 @@ var layout = new Layout({type:"v", bgCol: g.theme.bg, c: [ }, ]}, {type: "v", fillx: 1, c: [ + {pad:5}, {type: "h", pad: 2, c: [ {type: "txt", font: "18%", id: "temp", label: "000"}, {type: "txt", font: "12%", valign: -1, id: "tempUnit", label: "°C"}, ]}, {filly: 1}, - {type: "txt", font: "6x8", pad: 2, halign: 1, label: /*LANG*/"Humidity"}, - {type: "txt", font: "9%", pad: 2, halign: 1, id: "hum", label: "000%"}, + {type: "h", pad: 1, c: [ + {type: "txt", font: "6x8", pad: 2, halign: 1, label: /*LANG*/"Feels:"}, + {type: "txt", font: "9%", pad: 2, halign: 1, id: "feelslike", label: "35°F"}, + ]}, + {filly: 1}, + {type: "h", pad: 2, c: [ + {type: "txt", font: "6x8", pad: 2, halign: 1, label: /*LANG*/"Hum:"}, + {type: "txt", font: "9%", pad: 2, halign: 1, id: "hum", label: "000%"}, + ]}, + {filly: 1}, {type: "txt", font: "6x8", pad: 2, halign: -1, label: /*LANG*/"Wind"}, {type: "h", halign: -1, c: [ @@ -59,7 +68,7 @@ var layout = new Layout({type:"v", bgCol: g.theme.bg, c: [ ]}, ]}, {filly: 1}, - {type: "txt", font: "9%", wrap: true, height: g.getHeight()*0.18, fillx: 1, id: "cond", label: /*LANG*/"Weather condition"}, + {type: "txt", font: "9%",wrap: true, height: g.getHeight()*0.18, fillx: 1, id: "cond", label: /*LANG*/"Weather condition"}, {filly: 1}, {type: "h", c: [ {type: "txt", font: "6x8", pad: 4, id: "loc", label: "Toronto"}, @@ -81,8 +90,15 @@ function draw() { layout.icon.txt = current.txt; layout.icon.code = current.code; const temp = locale.temp(current.temp-273.15).match(/^(\D*\d*)(.*)$/); + const feelsLikeTemp=locale.temp(current.feels-273.15).match(/^(\D*\d*)(.*)$/); layout.temp.label = temp[1]; layout.tempUnit.label = temp[2]; + if (!current || current.feels === undefined){ + layout.feelslike.label = "N/A"; + }else{ + layout.feelslike.label = feelsLikeTemp[1]+feelsLikeTemp[2]; + } + layout.hum.label = current.hum+"%"; const wind = locale.speed(current.wind).match(/^(\D*\d*)(.*)$/); layout.wind.label = wind[1]; @@ -140,4 +156,4 @@ Bangle.setUI("clock"); // This matters for widgets that hide themselves for clocks, like widclk or widclose delete Bangle.CLOCK; -Bangle.drawWidgets(); \ No newline at end of file +Bangle.drawWidgets(); From d97da0d135b391b68d9c05ca00cb8a780f60ae26 Mon Sep 17 00:00:00 2001 From: RKBoss6 Date: Sat, 28 Jun 2025 14:32:50 -0400 Subject: [PATCH 2/7] Update README.md --- apps/weather/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/weather/README.md b/apps/weather/README.md index a90c02b96b..f027b18a93 100644 --- a/apps/weather/README.md +++ b/apps/weather/README.md @@ -8,7 +8,7 @@ You can view the full report through the app: ![Screenshot](screenshot.png) ## iOS Setup -Use the iOS shortcut [here](https://www.icloud.com/shortcuts/dbf7159200d945179e0938c15e64f102). The shortcut uses Apple Weather for weather updates, and sends a notification, which is read by Bangle.js. To push weather every hour, or interval, you will need to create a shortcut automation for every time you want to push the weather. +Use the iOS shortcut [here](https://www.icloud.com/shortcuts/93c186179e4f4c1ead76dbca619cd791). The shortcut uses Apple Weather for weather updates, and sends a notification, which is read by Bangle.js. To push weather every hour, or interval, you will need to create a shortcut automation for every time you want to push the weather. ## Android Setup 1. Install [Gadgetbridge for Android](https://f-droid.org/packages/nodomain.freeyourgadget.gadgetbridge/) on your phone. From 873a19af81e7104c35648516ce10bb0a752c28e1 Mon Sep 17 00:00:00 2001 From: RKBoss6 Date: Sat, 28 Jun 2025 14:33:53 -0400 Subject: [PATCH 3/7] Update README.md Modified the shortcut to show feels like temp, based on @stweedo 's shortcut from their previous PR --- apps/weather/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/weather/README.md b/apps/weather/README.md index f027b18a93..fbca9a02fc 100644 --- a/apps/weather/README.md +++ b/apps/weather/README.md @@ -8,7 +8,7 @@ You can view the full report through the app: ![Screenshot](screenshot.png) ## iOS Setup -Use the iOS shortcut [here](https://www.icloud.com/shortcuts/93c186179e4f4c1ead76dbca619cd791). The shortcut uses Apple Weather for weather updates, and sends a notification, which is read by Bangle.js. To push weather every hour, or interval, you will need to create a shortcut automation for every time you want to push the weather. +Use the [iOS shortcut here](https://www.icloud.com/shortcuts/93c186179e4f4c1ead76dbca619cd791). The shortcut uses Apple Weather for weather updates, and sends a notification, which is read by Bangle.js. To push weather every hour, or interval, you will need to create a shortcut automation for every time you want to push the weather. ## Android Setup 1. Install [Gadgetbridge for Android](https://f-droid.org/packages/nodomain.freeyourgadget.gadgetbridge/) on your phone. From b8854ab20d807d3e963bf4ba047de31337206cfa Mon Sep 17 00:00:00 2001 From: RKBoss6 Date: Sat, 28 Jun 2025 21:13:56 -0400 Subject: [PATCH 4/7] Added feels like clockInfo --- apps/weather/clkinfo.js | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/apps/weather/clkinfo.js b/apps/weather/clkinfo.js index 2f36a600cd..eaf9556e04 100644 --- a/apps/weather/clkinfo.js +++ b/apps/weather/clkinfo.js @@ -1,3 +1,4 @@ + (function() { var weather; var weatherLib = require("weather"); @@ -6,6 +7,7 @@ weather = weatherLib.get(); if(weather){ weather.temp = require("locale").temp(weather.temp-273.15); + weather.feels = require("locale").temp(weather.feels-273.15); weather.hum = weather.hum + "%"; weather.wind = require("locale").speed(weather.wind).match(/^(\D*\d*)(.*)$/); weather.wind = Math.round(weather.wind[1]) + "kph"; @@ -14,6 +16,7 @@ temp: "?", hum: "?", wind: "?", + feels: "?", txt: "?", }; } @@ -50,7 +53,7 @@ weatherLib.on("update", this.updater); }, hide: function () { weatherLib.removeListener("update", this.updater); } - ,run : function() {load("weather.app.js");} + ,run : function() {load("weather.app.js");} }, { name: "condition", @@ -62,7 +65,7 @@ weatherLib.on("update", this.updater); }, hide: function () { weatherLib.removeListener("update", this.updater); } - ,run : function() {load("weather.app.js");} + ,run : function() {load("weather.app.js");} }, { name: "temperature", @@ -74,7 +77,19 @@ weatherLib.on("update", this.updater); }, hide: function () { weatherLib.removeListener("update", this.updater); } - ,run : function() {load("weather.app.js");} + ,run : function() {load("weather.app.js");} + }, + { + name: "feelsLike", + hasRange : true, + get: () => ({ text: weather.feels, img: atob("GBiBAAAAAAHAAAPgAAfgAAfgAAfg4APhsAfxEB/5EB/5ED/9ED/9ED/9ED/9ED/9EB/9UB/7UA/yyAf26Afk7AfmyAfjGAfh8AAAAA=="), + v: parseInt(weather.temp), min: -30, max: 55}), + show: function() { + this.updater = _updater.bind(this); + weatherLib.on("update", this.updater); + }, + hide: function () { weatherLib.removeListener("update", this.updater); } + ,run : function() {load("weather.app.js");} }, { name: "humidity", @@ -86,7 +101,7 @@ weatherLib.on("update", this.updater); }, hide: function () { weatherLib.removeListener("update", this.updater); } - ,run : function() {load("weather.app.js");} + ,run : function() {load("weather.app.js");} }, { name: "wind", @@ -98,7 +113,7 @@ weatherLib.on("update", this.updater); }, hide: function () { weatherLib.removeListener("update", this.updater); } - ,run : function() {load("weather.app.js");} + ,run : function() {load("weather.app.js");} }, ] }; From 6f595c71d16dc5448784edea18ddbf3ab49f98fb Mon Sep 17 00:00:00 2001 From: RKBoss6 Date: Sun, 29 Jun 2025 10:22:53 -0400 Subject: [PATCH 5/7] Hide feels like when no data is available --- apps/weather/app.js | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/apps/weather/app.js b/apps/weather/app.js index 85fc0e1a76..2736578be0 100644 --- a/apps/weather/app.js +++ b/apps/weather/app.js @@ -44,14 +44,15 @@ var layout = new Layout({type:"v", bgCol: g.theme.bg, c: [ ]}, {type: "v", fillx: 1, c: [ {pad:5}, + {type: "h", pad: 2, c: [ {type: "txt", font: "18%", id: "temp", label: "000"}, {type: "txt", font: "12%", valign: -1, id: "tempUnit", label: "°C"}, ]}, {filly: 1}, {type: "h", pad: 1, c: [ - {type: "txt", font: "6x8", pad: 2, halign: 1, label: /*LANG*/"Feels:"}, - {type: "txt", font: "9%", pad: 2, halign: 1, id: "feelslike", label: "35°F"}, + {type: "txt", font: "6x8", pad: 2, halign: 1, id: "feelsLikeLabel",label: /*LANG*/"Feels:"}, + {type: "txt", font: "9%", pad: 2, halign: 1, id: "feelsLike", label: "35°F"}, ]}, {filly: 1}, {type: "h", pad: 2, c: [ @@ -94,9 +95,11 @@ function draw() { layout.temp.label = temp[1]; layout.tempUnit.label = temp[2]; if (!current || current.feels === undefined){ - layout.feelslike.label = "N/A"; + layout.feelsLike.label = ""; + layout.feelsLikeLabel.label=""; }else{ - layout.feelslike.label = feelsLikeTemp[1]+feelsLikeTemp[2]; + layout.feelsLike.label = feelsLikeTemp[1]+feelsLikeTemp[2]; + layout.feelsLikeLabel.label="Feels: "; } layout.hum.label = current.hum+"%"; @@ -106,6 +109,7 @@ function draw() { layout.cond.label = current.txt.charAt(0).toUpperCase()+(current.txt||'').slice(1); layout.loc.label = current.loc; layout.updateTime.label = `${formatDuration(Date.now() - current.time)} ago`; // How to autotranslate this and similar? + //layout.clear(layout.feelsLike); layout.update(); layout.render(); } @@ -125,9 +129,9 @@ function update() { } else { layout.forgetLazyState(); if (NRF.getSecurityStatus().connected) { - E.showMessage(/*LANG*/"Weather\nunknown\n\nIs Gadgetbridge\nweather\nreporting set\nup on your\nphone?"); + E.showMessage(/*LANG*/"Weather data\nexpired.\n\nRe-push weather\ndata from your\nphone"); } else { - E.showMessage(/*LANG*/"Weather\nunknown\n\nGadgetbridge\nnot connected"); + E.showMessage(/*LANG*/"Weather data\n has expired."); NRF.on("connect", update); } } @@ -156,4 +160,4 @@ Bangle.setUI("clock"); // This matters for widgets that hide themselves for clocks, like widclk or widclose delete Bangle.CLOCK; -Bangle.drawWidgets(); \ No newline at end of file +Bangle.drawWidgets(); From 3070bfb2ce3d8bf31b4b8b6fdfccdcf7116dfcb3 Mon Sep 17 00:00:00 2001 From: RKBoss6 Date: Sun, 13 Jul 2025 10:42:25 -0400 Subject: [PATCH 6/7] Update ChangeLog --- apps/weather/ChangeLog | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/weather/ChangeLog b/apps/weather/ChangeLog index f7f86fad73..dcbbab2edc 100644 --- a/apps/weather/ChangeLog +++ b/apps/weather/ChangeLog @@ -24,4 +24,5 @@ 0.25: Added monochrome parameter to drawIcon in lib 0.26: Expose update function (for use by iOS integration) 0.27: Add UV index display -0.28: Fix UV positioning, hide when 0 \ No newline at end of file +0.28: Fix UV positioning, hide when 0 +0.29: Add feels-like temperature data and clock_info From d4f74700374728627736e5d451a9321ce012bb90 Mon Sep 17 00:00:00 2001 From: RKBoss6 Date: Sun, 13 Jul 2025 10:42:34 -0400 Subject: [PATCH 7/7] Update metadata.json --- apps/weather/metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/weather/metadata.json b/apps/weather/metadata.json index 699cdd6274..1781d7fc02 100644 --- a/apps/weather/metadata.json +++ b/apps/weather/metadata.json @@ -1,7 +1,7 @@ { "id": "weather", "name": "Weather", - "version": "0.28", + "version": "0.29", "description": "Show Gadgetbridge/iOS weather report", "icon": "icon.png", "screenshots": [{"url":"screenshot.png"}],