Skip to content

Commit

Permalink
Merge pull request #75 from Qrome/2.5
Browse files Browse the repository at this point in the history
2.5
  • Loading branch information
Qrome authored Feb 19, 2019
2 parents ea69172 + 1854675 commit 11fc9fd
Show file tree
Hide file tree
Showing 96 changed files with 6,414 additions and 98 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,14 @@ Use the Arduino guide for details on how to installing and manage libraries http
**Packages** -- the following packages and libraries are used (download and install):
ESP8266WiFi.h
ESP8266WebServer.h
ArduinoJson.h --> https://github.com/bblanchon/ArduinoJson (Version 5.13.X)
WiFiManager.h --> https://github.com/tzapu/WiFiManager
ESP8266mDNS.h
ArduinoOTA.h --> Arduino OTA Library
"SSD1306Wire.h" --> https://github.com/ThingPulse/esp8266-oled-ssd1306
"OLEDDisplayUi.h"

Note Printer-Monitor version 2.5 and later include ArduinoJson (version 5.13.1).

## Initial Configuration
All settings may be managed from the Web Interface, however, you may update the **Settings.h** file manually -- but it is not required. There is also an option to display current weather when the print is off-line.
* Your OctoPrint API Key from your OctoPrint -> User Settings -> Current API Key
Expand Down
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion printermonitor/OctoPrintClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ SOFTWARE.

#pragma once
#include <ESP8266WiFi.h>
#include <ArduinoJson.h>
#include "libs/ArduinoJson/ArduinoJson.h"
#include <base64.h>

class OctoPrintClient {
Expand Down
177 changes: 88 additions & 89 deletions printermonitor/OpenWeatherMapClient.h
Original file line number Diff line number Diff line change
@@ -1,90 +1,89 @@
/** The MIT License (MIT)
Copyright (c) 2018 David Payne
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/

#pragma once
#include <ESP8266WiFi.h>
#include <ArduinoJson.h>

class OpenWeatherMapClient {

private:
String myCityIDs = "";
String myApiKey = "";
String units = "";
String lang = "";

const char* servername = "api.openweathermap.org"; // remote server we will connect to
String result;

typedef struct {
String lat;
String lon;
String dt;
String city;
String country;
String temp;
String humidity;
String condition;
String wind;
String weatherId;
String description;
String icon;
boolean cached;
String error;
} weather;

weather weathers[5];

String roundValue(String value);

public:
OpenWeatherMapClient(String ApiKey, int CityIDs[], int cityCount, boolean isMetric, String language);
void updateWeather();
void updateWeatherApiKey(String ApiKey);
void updateCityIdList(int CityIDs[], int cityCount);
void updateLanguage(String language);
void setMetric(boolean isMetric);

String getWeatherResults();

String getLat(int index);
String getLon(int index);
String getDt(int index);
String getCity(int index);
String getCountry(int index);
String getTemp(int index);
String getTempRounded(int index);
String getHumidity(int index);
String getHumidityRounded(int index);
String getCondition(int index);
String getWind(int index);
String getWindRounded(int index);
String getWeatherId(int index);
String getDescription(int index);
String getIcon(int index);
boolean getCached();
String getMyCityIDs();
String getWeatherIcon(int index);
String getError();
};
/** The MIT License (MIT)
Copyright (c) 2018 David Payne
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/

#pragma once
#include <ESP8266WiFi.h>
#include "libs/ArduinoJson/ArduinoJson.h"

class OpenWeatherMapClient {

private:
String myCityIDs = "";
String myApiKey = "";
String units = "";
String lang = "";

const char* servername = "api.openweathermap.org"; // remote server we will connect to
String result;

typedef struct {
String lat;
String lon;
String dt;
String city;
String country;
String temp;
String humidity;
String condition;
String wind;
String weatherId;
String description;
String icon;
boolean cached;
String error;
} weather;

weather weathers[5];

String roundValue(String value);

public:
OpenWeatherMapClient(String ApiKey, int CityIDs[], int cityCount, boolean isMetric, String language);
void updateWeather();
void updateWeatherApiKey(String ApiKey);
void updateCityIdList(int CityIDs[], int cityCount);
void updateLanguage(String language);
void setMetric(boolean isMetric);

String getWeatherResults();

String getLat(int index);
String getLon(int index);
String getDt(int index);
String getCity(int index);
String getCountry(int index);
String getTemp(int index);
String getTempRounded(int index);
String getHumidity(int index);
String getHumidityRounded(int index);
String getCondition(int index);
String getWind(int index);
String getWindRounded(int index);
String getWeatherId(int index);
String getDescription(int index);
String getIcon(int index);
boolean getCached();
String getMyCityIDs();
String getWeatherIcon(int index);
String getError();
};
5 changes: 5 additions & 0 deletions printermonitor/libs/ArduinoJson/ArduinoJson.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// ArduinoJson - arduinojson.org
// Copyright Benoit Blanchon 2014-2018
// MIT License

#include "src/ArduinoJson.h"
Loading

0 comments on commit 11fc9fd

Please sign in to comment.