2017 © Pedro Peláez
 

library ambient-weather

A PHP SDK for interacting with the ambient weather api to retrieve data and draw canvas visualizations

image

ko/ambient-weather

A PHP SDK for interacting with the ambient weather api to retrieve data and draw canvas visualizations

  • Monday, February 5, 2018
  • by peledies
  • Repository
  • 2 Watchers
  • 1 Stars
  • 7 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 6 Versions
  • 17 % Grown

The README.md

ambient-weather

This module is built for interacting with the ambientweather.net API. It utilizes the ko\json-cache module to reduce pressure on the ambient weather API and to provide a faster load time for the weather station data., (*1)

Demo

Weather Data Demo, (*2)

Install

composer require ko/ambient-weather

Properties

Property Type Description
apiKey String Your ambient weather API Key
applicationKey String Your ambient weather API Applicaiton Key
interval Integer The reporting interval of your weather station
timeframe Integer The ammount of time into the past to fetch data for
device String The MAC address of your weather station

Usage

Build the cache

Build the cache settings object, (*3)

  $KOCacheSettings = new \KO\Cache\Settings();
  $KOCacheSettings->setValidity(15);
  $KOCacheSettings->setFile('data_cache.json');

Instantiate a new cache object with the settings, (*4)

  $KOCache = new \KO\Cache\Cache($KOCacheSettings);

Build the AmbientWeather object

Build the AmbientWeather settings object, (*5)

  $AWSettings = new \KO\AmbientWeather\Settings();
  $AWSettings->setApiKey('your-api-key-here');
  $AWSettings->setApplicationKey('your-application-key-here');
  $AWSettings->setInterval(5);
  $AWSettings->setTimeframe(4);
  $AWSettings->setDevice('device-mac-address');

Instantiate a new AmbientWeather object with the settings, (*6)

  $AW = new \KO\AmbientWeather\AmbientWeather($AWSettings, $KOCache);

Charts

new KO\AmbientWeather\Charts\Wind($AW);
new KO\AmbientWeather\Charts\Temperature($AW);
new KO\AmbientWeather\Charts\Barometric($AW);

Gauges

KO\AmbientWeather\Gauges\WindDirection($AW);
KO\AmbientWeather\Gauges\WindSpeed($AW);

Complete Example

setValidity(15);
  $KOCacheSettings->setFile('data_cache.json');

  $KOCache = new \KO\Cache\Cache($KOCacheSettings);

  $AWSettings = new \KO\AmbientWeather\Settings();
  $AWSettings->setApiKey('your-key-here');
  $AWSettings->setApplicationKey('your-key-here');
  $AWSettings->setInterval(5);
  $AWSettings->setTimeframe(1);
  $AWSettings->setDevice('your-MAC-here');

  $AW = new \KO\AmbientWeather\AmbientWeather($AWSettings, $KOCache);

?>

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8">
    <title>Document</title>

    <script
      src="https://code.jquery.com/jquery-3.3.1.min.js"
      integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8="
      crossorigin="anonymous"></script>

    <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.7.1/Chart.min.js"></script>

    <script src="//cdn.rawgit.com/Mikhus/canvas-gauges/gh-pages/download/2.1.4/all/gauge.min.js"></script>
  </head>
  <body>

    <?php
        new KO\AmbientWeather\Charts\Wind($AW);
        new KO\AmbientWeather\Charts\Temperature($AW);
        new KO\AmbientWeather\Charts\Barometric($AW);
        new KO\AmbientWeather\Gauges\WindDirection($AW);
        new KO\AmbientWeather\Gauges\WindSpeed($AW);
    ?>

  </body>
</html>

Documentation

See the full Documentation for more details., (*7)

The Versions

05/02 2018

dev-master

9999999-dev

A PHP SDK for interacting with the ambient weather api to retrieve data and draw canvas visualizations

  Sources   Download

MIT

The Requires

 

The Development Requires

05/02 2018

0.0.6

0.0.6.0

A PHP SDK for interacting with the ambient weather api to retrieve data and draw canvas visualizations

  Sources   Download

MIT

The Requires

 

The Development Requires

04/02 2018

0.0.5

0.0.5.0

A PHP SDK for interacting with the ambient weather api to retrieve data and draw canvas visualizations

  Sources   Download

MIT

The Requires

 

03/02 2018

0.0.4

0.0.4.0

A PHP SDK for interacting with the ambient weather api to retrieve data and draw canvas visualizations

  Sources   Download

MIT

The Requires

 

03/02 2018

0.0.3

0.0.3.0

A PHP SDK for interacting with the ambient weather api to retrieve data and draw canvas visualizations

  Sources   Download

MIT

The Requires

 

03/02 2018

0.0.1

0.0.1.0

A PHP SDK for interacting with the ambient weather api to retrieve data and draw canvas visualizations

  Sources   Download