Coder Social home page Coder Social logo

kizniche / mycodo Goto Github PK

View Code? Open in Web Editor NEW
2.8K 122.0 480.0 110.03 MB

An environmental monitoring and regulation system

Home Page: http://kylegabriel.com/projects/

License: GNU General Public License v3.0

CSS 0.34% JavaScript 1.15% C 0.14% Shell 1.33% Python 63.45% HTML 33.57% Mako 0.01% Dockerfile 0.02%
raspberry-pi sensors regulation monitoring environment relay pid python automation grow

mycodo's People

Contributors

agricola-access avatar ancientgate avatar cabalist avatar david-oconnor avatar deargle avatar dependabot[bot] avatar edmunsonvacation avatar enstain-tm avatar etiology avatar flaminglasrswrd avatar gfzdw avatar hannahkiekens avatar huntj88 avatar jcass77 avatar joe2824 avatar kizniche avatar knyazsh avatar maecki-maecki avatar mattimatti avatar mrgnr avatar nick-vazquez avatar not5 avatar offish avatar pkrahmer avatar rbultman avatar running-codebase avatar slashie avatar theoi-meteoroi avatar ziqueyuutaka avatar zsole2 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mycodo's Issues

Min PID relay duration not operating correctly

The min duration is supposed to limit the relay minimum on duration. If the PID output is below this value, the relay is suppose not turn on at all. The current operation is if the PID value is positive and below the minimum duration, the relay will turn on for the minimum duration.

Confusion about 'sensor'

Hello again!

I have a question about one of the most used variables in mycodo.py. sensor is used all over the place and I believe it is an int and the address of a sensor. But I am not sure.

I see that when it is used in logging it tends to have 1 added to it. This makes me think that internally the sensors are numbered 0-7 but in the log you refer to them as 1-8.

Could you clarify what this variable is used for in mycodo.py?

int and time.time() and precision

Out of curiosity why is time cast as an int in your code?

Examples:

roughly L2009 in mycodo.py

while last_ht_reading > int(time.time()):
        time.sleep(0.25)

or

roughly L2038 in mycodo.py

last_ht_reading = int(time.time()) + 2

time.time() returns a float normally and python will add and compare ints and floats without issue.

It produce inexact results in timers as well.

Consider time.time() is 1448345968.99. Converted to an int that is 1448345968. It takes one time.sleep(0.25) to become 1448345969.

Now consider time.time() is 1448345968.01. Again converted to an int that is 1448345968. But it takes 4 time.sleep(0.25) to become 1448345969.

Your readings from the sensors could take ± .75 seconds here. Floats would alleviate the precision issue.

Just curious. :)

Ability to hide thumbnails

Thumbnails in the notes section currently are not true "thumbnails" but merely scaled versions of the full-resolution image. Since this can be a big bandwidth hog, the option to show note thumbnails should be included in the settings.

Update from v3.5.89 to current - daemon will not start

Trying to update Mycodo from v3.5.89 to current (to add the fix for timers and triggers). The daemon shuts down fine and the update finishes without issue (at least according to logs). But the daemon will not start back up... not from the web interface (which shows up with the daemon off and the last log entry is the update switching off the daemon) and not from the command line (via "sudo service mycodo start"). I tried restarting the Pi as well, but the daemon will not start back up. I've tried a few times now and the same thing happens every time.

(I meant to say before that this software is great. Thank you so much for making and maintaining it, and also for your fast responses.)

Can't update after fresh install

@boomstick8x I'm starting this (and deleting the other posts) because it was off-topic for that thread (and there's a lot of chat, so I don't want who is subscribed to that issue to keep getting notified).

Is there an error of any kind?

Add minimum relay on time for PID controller

There is already a "maximum on time" (titled Up Max and Down Max, for each relay of the PID), that the on time for a relay will not exceed. There needs to be a complementary minimum on time that if the PID does not exceed, the relay does not turn on.

Modularize sensor/device code

This is an effort to reduce the bloat of mycodo.py and allow fewer requirements for its use, based on what is being used by it (modules). I can foresee, with many supported sensors/devices, Mycodo getting unmanageable and requiring the installation of extraneous software that will never be utilized by some users.

For instance, functions related to reading the AM2315 temperature/humidity sensor would all be in AM2315.py and the TCA9548A multiplexer in TCA9548A.py. They would only be loaded if that sensor/device is in use. That way software will not need to be installed if the device is not used, such as symbus- only used by the TCA9548A.

I'm struggling to find the best way to do this. Often, when I take on big tasks such as rewriting my code for better operability/modularity/readability, my first choice of a method is not necessarily the best course (but seldom is it the worst choice).

