CyntechUK / WeatherHAT

10 stars 3 forks source link

Id rework #7

Closed Trotter73 closed 4 years ago

Trotter73 commented 4 years ago

Hi,

My first ever pull request, please be gentle....

A re-factor of the great work kd8bxp started.

This pull request changes the script to use the openweathermap ID number for the current weather rather than "MAIN".

The types of weather are defined as variables, the script the reads the ID field from openweather map and does some simple comparisons, >= <=, to match ... There may be a better way but I've taught myself some python just to do this and it seemed a simple and easy to understand method....

For showers I have used rainbow, cloud and rain. Clouds have been split into scattered clouds (with sun) and overcast.

I have tidied the initial start of the script and added some more annotation, more for my learning process

Boeeerb commented 4 years ago

Thank you both very much for keeping an interest in this! I agree, the ID is much better at determining the type of weather, so would see this being used over name... Would you mind if I hold off, as the re-write of the weatherhat.py library will involve many breaking changes, such as items such as rain will have 4 types, snow will have 5 so would be referenced on type, ie: Drizzle, Light, Moderate and Heavy, so just requesting wh.rain("start") won't do anything. I will have the first version of the new one up in the next few days for testing.

kd8bxp commented 4 years ago

Nice! Yeah, I had a good start, now time to improve! That is part of the fun!

Trotter73 commented 4 years ago

@Boeeerb No worries ! :) I totally understand, it's there if you need it, if you want someone to test just shout, look forward to seeing the updates !!