First, make sure you have a valid Python 3 installation. When typing python
in a terminal, it should open the Python REPL :
Python 3.7.4 (default, Jul 16 2019, 07:12:58)
[GCC 9.1.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> ▯
Create a new folder that will contain the project, go into the new folder and create a Python virtual environment :
python -m venv env
Source the environment and install PlatformIO inside it using pip :
# On Linux and MacOS
source env/bin/activate
# On Windows
env\Scripts\activate.bat
# Install platformio
pip install platformio
Initiate a new PlatformIO project :
platformio init
This will create a few files and folders. Open platformio.ini
and write the following inside :
[env:nodemcuv2]
platform = espressif8266
board = nodemcuv2
framework = arduino
lib_deps = ESP8266 Weather Station,
JsonStreamingParser,
ESP8266_SSD1306,
simpleDSTadjust
Add those 3 files into the src
folder :
And rename WeatherStationDemo.ino
to main.cpp
. Then build and upload the project by doing :
platformio run --target upload
To get data, be sure to set the following variables in main.cpp
:
L49: const char* WIFI_SSID = "yourssid";
L50: const char* WIFI_PWD = "yourpassw0rd";
...
L72: String OPEN_WEATHER_MAP_APP_ID = "XXX";
...
L79: String OPEN_WEATHER_MAP_LOCATION_ID = "2657896";
...
L89: String OPEN_WEATHER_MAP_LANGUAGE = "de";
The comments above the variables should explain their meanings and how they should be filled.