Skip to content
Python app for sending weather and air conditions data to Blynk Projects
Python
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
README.md
config_example.yml
requirements.txt
setup.py
weather.py

README.md

Blynk Api External Weather Data

A Python app for weather data deployment to Blynk Projects, using:

  • Airly for temperature and air pollution data,
  • Yahoo Weather for temperature, wind speed/direction, weather conditions data,
  • Open Weather Map for temperature, humidity, pressure, wind speed/direction, weather conditions data,
  • Blynk Server Api for data deployment to Blynk projects.

This application works with default or custom instance of Blynk server.

If your Blynk Project provides a temperature sensor with a fan mounted outside, the app can send the information to the sensor if weather conditions are favourable to start the fan.

Configuration

Python 3.6.5 or newer is recommended. Make sure you have installed Python depedencies:

PyYAML>=4.2b1
certifi==2018.4.16
chardet==3.0.4
idna==2.6
pytz==2018.4
requests>=2.20.0
urllib3>=1.24.2

Create config.yml file and enter your API keys:

server:
    name: "My Data Server"
    timezone: "Europe/Berlin"
    lang: "pl" # en or pl are supported for weather data
    units: "metric" # metric or imperial
location:
    latitude: "52.526400"
    longitude: "13.397261"
    owmCityId: "2950159" # OpenWeatherMap City Id
    yahooCityWOEID: "638242"
apiKeys:
    airlyKey: "yourapikey" # You can request your API Key on airly.eu
    owmKey: "yourapikey" # You can request your API Key on openweathermap.org
    blynkKey: "yourapikey" # Blynk Project Api Key
blynkServer:
    hostname: "blynk-cloud.com" # Your Blynk Server URL
    port: "9443" # Default HTTPS Api port
devices:
    fan: true # If there is a fan in your temperature sensor, leave this option true

Deploying to Heroku

This app was intended to work on Heroku service. You can easily deploy it to Heroku instance:

$ heroku create
$ git add .
$ git commit -am "First commit"
$ git push heroku master

or

Deploy

Set a Heroku Scheduler plugin with the following command:

python3 weather.py

Blynk Project Configuration

Default Virtual Pins are listed below:

  • V36: Air Quality Color
  • V37: Air Quality Description
  • V38: Humidity
  • V39: PM 1
  • V40: PM 2.5
  • V41: PM 10
  • V42: Air Pollution Level
  • V43: Temperature
  • V44: Air Quality Index - CAQI
  • V45: Temperature Sensor's Fan favourable conditions (based on weather conditions) [0 or 1]
  • V46: Date and time of data update
  • V47: Wind Speed
  • V48: Wind Direction
  • V49: Pressure
  • V70: OWM Weather Conditions
  • V71: Server Name
  • V72: Yahoo Weather Conditions
You can’t perform that action at this time.