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

Know the rainfall for my garden #863

Open
CloCkWeRX opened this issue Apr 10, 2016 · 9 comments
Open

Know the rainfall for my garden #863

CloCkWeRX opened this issue Apr 10, 2016 · 9 comments

Comments

@CloCkWeRX
Copy link
Collaborator

Farmlogs does this, we could do it on a smaller scale: each day hit a weather API and record temp/rainfall/etc.

This lets me compare climate to yield when planting next year

@CloCkWeRX CloCkWeRX mentioned this issue Jan 25, 2017
@CloCkWeRX
Copy link
Collaborator Author

https://www.mapbox.com/blog/weather-along-route/ points out http://openweathermap.org/api which might be of interest

@Br3nda
Copy link
Member

Br3nda commented Mar 12, 2017

Maybe wunderground integration would work here?

@CloCkWeRX
Copy link
Collaborator Author

CloCkWeRX commented Apr 10, 2017

I've done a proof of concept for this; here's the rake task output at the planting level.

clockwerx@clockwerx-laptop:~/growstuff$ bundle exec rake planting:determine_current_weather
warning: please see https://github.com/whitequark/parser#compatibility-with-ruby-mri.
Weather for Adelaide, SA is 17 degree(s) celcius and Clouds
Weather for Adelaide, SA is 17 degree(s) celcius and Clouds
Weather for Watson is 12.34 degree(s) celcius and Clouds
Weather for O'Connor is 12.35 degree(s) celcius and Clouds
Weather for Downer is 12.36 degree(s) celcius and Clouds

Plantings have PlantingWeatherLogs; which have a weather_data JSON structure. That ties us to postgres; but I think its worth it.

Sample data from the API call looks like:

  {"coord"=>{"lon"=>138.6, "lat"=>-34.92},
   "weather"=>
    [{"id"=>803,
      "main"=>"Clouds",
      "description"=>"broken clouds",
      "icon"=>"04d"}],
   "base"=>"stations",
   "main"=>
    {"temp"=>17,
     "pressure"=>1024,
     "humidity"=>51,
     "temp_min"=>17,
     "temp_max"=>17},
   "visibility"=>10000,
   "wind"=>{"speed"=>5.1, "deg"=>190},
   "clouds"=>{"all"=>75},
   "dt"=>1491809400,
   "sys"=>
    {"type"=>1,
     "id"=>8204,
     "message"=>0.0103,
     "country"=>"AU",
     "sunrise"=>1491771922,
     "sunset"=>1491812870},
   "id"=>7839644,
   "name"=>"Adelaide",
   "cod"=>200}}

@leogaggl
Copy link

Hi Daniel,

I am looking at Growstuff (again) for a gardening-related project for myself and my partner, and I noticed this issue as well as the associated PR. My work involves a lot of sensor data, and one of these is weather sensors.

I would be really keen to help with testing and other stuff (unfortunately, Ruby and I aren't on speaking terms—I'm more of a Python, PHP, C#, and a little bit of Go and Rust here and there).

Ping me if I can assist.

@CloCkWeRX
Copy link
Collaborator Author

So, there's probably two parts to this:

  • Get from a "commercial" service, based on an API, regularly polling
    Vs
  • Push from something like home assistant/via MQTT sensor readings

We don't at the moment have a lot of good "write" API endpoints, so the push model is probably not very likely at the moment.

I ended up adding activities to the system as a more general "something happened" / "I planned something for the future" model.

So, ways that you could help are:

  • Find good schema.org or other types for a "weather observation for a day" or

  • Find a good schema for a "point in time measurement with units" or

  • Do a mockup of an activity description in markdown which shows what multiple sensors look like for a daily snapshot.

@leogaggl
Copy link

Thanks for the quick reply. I will have a look at some of the schema questions over the week and get back if I find something. Also will try to get my head around some of the activity model you have described by looking at the code.

As far as the pull model I do have a sensor datastore that could be used for pulling local weather data via and API endpoint. But I can see that you were probably looking more for public weather data sources in your description.

For me the possbile integration with soil moisture and temperature would be also interesting. But I will probably get that from the other data source. Trying to get some historic references for the "growing season" and see what the environmental effects on plants and yields.

@leogaggl
Copy link

Also, you mentioned MQTT (somewhere in the PR I think). That would also be a natural option for me when it comes to any measurements and sensing. Not sure where you have gone with that.

I better go and do some reading and get my head around the underlying data model...

@CloCkWeRX
Copy link
Collaborator Author

Oh if you have a local off the shelf weather station and it's got a good, open standards set of data that makes perfect sense to be able to write data in.

The activity model is really basic. #3646
Title.
Description.
Date.
Garden or planting association.
Owner.
Enum for 'type'

Think of it as a blog post for what you did or will do - thus the suggestions for a markdown template you could cram into the description field.

@leogaggl
Copy link

Unsure how well the activity feed would work for weather data.

I can see this working well for rainfall, which is a critical 'event' and is all too infrequent where we are. I will see if I can get my hand on a LoRa rain bucket and see how that works.

Looking at https://www.growstuff.org/api-docs/index.html, there don't seem to be any endpoints for activities and no write endpoints at all.

But for ongoing sensor data like temperature/humidity/soil-moisture it would get pretty spammy to have them as events and also probably not very useful. This ongoing data is probably more valuable as a graph or trend.

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

No branches or pull requests

3 participants