Giter Club home page Giter Club logo

garden-server's Introduction

NOTE - this project is very much geared towards my setup. You may find you need to make adjustments. I have only tested this on MacOSX

For production running, we also require an S3 bucket and Redis for caching.

Development setup

It's recommended you use virtualenvwrapper You will also need a locally running postgres database running. You will also need to install timescale db, as we rely on it for timeseries related queries. Some documentation can be found here. Presuming you are using those tools, getting started on this project is pretty straightforward:

$ mkproject --force --python=3.11 garden-server
$ workon gardenserver
$ make reset

You can now run the development server:

$ python manage.py runserver

Usage

Login as [email protected] with password password, and you should be able to get started. You can create new plants to be tracked with at: 127.0.0.1:8000/plants/create/

You can then post data points to: 127.0.0.1:8000/api/plant-data/ With data, like:

{"plant": 1, "sensor": 1, "data": "YOUR DATA HERE - MUST BE A NUMBER!"}

And view charts at: 127.0.0.1:8000/plants/chart/{id}/

garden-server's People

Contributors

dependabot[bot] avatar github-actions[bot] avatar ollz272 avatar

Stargazers

 avatar

Watchers

 avatar

garden-server's Issues

Add an Enum for periods

We should look to only supporting a subset of period resolutions that will be useful. Those can be:
None = Raw
1 minute
5 minutes
30 minutes
60 minutes
1 day

View rework

With recent changes we need to incorporate zones and weather into the views.

I think most of the logic can stay the same. On the plants list page, we'll group by zone. We'll have a button that allows for adding new zones. When creating a plant, a list of zones that user has will be used.

Additionally, on a plant page, we should display the latest weather.

We also should have on the plant page a way to create alerts for that plant.

Somewhere we should also have a notification list for logs that haven't been read yet.

api changes

Lots of changes to the models recently. We need an API for:

  • Zones
  • Weather

Additionally, plants should return what zone they're from

Switch to poetry

All the cool kids use poetry. Time to switch to poetry ๐Ÿคท๐Ÿป

Add Weather

Probably best once zones are introduced.

  • - Zones/plants should have a postcode. On submit, we'll do an api look up to grab the lat/lon https://postcodes.io/
  • - Create a model that can store weather data. Probably adhere to https://open-meteo.com/.
  • - Create a management command for populating this data.
  • - Create a cloud function/scheduler/thing that runs this once a .... day?

Add "Alerts"

Alerts are user defined limits on how their sensors should behave, and we should implement a system of tracking these.

Lots of stuff needed for this

  • A Database model that links to a sensor and defines the alert
    • Alert should probably contain a Threshold Value, an equality operator, and maybe a time spent/number of datapoints in that threshold.
  • Once we have alerts we need a database model that can log these.
    • This would be akin to a database model thats linked to an alert and a sensor, with a datetime, and maybe some context. TBD.
  • We'll need a way to "scan" for these.
    • Maybe a system of running these on google cloud every 15 mins or so?
  • Finally once we create an alert we'll need to... do something.
    • Maybe to investigate once the above is done.

Split up sensor creation from plant creation

At the moment the way we create sensors is kinda weird, and complicated as an inline form. Worth splitting up as:

  1. Once plant is created, have a "manage plant" view.
  2. In the manage plant view you can configure plant specific things
  3. There should also be a list of all sensors, with the ability to create, manage and delete these individually.

This should be more scalable if features are added to sensors.

download csv data

Expose the data thats collected to a csv download that can be downloaded

Introduce zones

Zones can contain plants and should be the bedrock of the app.

For initial version we should:

  1. Create a new zone app
  2. Create a zone model, with a name and a user
  3. Have a link between plants and zones
  4. Create an "indoor" and "outdoor" zone for each user if they have a plant in that zone.
  5. Link the plants to these new zones
  6. Deprecate indoor.

Add choices for units.

Probably need some defined units rather than letting everyone choose. Need to investigate properly...

Add steps to deploy to google cloud run

Lets get this thing deployed on google cloud run!

  • Fix docker image to use poetry
  • Set up conventional commits commit hook
  • Set up repo to make a new release based on semantic versioning.
  • Push new docker release to GCP on release.
  • Set up GCP to run new image on cloud run

Data API

We have the chart API which can be used internally (maybe we move towards using that on the FE), but would be good to also allow the data itself to be grabbed from the api using query params to specify bits.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.