Code Monkey home page Code Monkey logo

forecastio's Introduction

forecast.io Driver

This OpenMUC driver retrieves weather forecasts from the free Dark Sky Forecast API and provides the data via OpenMUC's data manager. To use the bundle, an API key is necessary, which will be provided after registration at the developer's website. Forecasts may be retrieved for different locations within one driver instance, because each location is represented as an OpenMUC device.

After a forecast has been retrieved from the provider, all available data fields are provided as OpenMUC channels. Channel scan is supported to get an overview about all available data. Forecasts will be retrieved after bundle start-up and updated every 60 minutes. The time stamp of the last update from the external server can be read from the channel address forecastio/lastupdate.

If reading a value using OpenMUC's data manager, a temporarily stored value will be delivered. Thus, reading a value doesn't force the driver to update the forecast from the external provider. It's also possible to listen for value updates. In this case, the listener will be called each time forecast data will be retrieved from the external provider - irrespective of whether data has changed or not. Writing values is not supported.

This driver implementation is based on the underlying [Java Wrapper Library] (https://github.com/dvdme/forecastio-lib-java) by David Ervideira.

Build

The driver can be built via gradle by executing

gradle clean build

The dependency to OpenMUC has to be resolved by installing OpenMUC into the local repository on your system. Download OpenMUC from the [project's website] (https://www.openmuc.org/index.php?id=53) and install the bundles by executing

gradle install

Don't foreget to set the right OpenMUC version in the build file of the OpenMUC extension.

Setting up a device

As mentioned before, an OpenMUC device represents the forecast for a single location. Because forecasts may be retrieved for any location specified by its coordinates, a device scan is not supported by the driver. The following device properties must be set:

  • The device address represents the coordinates (latitude, longitude) of the location, separated by a comma. The following example shows the coordinates of Salzburg/Austria in the required format: 47.815470,13.046815
  • The device settings string must contain the API key provided by Dark Sky (see above)
  • If a proxy has to be used, the settings string must contain the API key, the http-proxy-name and port, separated by a comma, e.g. YOUR_API_KEY,127.0.0.1,8080.

After a new device has been configured, the forecast will be retrieved immediately. Because available data fields may vary with the specified location, use OpenMUC's channel scan to get a list of available fields.

Following an example of a channel-configuration using this driver in the channels.xml in the OpenMUC Framework. In this example no proxy is used an only one Channel is defined, the lastupdate-Channel:

<driver id="forecastio">
    <device id="forecastio_salzburg">
      <description>Weather forecast information of Salzburg</description>
      <deviceAddress>47.815470,13.046815</deviceAddress>
      <settings>"YOUR_API_KEY"</settings>
      <channel id="LastUpdate">
        <channelAddress>forecastio/lastupdate</channelAddress>
	    <description>Timestamp of the last received forcast</description>
        <unit>-</unit>
        <samplingInterval>5s</samplingInterval>
      </channel>
    </device>
</driver>

forecastio's People

Contributors

fxaverz avatar pichler avatar

Watchers

James Cloos avatar  avatar  avatar  avatar

Forkers

fxaverz

forecastio's Issues

OpenMUC not accessible over MavenCentral()

In the current gradle-script OpenMUC is integrated via compile groups, unfortunately the OpenMUC core is not accessible over maven central repository.

Current work around: add a local path to the .jars of OpenMUC:

flatDir {
    //Path to .jars of OpenMUC
    dirs '../../build/libs/'
    }

I'm not sure, how this issue can be resolved...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.