Skip to content

Commit

Permalink
Add Windy Support
Browse files Browse the repository at this point in the history
Closes #71
  • Loading branch information
maxwellpower committed May 18, 2019
1 parent 57a283b commit 7294219
Show file tree
Hide file tree
Showing 6 changed files with 136 additions and 37 deletions.
12 changes: 8 additions & 4 deletions README.md
Expand Up @@ -2,7 +2,7 @@
## AcuRite®‎ Access/smartHUB and IP Camera Data Processing, Display, and Upload.
### See it in action @ [ghwx.ca](https://www.ghwx.ca)

Acuparse is a PHP/MySQL program that captures, stores, and displays weather data from an AcuRite®‎ 5-in-1/Atlas weather station and tower sensors, via your Access/smartHUB. It uploads weather data to Weather Underground, Weathercloud, PWS Weather, and CWOP. It also processes and stores images from a local network camera for display and uploads to Weather Underground.
Acuparse is a PHP/MySQL program that captures, stores, and displays weather data from an AcuRite®‎ 5-in-1/Atlas weather station and tower sensors, via your Access/smartHUB. It uploads weather data to Weather Underground, Weathercloud, PWS Weather, Windy, and CWOP. It also processes and stores images from a local network camera for display and uploads to Weather Underground.

Built for weather geeks and designed to be clean, simple, and mobile friendly. It uses a minimal UI with a focus on data, not flashy graphics. Designed to compliment MyAcuRite and other 3rd party's sites and tools.

Expand All @@ -12,7 +12,7 @@ Users currently having trouble sending updates to Weather Underground should fin

# Features:
* **Your weather data belongs to you, stored on your OWN server.**
* Display live camera images, send them to Weather Underground, and link from other sites.
* Display live camera images, send them to Weather Underground, and link from other sites like Weathercloud.
* Uploads weather data from your 5-in-1/Atlas and Tower sensors to external providers.
* Customize barometer readings.
* Light and Dark Themes.
Expand Down Expand Up @@ -60,9 +60,9 @@ Additionally, you can request Bootstrap 4 formatted HTML, a JSON array, or plain
See [docs/INSTALL.md](https://acuparse.github.io/acuparse/INSTALL) for detailed installation instructions.

Installing on a fresh instance of a Debian based OS is the only officially supported and tested install method.
Installing on a fresh instance of a Debian/Ubuntu OS is the only officially supported and tested install method.

Acuparse can, **in theory**, be run locally on a Raspberry Pi(Raspbian). Some installer modifications might be required, if not using a supported OS.
Acuparse can, **in theory**, be run locally on a Raspberry Pi(Raspbian). It is not officially supported by the installer! Some modifications/manual configuration might be required on ARM platforms.

**Access Users**

Expand All @@ -80,6 +80,10 @@ If you experience unexpected results during or after your install, remove the co

`sudo rm /opt/acuparse/src/usr/config.php`

If you receive a '1' after your install. Check to ensure the database was installed correctly.

* See "Setup Database" in [docs/INSTALL.md](https://acuparse.github.io/acuparse/INSTALL)

# Updating:
Detailed upgrade instructions for significant releases will be published in the docs/updates folder if required.

Expand Down
14 changes: 14 additions & 0 deletions cron/cron.php
Expand Up @@ -207,6 +207,20 @@
}
}

// Build Windy Update
if ($config->upload->windy->enabled === true) {
$windyQueryUrl = $config->upload->windy->url . '/' . $config->upload->windy->key;
$windyQuery = '?tempf=' . $data->tempF . '&winddir=' . $data->windDEG . '&windspeedmph=' . $data->windSmph . '&baromin=' . $data->pressure_inHg . '&humidity=' . $data->relH . '&dewptf=' . $data->dewptF . '&rainin=' . $data->rainIN . '&dailyrainin=' . $data->rainTotalIN_today;
$windyQueryResult = file_get_contents(htmlspecialchars($windyQueryUrl . $windyQuery));
// Save to DB
mysqli_query($conn,
"INSERT INTO `windy_updates` (`query`,`result`) VALUES ('$windyQuery', '$windyQueryResult')");
if ($config->debug->logging === true) {
// Log it
syslog(LOG_DEBUG, "(EXTERNAL)[Windy]: Query = $windyQuery | Result = $windyQueryResult");
}
}

