Use official writing of OpenWeatherMap

Short documentation on how to get a OWN API key
master
Marco H 2022-07-06 08:12:33 +02:00 committed by Marco Heiming
parent 970c344c11
commit a256bbed00
3 changed files with 24 additions and 9 deletions

View File

@ -1,12 +1,12 @@
# Open Weather Map weather provider # OpenWeatherMap weather provider
This updates [Weather](https://banglejs.com/apps/#weather) with data from the Open Weather Map API This updates [Weather](https://banglejs.com/apps/#weather) with data from the OpenWeatherMap API
## Usage ## Usage
Just install and configure the app. This needs an internet-enabled Gadgetbridge version. Just install and configure the app. This needs an internet-enabled Gadgetbridge version.
Install [My Location](https://banglejs.com/apps/#mylocation) to change the location for the weather requests. Install [My Location](https://banglejs.com/apps/#mylocation) to change the location for the weather requests.
Install one of the text input libraries to modify the API key in the settings Install one of the text input libraries to set the API key in the app settings or use the web interface.
## Creator ## Creator

View File

@ -3,13 +3,27 @@
<link rel="stylesheet" href="../../css/spectre.min.css"> <link rel="stylesheet" href="../../css/spectre.min.css">
</head> </head>
<body> <body>
<h3>Set OWM API key</h3> <h3>Set OpenWeatherMap (OWM) API key</h3>
<p><input id="apikey" style="width:90%;"></input></p> <p><input id="apikey" onkeyup="checkInput()" style="width:90%; margin: 3px"></input><button id="upload" class="btn btn-primary">Save key</button></p>
<p><button id="upload" class="btn btn-primary">Set</button></p>
<h4>Where to get your personal API key?</h4>
<p>Go to <a href="https://home.openweathermap.org/users/sign_up">https://home.openweathermap.org/users/sign_up</a> and sign up for a free account.<br>
After registration you can login and optain your personal API key.</p>
<script src="../../core/lib/interface.js"></script> <script src="../../core/lib/interface.js"></script>
<script> <script>
function checkInput() {
if(document.getElementById("apikey").value==="") {
document.getElementById('upload').disabled = true;
} else {
document.getElementById('upload').disabled = false;
}
}
checkInput();
var settings = {}; var settings = {};
function onInit(){ function onInit(){
console.log("Loading settings from BangleJs..."); console.log("Loading settings from BangleJs...");
@ -20,6 +34,7 @@
console.log("Got settings", settings); console.log("Got settings", settings);
document.getElementById("apikey").value = settings.apikey; document.getElementById("apikey").value = settings.apikey;
console.log("Loaded apikey from BangleJs."); console.log("Loaded apikey from BangleJs.");
checkInput();
} }
}); });
} catch(ex) { } catch(ex) {

View File

@ -1,8 +1,8 @@
{ "id": "owmweather", { "id": "owmweather",
"name": "Open Weather Map weather provider", "name": "OpenWeatherMap weather provider",
"shortName":"OWM Weather", "shortName":"OWM Weather",
"version":"0.01", "version":"0.01",
"description": "Pulls weather from OWM API", "description": "Pulls weather from OpenWeatherMap (OWM) API",
"icon": "app.png", "icon": "app.png",
"type": "bootloader", "type": "bootloader",
"tags": "boot,tool,weather", "tags": "boot,tool,weather",