ESPSMS(episode 2) – Temperature & Weather information

Hello techies…,

Hope you enjoyed the intro video and the first episode of ESPSMS – your own personal assistant. Now in this second episode, we will be learning how we can ask ESPSMS about temperature and weather information of the cities of the world. So lets get started……..

In all the episodes on this topic, one thing will remain same i.e. calling or requesting an API through the board, because this is the only way through which the WiFi board can fetch the answer from the database.

History of this trick

Initially for this trick, I started making unique API for each city using and when I googled about cities in India I found that the number is around 4000. And this number is only about India, what about the cities of the world?????

Than I thought about the database which other assistants have. I was trying to get access to the database of others but didn’t find any way to do that.

After that I changed the track and started searching about some websites which provides API of temperature and weather information. Initially I found some if the websites providing this data but they ask for money in return.

So after a lot of surfing I found 1 website providing this details for free and this is the one which we gonna use for our assistant.


This is the website in which you’ll get all the weather details for free,but we need to use it accordingly. Here you’ll get the details like,


  • City ID
    • City name
    • city.coord
      • city.coord.lon City geo location, longitude
      • City geo location, latitude
    • Country code (GB, JP etc.)
    • city.sun
      • city.sun.rise Sunrise time
      • city.sun.set Sunset time
  • temperature
    • temperature.value Temperature
    • temperature.min Minimum temperature at the moment of calculation. This is deviation from ‘temp’ that is possible for large cities and megalopolises geographically expanded (use these parameter optionally).
    • temperature.max Maximum temperature at the moment of calculation. This is deviation from ‘temp’ that is possible for large cities and megalopolises geographically expanded (use these parameter optionally).
    • temperature.unit Unit of measurements. Possilbe valure is Celsius, Kelvin, Fahrenheit.
  • humidity
    • humidity.value Humidity value
    • humidity.unit %
  • pressure
    • pressure.value Pressure value
    • pressure.unit hPa
  • wind
    • wind.speed
      • wind.speed.value Wind speed, mps
      • Type of the wind
    • wind.direction
      • wind.direction.value Wind direction, degrees (meteorological)
      • wind.direction.code Code of the wind direction. Possilbe value is WSW, N, S etc.
      • Full name of the wind direction.
  • clouds
    • clouds.value Cloudiness
    • Name of the cloudiness
  • visibility
    • visibility.value Visibility, meter
  • precipitation
    • precipitation.value Precipitation, mm
    • precipitation.mode Possible values are ‘no”, name of weather phenomena as ‘rain’, ‘snow’
  • weather
    • weather.number Weather condition id
    • weather.value Weather condition name
    • weather.icon Weather icon id

But the catch here is it’s plan. openweathermap offers various plans for accessing this information. Out of them,we gonna use its default and the free subscription. But we can only use particular hits per minute.


But initially for the project purpose, I think this is the best plan. Further if you want to do business with this, than you can definitely spend money on this. And it is worth also as by just entering the city name as query, we can get the whole weather information in response.

Getting started with

Create you account in and log In to your account. When you create an account in this, you are by default subscribed to the default plan i.e. the free subscription. You can upgrade you plan later if you want.

After signing in, first find out your API key and keep it secret as you have got limited number of hits per minute so don’t let it used by others…..


After that, click on API on the top just adjacent to Maps and than scroll down and click on By city name under Current weather data.


After that, you will be redirected to a page on that you’ll get the required link which you need to request to get the response. Below image shows the page which you will get after clicking on By city name and the link which is highlighted is the one which we gonna use in our project.


Requesting this link, you’ll get error as you need to attach your API key along with this link.So the proper sequence or the format of this link is,

Just add the City Name and API key and request it through your browser, you will get all the weather details of the particular city. The response you will get in JSON format.


So this is the response, and on the code side, we need to filter this data as to present in proper form.


Same as we did in the first episode for answering the basic questions and calculator trick, we gonna compare or wait for some specific input from the user to do the particular function. In weather information, I have divided it into two tricks,

  • Temperature Information
  • Weather Information

You can anytime type help format in the serial monitor to know the format of any trick. So for temperature trick the format is,

temperature of City_Name 


and for whole weather information the format is,

weather information of City_Name

In the code, you’ll get the response in JSON format as we got in our browser. So for proper display ,we will be filtering the data. The whole filtering process is done inside weather library. So after filtering, we will get the response in this form,


Code of this is update on my github account. download from there.

So this is it about the second episode. Hope you liked it and if you know any trick which we can add to our ESPSMS, than do mail us on

Subscribe my YouTube channel for regular notifications
and Join the community on my website to give some contribution to the world by sharing your knowledge.

Stay excited for the next episode. Till then,

explore | learn | share


One Reply to “ESPSMS(episode 2) – Temperature & Weather information”

  1. Pure Autism

    I’m an autistic person and one of the things I enjoy doing is writing funny/random crazy stories that make me laugh (maybe they make you laugh too?) My blog is at Maybe you’d also consider giving a small donation to help me survive? Life as an autistic person is kind of difficult to say the least, and it’s especially difficult to survive financially and so that is why I am requesting donations. Please check my blog for ways you can donate. Thank you very much for your kindness!

Leave a Reply

Your email address will not be published. Required fields are marked *