Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make openweathermap show rain and snow data #2068

Merged
merged 1 commit into from
May 30, 2024

Conversation

peter-englmaier
Copy link
Contributor

I noticed that openweathmap reports rain, but it does not show up in the driver panel. The API reports the rain like this:

  "rain": {
    "1h": 0.4
  },

But, apparently indi driver expects this:

  "rain": {
    "h": 0.4
  },

I could not figure out, if the format has changed or if this just is not the right data.
Should this PR change be made?

@peter-englmaier
Copy link
Contributor Author

@knro Before you accept this PR, please note, that the source code says about rain and snow values: "these values do not exist in all reports." I did not find documentation on openweathermap stating that this information is not always present. I only see an example with the data and the data is in the format I see, when I call the API myself. But, it might be, that in some places the value is given with "h". I could change the code, to first look for "h", and if not found look for "1h". This would make it backwards compatible.

@knro
Copy link
Contributor

knro commented May 30, 2024

yes we should probably account for h and if not found then 1h to be safe.

@peter-englmaier
Copy link
Contributor Author

Ok, just did that. It shows rain in my place, so it seems to work. Snow I cannot test, but it is the same logic.

@knro
Copy link
Contributor

knro commented May 30, 2024

Isn't there a way to check if a key exists instead of relying on exception to check for the next key?

@peter-englmaier
Copy link
Contributor Author

Ah, good point. Yes, indeed there is a method. It also works without catching exceptions.

By the way, it is normal that observatory status is 'green', when is raining and weather status is 2 and status code 520? All three should indicate danger. But status is 'green'!
grafik
I have not much experience with weather or observatory status in kstars. So I do not know what is normal. When I adjust the parameters for wind or temperature, I can get orange or red status.

@knro
Copy link
Contributor

knro commented May 30, 2024

There is a LOT of work required for the weather handling in both observatory + scheduler modules in KStars. For example, scheduler need more complex handling of weather but right now it's a simple go and no go and it's not very reliable as well. If you can perhaps help us in this regard it would be a tremendous help to KStars!

@knro knro merged commit 824f83f into indilib:master May 30, 2024
11 checks passed
@peter-englmaier
Copy link
Contributor Author

If I find something I can improve, I will be happy to contribute. Getting started is difficult and at the moment I want to focus on drivers for my hardware. My interest is primarily making my observatory run automatic and smoothly. Currently, it is not.

Do you have a "plan" of some sort for the work which is ongoing or planned?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants