{"id":18367091,"url":"https://github.com/synox/yahoo-weather","last_synced_at":"2025-04-10T16:46:15.629Z","repository":{"id":15047450,"uuid":"17773491","full_name":"synox/yahoo-weather","owner":"synox","description":"DISCONTINUED - A library for the yahoo weather api, made for spark core (http://spark.io).","archived":false,"fork":false,"pushed_at":"2014-03-25T06:01:49.000Z","size":196,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-15T20:30:53.905Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"cc0-1.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/synox.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-03-15T11:01:26.000Z","updated_at":"2017-02-07T10:28:57.000Z","dependencies_parsed_at":"2022-08-18T17:43:08.276Z","dependency_job_id":null,"html_url":"https://github.com/synox/yahoo-weather","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/synox%2Fyahoo-weather","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/synox%2Fyahoo-weather/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/synox%2Fyahoo-weather/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/synox%2Fyahoo-weather/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/synox","download_url":"https://codeload.github.com/synox/yahoo-weather/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248253995,"owners_count":21072983,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-05T23:19:59.551Z","updated_at":"2025-04-10T16:46:15.607Z","avatar_url":"https://github.com/synox.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"Weather Library for Spark-Core\n=============\n\nA library for the yahoo weather api, made for spark core (http://spark.io).\n\nPlease read the yahoo [Usage Information and Limits](http://developer.yahoo.com/yql/guide/usage_info_limits.html). \n\n\u003e This library should be considered **alpha** tested software.  It is not ready for use in production without testing and bugfixing. \n\n## Weather data\nCurrently the library loads the high and low temperature for today, including a short description. example: \n\n\t{\n\t \"high\": \"16\",\n\t \"low\": \"1\",\n\t \"text\": \"Mostly Cloudy\"\n\t}\n\n(Here is a list of the possible \"text\" values: http://developer.yahoo.com/weather/#codes )\n\n### How to include other data?\nIt can easily be extended, you can fork this project and send pull requests!\n\n1. open in your browser:  http://developer.yahoo.com/yql/console/?q=select%20item%20from%20weather.forecast%20where%20u%3D'c'%20and%20woeid%3D%20781788\n2. press ``Test``, enable \"Tree View\".\n3. read the output and choose wich data you need. e.g. atmosphere-humidity\n4. limit your query to only select what you need. (it's a tree.) example: ``select atmosphere.humidity, wind.speed  from weather.forecast where woeid=2502265``\n5. select \"json\" and copy the URL labeled \"THE REST QUERY\". Test it in your browser or wget/curl, keep the output as a reference for implementation. \n6. paste the URL into the ``weather.cpp`` to ``request.path = \"/v1/...``\n7. adjust the method``Weather::parse()`` to respect the other json parameters. Compare with the json output, watch out for spaces. Add more variables to the ``weather_response_t`` struct. \n8. make tests, deploy, leave feedback\n\n\n## Known issues\n* sometimes it does not connect to yahoo api on first try. after a few tries it should work. \n\n## Dependencies\nIt's using the [HttpClient library](https://github.com/nmattisson/HttpClient) for spark core. Before compiling, add those files to your workspace. If you are building locally add it to `build.mk`. \n\n\n## Usage\n\u003e To find your WOEID, browse or search for your city from the [Yahoo Weather home page](http://weather.yahoo.com/). \n\u003e The WOEID is in the URL for the forecast page for that city. \n\u003e (from the [yahoo manual](http://developer.yahoo.com/weather/#req) )\n\n\nYou have to call the init() method with your woeid, an instance of httpClient and a boolean for celsius/fahrenheit. \n\nin setup(): \n\n```c++\n\t\tweather.init(\"781788\", httpClient,true);\n\t\tweatherCache.init(\u0026weather); \n```\n\n\nin loop(): \n\nthe cache class caches the response for two hours: \n```c++\n\t\tweather_response_t resp = weatherCache.lazyUpdate();\n\t\tif(resp.isSuccess) {\n\t\t\t// print(resp.temp_high);\n\t\t}\n```\n\n\nor you can access the update directly: \n```c++\n\t\tweather_response_t resp = weather-\u003eupdate();\n```\n\n## Full usage example\n\n**This does not work yet, we first have to fix the httpClient. Use this only if C++ is your mother tongue.**\n\n```c++\n\n\t#include \"Adafruit_CharacterOLED.h\"\n\t#include \"yahoo_weather.h\"\n\t#include \"HttpClient.h\"\n\t\n\t\n\tunsigned int nextTime = 0;    // next time to contact the server\n\t\n\tWeather weather;\n\tWeatherCache weatherCache;\n\tHttpClient* httpClient;\n\t\n\tvoid setup() {\n\t\thttpClient = new HttpClient(\"query.yahooapis.com\", 80);\n\n\t\tlcd = new Adafruit_CharacterOLED(...);\n\t\n\t\t// weather\n\t\tweather.init(\"781788\", httpClient);\n\t\tweatherCache.init(\u0026weather); \n\t}\n\t\n\tvoid loop() {\n\t\tif (nextTime \u003e millis()) {\n\t\t\t// keep the same color while waiting\n\t\t\treturn;\n\t\t}\n\t \n\t\t// print weather\n\t\tweather_response_t resp = weatherCache.lazyUpdate();\n\t\tif (lcd != NULL \u0026\u0026 resp.isSuccess) {\n\t\t\tlcd-\u003esetCursor(0, 1);\n\t\t\tlcd-\u003eprint(resp.temp_low);\n\t\t\tlcd-\u003eprint(\"-\");\n\t\t\tlcd-\u003eprint(resp.temp_high);\n\t\t\tlcd-\u003eprint(\" \");\n\t\t\tlcd-\u003eprint(resp.descr);\n\t\t}\n\t\n\t\t// check again in 5 seconds:\n\t\tnextTime = millis() + 5000;\n\t}\n```\n\nHave fun! Share!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsynox%2Fyahoo-weather","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsynox%2Fyahoo-weather","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsynox%2Fyahoo-weather/lists"}