Giter Club home page Giter Club logo

tridenttd_openweather's Introduction

TridentTD_OpenWeather

[TridentTD] Esp8266, ESP32 's OpenWeather Library

TridentTD_OpenWeather is a library for ESP8266 , ESP32 board
to get Weather Status at any place by latitude, longitude
from OpenWeatherMap API in the simplest method.

Install

Clone (or download and unzip) the repository to ~/Documents/Arduino/libraries where ~/Documents/Arduino is your sketchbook directory.

> cd ~/Documents/Arduino
> mkdir libraries
> cd libraries
> git clone https://github.com/TridentTD/TridentTD_OpenWeather.git TridentTD_OpenWeather

and install ArduinoJson library version 6.x

Usage

Include

You need to have the ESP8266 or ESP32board support already included.

#include <TridentTD_OpenWeather.h>

TridentTD_OpenWeather myPlace(OpenWeather_APIKEY)

Constructor to create an TridentTD_OpenWeather object.

 TridentTD_OpenWeather  myPlace(OpenWeather_APIKEY);

wificonnect( ssid,password)

Setup the ESP8266 board's wifi to the ssid . However you can connect by yourself.

myPlace.wificonnect( ssid,password );

setLocation( lat, lon )

Set up your location by latitude and longitude.

myPlace.setLocation( lat, lon );

setUnit( unit_type)

Set up unit type. By default "metric" (celcius, meter/sec).
Or "imperial" (fahrenheit, miles/hour)

myPlace.setUnit("metric");
myPlace.setUnit("imperial");

weatherNow()

Get weather information of your place at now.

myPlace.weatherNow();

readTemperature()

readTempMin()

readTempMax()

readTempFeelsLike()

readHumidity()

readPressure()

readWeather()

readWeatherIcon()

readWindSpeed()

readWindDeg()

readCloudiness()

readSunrise(timezone)

readSunset(timezone)

readDateTime(int timezone)

  Serial.println("[OpenWeather] Location   : " + myPlace.latitude() + ", "+ myPlace.longitude() );
  Serial.println("[OpenWeather] Temperature: " + String(myPlace.readTemperature()));  // [metric] Celcius  or [imperial] Fahrenheit
  Serial.println("[OpenWeather] Temp Min   : " + String(myPlace.readTempMin()));  // [metric] Celcius  or [imperial] Fahrenheit
  Serial.println("[OpenWeather] Temp Max   : " + String(myPlace.readTempMax()));  // [metric] Celcius  or [imperial] Fahrenheit
  Serial.println("[OpenWeather] Feels-Like : " + String(myPlace.readTempFeelsLike()));  // [metric] Celcius  or [imperial] Fahrenheit
  Serial.println("[OpenWeather] Humidity   : " + String(myPlace.readHumidity()));     // %
  Serial.println("[OpenWeather] Pressure   : " + String(myPlace.readPressure()));     // hPa
  Serial.println("[OpenWeather] Weather    : " + myPlace.readWeather());
  Serial.println("[OpenWeather] Wind Speed : " + String(myPlace.readWindSpeed()));    // [metric] meter/sec  or [imperial] miles/hour
  Serial.println("[OpenWeather] Wind Deg   : " + String(myPlace.readWindDeg()));      // degrees
  Serial.println("[OpenWeather] Cloudiness : " + String(myPlace.readCloudiness()));   // %
  Serial.println("[OpenWeather] Sunrise    : " + String(myPlace.readSunrise(timezone)));
  Serial.println("[OpenWeather] Sunset     : " + String(myPlace.readSunset(timezone)));
  Serial.println("[OpenWeather] DateTime   : " + String(myPlace.readDateTime(timezone)));

getVersion()

Get version of this library.

myPlace.getVersion();

Version

1.0.0 TridentTD_OpenWeather
2.0.0 support ESP32
3.0.0 json parser by ArduinoJson 6.x

@ 6 May 2563 BE (Buddhism Era) / 2020
Ven. Phaisarn Techajaruwong

tridenttd_openweather's People

Contributors

tridenttd avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

tridenttd_openweather's Issues

Humidity read Issue

The Humidity reading is always: 0.00%

Fix:

-Open File: TridentTD_OpenWeather.cpp
replace Line: _humidity = payload.substring( 10+payload.indexOf("humidity")....

with:

_humidity = payload.substring( 10+payload.indexOf("humidity"),payload.indexOf("visibility")-3).toFloat();

TridentTD_OpenWeather.zip

Doesn't work anymore :-(

Does not work anymore with the current Arduino Json/ESP8266 Module 3.x version. Error without end and compilation is aborted.
And yes, I tried this also with the pure "WeatherNow V.3.0.0" example.

Too bad!
:-(

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.