Cannot generate custom graph before 6 months from present

To get commit 572dfeb working, I had to temporarily make custom graph generation only work for the past 6 months. It should be an easy fix once I look at that part of the code, but for now everything else works from this major overhaul of the custom graph generation.

Essentially, the custom graph generation was handled in PHP. It is now handled by the Python function that generates the preset graphs on the Graph Tab.

different width of relay and temperature parts in sensor tab

Relay and temperature blocks in sensor tab in case of css .sensor-parent{float: left and width: auto} are different width, and if I`m not wrong, removing float will solve this situation.
And if it so, then in css table.relays{display: table; margin-right: auto; margin-left: auto; width: 100%;} will solve the last part of positioning.

Enhancement (small screen / terminal support)

2015_09_02_frut chamber
I have a small TFT screen, connected to the Pi
the objectif is to be able to see mycodo/gaphs and at same time you can look throuh the glass inside the fruting chamber.

this base screeen no tactlie , just cheap TFT is only 7''
and the webpage won't fit ! I tryed to reduce the wepage size in chromium with CTRL + +
but all became too small/tight
Ideal, I think, would be to have some graph from terminal directly
I'm sure this is easy to read the sensors log file in real time to show a graph in a terminal window

HTsensor PID issue

After yesterday update:
{
Database version 11, v3.5.76
v3.5.76: Add minimum relay on duration for PID controllers
}
my HT-HUM PID is broken. The P and I constants were deleted, and no new values is saved, either.
I don't see any obvious in the code though.

Networking multiple Mycodo daemons

Monitoring is key to any good regulatory system, with redundancy often used to accomplish this. This may be useful for remote operation or where great liability is involved (e.g. keeping things alive, preventing damage of expensive materials, ensuring safety, etc.).

The main use of networking would be to add the ability to monitor the status of a running Mycodo daemon on another device and to respond if there is an issue (e.g. daemon crash, linux kernel panic, corrupt filesystem causing instability, disconnect from the network, loss of regulation, etc.).

Initial features would be the ability to notify by email, power cycle the affected Pi with the use of a normally-closed (NC) relay, or take control of the regulation relays to recover the system from a loss of regulation. Additionally, If the host (monitoring system) experiences an issue, the slave (monitored system) could power-cycle the host.

A point-to-point connection would provide the best security, such as a single ethernet cable (TCP/IP) or serial (Tx/Rx). With a dedicated connection, there are fewer additional points of failure (such as routers, switches, and wireless APs, although these could still be used).

If successful, this feature could potentially lead to more advanced features such as improving graph generation performance or other processes by splitting processing tasks (cluster).

What does this code do?

Hello!

I am just curious about the code here:

conditional_co2_id = [[[0 for k in xrange(10)] for j in xrange(len(conditional_co2_number_conditional))] for i in xrange(len(conditional_co2_number_sensor))]

on my system it seems to produce an array of zeroes. Something like this:

where
conditional_t_number_conditional has a length of 10 and
conditional_t_number_sensor has a length of 4

[[[0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
  [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
  [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
  [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
  [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
  [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
  [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
  [0, 0, 0, 0, 0, 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0, 0, 0, 0, 0, 0, 0]]]

Could you help me understand this code?

Fix relay logging limitation

Update the relay on duration logging format to remove the current 8-relay limitation. Although the software supports an infinite number of relays, any over 8 will break the system in unforeseen ways.

Current logging format:
Year Mo Day Hour Min Sec R1SecOn R2SecOn R3SecOn R4SecOn R5SecOn R6SecOn R7SecOn R8SecOn Sensor
2015 09 07 07 15 29 0 -144.25 0 0 0 0 0 0 0

The negative relay duration in the example is valid, as this is derived from a negative PID output, and all numbers are eventually converted to their absolute value. This format was used to distinguish that this relay was used to decrease an environmental condition (rather than increase it). Furthermore, the most recent Mycodo update, which allows for the user to select any number of relays to be graphed, either positive or negative, renders this format unnecessary.

Proposed new logging format:
Year Mo Day Hour Min Sec GPIO-Pin SecOn

Add Notes/Journal entries Section

Wouldn't it be awesome to be abble to write some notes anytime to keep log of anything :

  • Grow journal
  • PID settings/tuning
  • personal notes and comments
    Very important to have automatic time stamps affected when writing the notes/

favicon for easy searching in browser tabs

Few times I run with my eyes more than usually to find Mycodo tab in browser. I can try to make favicon for the project. May be you have an ideas about graphics?

p.s. What Mycodo means? I think first part 'Myco' shortcut from mycology, but the last 'do' I don't understand?

test image:
apple-touch-icon-144x144

Add more user groups

Groups currently only include guest and admin.
Guest: Can only view (but cannot view database contents)
Admin: Can perform any operation (only group that can add/delete users)

Potential additions:
Monitor: Guest privileges + ability to generate graphs + turn camera on/off
Editor: Monitor privileges + ability to edit relay/sensor/PID configurations

Any others that would be useful?

Owner individualisation of mycodo

If I have multiples Raspb.pi with mycodo on each / multiples setup / multi chambers : it'll be great to be abble to personalise a bit to know immediatly on which one you are.
Perhaps a functionnality to upload a banniere with fixed valors that'll appear in see-through the header (please find example in attached picture)
mycodo_trough01
I used 50% opacity.
Perhaps a small logo at right but I'm totally aware when you add sensors with logs ticked they 'll need this place !

Add time/date timers

Turn relay x [on/off] at xx:xx for x seconds (0 to remain on/off)

[selection] repeat x times
[selection] repeat every x [seconds] thereafter)

AM2315 Sensor Support

I have been using the AM2302 sensor on my projects for some time and it has proven very rugged, reliable and easily mounted in real application. Unlike other sensors, it works via i2c with a static address, so multiple sensors would require an i2c multiplexer. Those are widely available with drivers, but they almost all work the same way. It would be great if Mycodo would support these sensors.

Add checks for spaces in relay/sensor values

Since the update to the new logging method and history feature, if a value that is printed from the Data tab has a space in it, it will offset the columns and the data columns will not align properly with the name columns. This can be alleviated by not having spaces in values. Therefore, relay/sensor text values need to have spaces forbidden. A warning should be issued if a new value with a space is detected, "Error: Values cannot contain spaces. Please resubmit without spaces."

Odd trigger behavior / things not logging / timer problems

I'm trying to set up a makeshift timer for light. So what I did was set turn on relay 1 (normal lights) for 64800 seconds (18 hours). Then I set up a trigger so that when relay 1 turns off, relay 4 (night light) is supposed to turn on for 21600 seconds (6 hours). And another trigger so that when relay 4 turns off, relay 1 is supposed to turn on for 64800 seconds again... so that it does a cycle.

So relay 1 works fine and turns off, turning relay 4 on... but after that, it stops triggering the cycle. Relay 4 turns off, but doesn't write to the log and doesn't trigger relay 1 to turn back on. If I start the cycle from the relay 4 starting point, it does the same thing, except that it logs 4 turning off and turns on relay 1, but doesn't turn relay 1 off, write 1 turning off to the log, or trigger relay 4 turning on.

I'm not sure what the best way to do this is. I would love a time based trigger; so I could put "Turn on relay 1 at 8:00am for ___ hours" or "Turn on relay 1 at ___ and off at ___" would be even better.

The restore log is moved as a part of the backup restore process

Therefore, when one restores a backup and attempts to view the log with the "Restore Log" button, it will print the restore log from the backup and not of the status of the current restore. The status of the current restore will be found in the the system backup that was made as a part of the restore process.

It also appears part of the restore status will be sent to the restore log of the new backup and part to the restore log of the restored backup.

Ability to link relays ([de]activation of a relay will [de]activate another)

Feature request: When one relay is activated, one or more other relays are activated. This permits the PID controller or a conditional statement could activate more than one relay.

Consider the following simple relay configuration to illustrate the utility:

Relay 1 (Fan), GPIO 10, Link Relay 2 (when Relay 1 turns on, Relay 2 does also)
Relay 2 (Heater), GPIO 15

Relay 3 (Fan), GPIO 10, Link Relay 4 (when Relay 3 turns on, Relay 4 does also)
Relay 4 (Cooler), GPIO 20

Notice that the same GPIO can be set for multiple relays, which can produce a number of conflicts.

What if the same GPIO is trying to be turned on for different durations?
How do the threaded functions to turn on the relays communicate with each other and select the longest duration?

Warn when PID Regulate and Up/Down Relay incorrectly set

If Both is selected, Up Relay and Down Relay needs to be set.
If Up is selected, Up Relay needs to be set
if Down is selected, Down Relay needs to be set

A warning should be given if any of these are incorrect and the PID is attempted to be turned on.

Lock relay/sensor log while generating graph

Rarely, the generation of a graph will coincide with a relay or sensor log being written. This can result in the log not being able to be read and the graph generating without any data as input, causing the graph to be empty.

The relay or sensor log needs to be locked by mycodoGraph.py while the log is being read/parsed.

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.