Skip to main content

Grown server to run tasks

Project description

Grown

Sensorbased plattform to create various tasks, apart from gathering data. The basic idea is to get a firmware for growing plants taking light and watering into a hand of a microcontroller.

Requirements

Any Micropython board available or further anything which can run micropython.

Installation

Update and package installation will all be provided via upip.:

import upip
upip.install('grown')

enabling the software and configuration is users choice. Like the webrepl in python is adding a call in your boot or main.py nesserary for activation like:

from grown import setup, run_grown

router = setup()
# add more tasks or add site to the router

run_grown()

Setup of grown starts a timesync task and wlan configuration. After the run_grown a webserver is opened with a rest interface to change settings for each task.

Swagger

Every action and info you add to the router is automaticly provided as open api provided by grown. We use swagger.ui as description which can be used standalone. For useing just explore the given link in the ui Example:

http:\\myiotdevice\swagger.json

This way after adding all controls you have a good base to develop further views or test the given params.

data control

This module to log data overtime from your sensors. Enable logging is prety simple write a function which returns a dict with key as name and value. Those function is called overtime and will be logged.

Example:

from grown.data_control import add_data_control

async def mydata():
    return {
        "water": 0,
        "light": 0,
    }

add_data_control(router, mydata)

light control

Every plant needs light so we need to control these by a timetable. We need at least 2 functions one to activate and one to deactivate the light.

Example:

from grown.light_control import add_light_control

async def activate():
    print("activate")

async def deactivate():
    print("deactivate")

add_light_control(router, activate, deactivate)

logging

if you want to add something to the log because you write your own task and so on. Example:

from grown.logging import grown_log

grown_log.info('new entry')

its a ulogging instance from the logger with an add that it logs data not only to console but also to the file run_information.log. This might get handy in debugging log term bugs.

store

Another interal element is the store. It´s a minimal redux which also stores every update to the filesystem.

Example:

from grown.store import storage

def _update_reducer(store_dict, data):
    return store_dict.update(data)

storage.register_leaf(
        'mydata',
        {
        },
        _update_reducer
    )


leaf = storeage.get_leaf('mydata')

leaf.update({'new_data': 3.0})

print(leaf.get())

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

grown-0.0.36.dev0.tar.gz (12.5 kB view details)

Uploaded Source

File details

Details for the file grown-0.0.36.dev0.tar.gz.

File metadata

  • Download URL: grown-0.0.36.dev0.tar.gz
  • Upload date:
  • Size: 12.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.1 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.8.5

File hashes

Hashes for grown-0.0.36.dev0.tar.gz
Algorithm Hash digest
SHA256 ffa725cc840a1352db07754b0bd145ba8c42336d58d4994763c4ce8c97dc5012
MD5 49e87c88ea46eaefd975494c1dad8980
BLAKE2b-256 a9f71f6f8a7597d31cc44d26bb96de97835c141ab466cdef735088b930700a5c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page