growstuff
growstuff copied to clipboard
Know the rainfall for my garden
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
https://www.mapbox.com/blog/weather-along-route/ points out http://openweathermap.org/api which might be of interest
Maybe wunderground integration would work here?
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}}
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.
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.
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.
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...
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.
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.