Code Monkey home page Code Monkey logo

rpi-flask-sqlite's Introduction

rpi-flask-sqlite's People

Contributors

mjrovai 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

Watchers

 avatar  avatar  avatar

rpi-flask-sqlite's Issues

Auto- Reload the page / 2 temps in one graph/ change graph time scale

Hello,
First let me thank you for this very well explained project.
I have rebuild this with a small modification and using a DS18B20 1-wire sensor.
As this has no humidity I just provided a fake value for it.

Sorry by abusing this git withoutr having a real issue - it's more a question on how to do things.
In fact I have a few questions:

  1. How can I get an automatic reload of the page? Now I have to click always on the refresh button, but I want this happening automatically after every 5 minuites without pressing that button.

  2. As I have Different temp sensors, would it be possible to show on the same graph the data from 2 sensors - Each one in a different color. I would like to compare 2 temp values on the same graph

  3. How to change the time scale "Samples" into hours?

Hope you can help me.
Thanks in advance
Kind regards,
Johan

SQLite3 Objects Throw Error

Error is regarding threading in Flask which may have been implemented since you put this out.

sqlite3.ProgrammingError: SQLite objects created in a thread can only be used in that same thread. The object was created in thread id 1996171984 and this is thread id 1946633312.

I worked around this by opening database, making calls, and closing database all in the functions where the executions are happening. I know this is extremely high overhead for a webserver but it seemed the easiest way to get around the threading issues.

I'll add here that your tutorials and code here are really good in going from hardware to something useful. Thank you for putting this out.

sqlite3.ProgrammingError

I am using this code for my project . It works well until the gauge section. But when I am trying to have the history graphs I am getting this error:

" * Running on http://0.0.0.0:80/ (Press CTRL+C to quit)
[2020-09-05 20:34:12,647] ERROR in app: Exception on / [GET]
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/flask/app.py", line 2292, in wsgi_app
response = self.full_dispatch_request()
File "/usr/lib/python3/dist-packages/flask/app.py", line 1815, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/lib/python3/dist-packages/flask/app.py", line 1718, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/usr/lib/python3/dist-packages/flask/_compat.py", line 35, in reraise
raise value
File "/usr/lib/python3/dist-packages/flask/app.py", line 1813, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/lib/python3/dist-packages/flask/app.py", line 1799, in dispatch_request
return self.view_functionsrule.endpoint
File "WebHist1.py", line 92, in index
time, temp, hum = getLastData()
File "WebHist1.py", line 28, in getLastData
for row in curs.execute("SELECT * FROM temp ORDER BY date DESC LIMIT 1"):
sqlite3.ProgrammingError: SQLite objects created in a thread can only be used in that same thread. The object was created in thread id 1996245712 and this is thread id 1941664864.
192.168.0.20 - - [05/Sep/2020 20:34:12] "GET / HTTP/1.1" 500 -
192.168.0.20 - - [05/Sep/2020 20:34:13] "GET /favicon.ico HTTP/1.1" 404 -
"
Can you please help on this error

Question about Database Operations

Hello,

Thank you for sharing this project, I am using this as a reference for my own similar project.

Was hoping to understand why you have multiple python files that execute table build operations. Is this just for demonstration purposes? Or for more control? Could you just put all those functions in the same python file and run?

thanks again,
John

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.