Doton the control node – part 4, more weather

This time we will finish what we started, the weather widget for Doton project:)
Part 1
Part 2
Part 3

Icons

We have 4 info on screen but that is not all, awaiting are humidity, clouds and overall weather description.
Humidity and clouds are percentage values. We need something clever to show them. But what?
For cloud let’s check a cloud icon fully visible up to value and rest just an outline. Two images displayed with proper width. The effect is very good:

On the left, we have 50% and on the right 70%.

And we have a humidity. Same problem, how to represent it? Via a drop?

Left is 80%, right is 25%.

Those icons are good enough. The last thing left is an overall weather information. It has 53 possible states. Too much!
Look into the service/openweather_codes.py there is a list of all possible states. What we gonna do is to go from first to last and think if we can quickly create an icon.
If we have some strength, like light rain, heavy rain we will indicate it via a number of drops. Same with thunderstorms, we will mark strength with thunders. Hopefully, this can be a good thing.
And there is one more thing, it is not wise to load all icons at once 🙂 We will do a small trick, all states will be in icon dictionary but only as key. We will load them as needed.

 '200': None,
 '201': None,
 '202': None,
(..)

And load function:

    def _get_weather_icon(self, status):
        """load weather icon when needed"""
        if self.icon[status] is None:
            self.icon[status] = Image.open('assets/image/openweather/'+str(status)+".png")

        return self.icon[status]

We are not clearing unused icons. I do not know if this will become a problem.

What about icons?
Quick googling shows me a nice site with plenty of free weather icons: www.flaticon.com, especially those made by Freepik and Linector. Merging free icons with my own ideas I should be able to create all of them.Many hours later.. I have them! Yey!

Many hours later.. I have them! Yey!
They are not perfect but easily readable. I didn’t know that there are 30 rain states 🙂
Now only hook images to tiles…. and here it is.

Summary

Short post but very hard and long work. I’m no graphical specialist so it was really hard to me. But it was worth. We have now a beautiful weather widget.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s