Skip to content

Latest commit

 

History

History
90 lines (72 loc) · 2.7 KB

README.md

File metadata and controls

90 lines (72 loc) · 2.7 KB

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.11 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 code

This app was intended to work in Heroku or GCP Cloud Functions. You can easily deploy it to Heroku instance:

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

or in GCP Cloud Functions:

$ gcloud functions deploy function-name --runtime python311 --entry-point=BlynkExternalData

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