// Build Generic WU Based Update
if ($config->upload->generic->enabled === true) {
$genericQueryUrl = $config->upload->generic->url . '?ID=' . $config->upload->generic->id . '&PASSWORD=' . $config->upload->generic->password;
Expand Down
12 changes: 12 additions & 0 deletions docs/external/WINDY.md
@@ -0,0 +1,12 @@
# Windy Updater

## Registration
1. Go to https://community.windy.com/register and fill out the form.
2. Agree to the data collection policy.
3. Visit https://stations.windy.com/stations and add a new station.
4. When your station is added, click "Show Key" to get your API Key.

## Configuration
1. Change enabled to true
2. Add your Windy API ID and Key
3. Get your ID from https://stations.windy.com/stations. **Note, this is your "ID" NOT "Station ID"**
9 changes: 8 additions & 1 deletion src/inc/nav.php
Expand Up @@ -61,7 +61,8 @@
<a class="<?= ($liveCamActive === true) ? 'dropdown-item active' : 'dropdown-item' ?>"
href="/camera"><i class="far fa-eye" aria-hidden="true"></i> Live View</a>
<a class="<?= ($camArchiveActive === true) ? 'dropdown-item active' : 'dropdown-item' ?>"
href="/camera?archive" data-instant><i class="far fa-images" aria-hidden="true"></i> Archive</a>
href="/camera?archive" data-instant><i class="far fa-images" aria-hidden="true"></i>
Archive</a>
</div>
</li>
<?php }
Expand Down Expand Up @@ -92,6 +93,12 @@ class="fas fa-external-link-square-alt" aria-hidden="true"></i> External</a>
target="_blank"><img src="/img/external/pws.ico" width="16" height="16"
aria-hidden="true" alt="PWS Icon"> PWS Weather</a>
<?php } ?>
<?php if ($config->upload->windy->enabled === true) { ?>
<a class="dropdown-item"
href="//www.windy.com/station/pws-<?= $config->upload->windy->id; ?>"
target="_blank"><img src="/img/external/windy.ico" width="16" height="16"
aria-hidden="true" alt="Windy Icon"> Windy</a>
<?php } ?>
<?php if ($config->upload->cwop->enabled === true) { ?>
<a class="dropdown-item"
href="http://www.findu.com/cgi-bin/wxpage.cgi?call=<?= $config->upload->cwop->id; ?>"
Expand Down
126 changes: 94 additions & 32 deletions src/pub/admin/settings.php
Expand Up @@ -150,6 +150,11 @@
$config->upload->wc->device = (isset($_POST['upload']['wc']['device'])) ? $_POST['upload']['wc']['device'] : null;
$config->upload->wc->url = (isset($_POST['upload']['wc']['url'])) ? $_POST['upload']['wc']['url'] : null;

// Windy
$config->upload->windy->enabled = (bool)$_POST['upload']['windy']['enabled'];
$config->upload->wc->id = (isset($_POST['upload']['windy']['id'])) ? $_POST['upload']['windy']['id'] : null;
$config->upload->windy->key = (isset($_POST['upload']['windy']['key'])) ? $_POST['upload']['windy']['key'] : null;

// Generic
$config->upload->generic->enabled = (bool)$_POST['upload']['generic']['enabled'];
$config->upload->generic->id = (isset($_POST['upload']['generic']['id'])) ? $_POST['upload']['generic']['id'] : null;
Expand Down Expand Up @@ -908,7 +913,7 @@ class="form-control">
</div>
<div class="row">
<!-- Master Temp Sensor -->
<div class="col-md-6 col-12 mx-auto alert alert-secondary">
<div class="col-md-6 col-12 border alert alert-secondary">
<h3 class="panel-heading">Master Temp/Humidity Sensor</h3>
<p>Choose the main sensor used when uploading Temp/Humidity data to
3rd party sites. This does not affect the main dashboard.</p>
Expand Down Expand Up @@ -975,6 +980,53 @@ class="form-control">
</div>
</div>
</div>
<!-- MyAcuRite -->
<div class="col-md-6 col-12 border alert">
<h3 class="panel-heading">MyAcuRite</h3>
<div class="form-group">
<h4>Access Upload:</h4>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio"
name="upload[myacurite][access_enabled]"
id="myacurite-access-enabled-1" value="1"
onclick='document.getElementById("myacurite-access-url").disabled=false;'
<?= ($config->upload->myacurite->access_enabled === true) ? 'checked="checked"' : false; ?>>
<label class="form-check-label alert alert-success"
for="myacurite-access-enabled-1">Enabled</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio"
name="upload[myacurite][access_enabled]"
id="myacurite-access-enabled-0" value="0"
onclick='document.getElementById("myacurite-access-url").disabled=true;'
<?= ($config->upload->myacurite->access_enabled === false) ? 'checked="checked"' : false; ?>>
<label class="form-check-label alert alert-danger"
for="myacurite-access-enabled-0">Disabled</label>
</div>
</div>
<hr class="hr-dashed">
<h4>Upload URL:</h4>
<div class="row">
<div class="col">
<p class="alert-info">If installed on the same network as your device,
use secondary.<br>See <code>docs/DNS.md</code></p>
</div>
</div>
<div class="form-row">
<div class="col form-group">
<select name="upload[myacurite][access_url]"
id="myacurite-access-url"
class="form-control">
<option value="https://atlasapi.myacurite.com" <?= ($config->upload->myacurite->access_url === "https://atlasapi.myacurite.com") ? 'selected="selected"' : false; ?>>
myacurite.com (official)
</option>
<option value="https://atlasapi.acuparse.com" <?= ($config->upload->myacurite->access_url === "https://atlasapi.acuparse.com") ? 'selected="selected"' : false; ?>>
acuparse.com (secondary)
</option>
</select>
</div>
</div>
</div>
</div>

<hr class="hr">
Expand Down Expand Up @@ -1301,53 +1353,63 @@ class="form-control">
<hr class="hr">

<div class="row">
<!-- MyAcuRite -->
<!-- Windy Upload -->
<div class="col-md-6 col-12 border">
<h3 class="panel-heading">MyAcuRite</h3>
<h3 class="panel-heading">Windy</h3>
<div class="form-group">
<h4>Access Upload:</h4>
<h4>Status:</h4>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio"
name="upload[myacurite][access_enabled]"
id="myacurite-access-enabled-1" value="1"
onclick='document.getElementById("myacurite-access-url").disabled=false;'
<?= ($config->upload->myacurite->access_enabled === true) ? 'checked="checked"' : false; ?>>
<label class="form-check-label alert alert-success"
for="myacurite-access-enabled-1">Enabled</label>
name="upload[windy][enabled]"
id="windy-updates-enabled-0" value="0"
onclick='document.getElementById("windy-updates-id").disabled=true;document.getElementById("windy-updates-key").disabled=true;'
<?= ($config->upload->windy->enabled === false) ? 'checked="checked"' : false; ?>>
<label class="form-check-label alert alert-danger"
for="windy-updates-enabled-0">Disabled</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio"
name="upload[myacurite][access_enabled]"
id="myacurite-access-enabled-0" value="0"
onclick='document.getElementById("myacurite-access-url").disabled=true;'
<?= ($config->upload->myacurite->access_enabled === false) ? 'checked="checked"' : false; ?>>
<label class="form-check-label alert alert-danger"
for="myacurite-access-enabled-0">Disabled</label>
name="upload[windy][enabled]"
id="windy-updates-enabled-1" value="1"
onclick='document.getElementById("windy-updates-id").disabled=false;document.getElementById("windy-updates-key").disabled=false;'
<?= ($config->upload->windy->enabled === true) ? 'checked="checked"' : false; ?>>
<label class="form-check-label alert alert-success"
for="windy-updates-enabled-1">Enabled</label>
</div>
</div>
<hr class="hr-dashed">
<h4>Upload URL:</h4>
<div class="row">
<div class="col">
<p class="alert-info">If installed on the same network as your device,
use secondary.<br>See <code>docs/DNS.md</code></p>
<div class="form-row">
<label class="col-form-label" for="windy-updates-id">ID:</label>
<div class="col form-group">
<input type="text" class="form-control"
name="upload[windy][id]"
id="windy-updates-id"
maxlength="35"
placeholder="ID"
<?= ($config->upload->windy->enabled === false) ? 'disabled="disabled"' : false; ?>
value="<?= $config->upload->windy->id; ?>">
<small id="wc-updates-id-help" class="form-text text-muted">Your <a
href="https://stations.windy.com/stations">Windy</a>
Station ID
</small>
</div>
</div>
<div class="form-row">
<label class="col-form-label" for="windy-updates-key">API Key:</label>
<div class="col form-group">
<select name="upload[myacurite][access_url]"
id="myacurite-access-url"
class="form-control">
<option value="https://atlasapi.myacurite.com" <?= ($config->upload->myacurite->access_url === "https://atlasapi.myacurite.com") ? 'selected="selected"' : false; ?>>
myacurite.com (official)
</option>
<option value="https://atlasapi.acuparse.com" <?= ($config->upload->myacurite->access_url === "https://atlasapi.acuparse.com") ? 'selected="selected"' : false; ?>>
acuparse.com (secondary)
</option>
</select>
<input type="text" class="form-control"
name="upload[windy][key]"
id="windy-updates-key"
maxlength="15"
placeholder="XXX-API-KEY-XXX"
<?= ($config->upload->windy->enabled === false) ? 'disabled="disabled"' : false; ?>
value="<?= $config->upload->windy->key; ?>">
<small id="windy-updates-key-help" class="form-text text-muted">Your
Windy API Key.
</small>
</div>
</div>
</div>

<!-- Generic Upload -->
<div class="col-md-6 col-12 border">
<h3 class="panel-heading">Generic Update Server</h3>
Expand Down
Binary file added src/pub/img/external/windy.ico
Binary file not shown.

0 comments on commit 7294219

Please sign in to comment.