Live data from Hacker News

Show HN: I wanted to measure CO2 in my office, so I build a C++ WebServer/App

github.com

31–40 of 124 posts

Re: Show HN: I wanted to measure CO2 in my office, so I build a C++ WebServer/App

#32
post #16
post #8

Installed a CO2 monitor in my home two days ago. Already changed my life. It warns me when I need additional ventilation and even beeps if CO2 levels raise too high. It sounds silly but it's scary how quickly levels rise when the windows are closed.

> It sounds silly but it's scary how quickly levels rise when the windows are closed. It might be scary, but is it actually dangerous? It could just be that the levels shown, even if raised, are inconsequential. Basically wondering about the "Already changed my life" line. Are we all without one risk certain CO2 death every day, or is the parent overly worried over nothing (and opens windows without really a need for…

Higher ppm decreases cognitive function even at pretty low levels, so being alerted to open your window might improve your work / study.

There's at least this study: https://ehp.niehs.nih.gov/doi/10.1289/ehp.1510037

And this video has the quote "At 1000ppm there is a 15% decrease in cognitive function". https://www.youtube.com/watch?v=1Nh_vxpycEA

Re: Show HN: I wanted to measure CO2 in my office, so I build a C++ WebServer/App

#33

This device's manufacturer claims an accuracy of "± 100ppm or ± 7% of reading". But there's a review on Amazon that describes someone getting three units and finding as much as 600ppm variation among them. Maybe they need some kind of calibration or tuning? Or their manufacturing process is way out of control.

It definitely shows that this is one of the cheapest meters on the market. But the values seem to be realistic, when having all windows open it shows 450-460 ppm which is at least close to the global 400ppm ( and I live next to a road in a bigger city ).

Re: Show HN: I wanted to measure CO2 in my office, so I build a C++ WebServer/App

#34
post #17

Isn't C++ a bit overkill for a web app?

You are right, C++ is overkill. It would be much better if it was a javascript application with thousands of dependencies.

ahh so you're in the camp of wanting to re-create a graphing library for every project..

Re: Show HN: I wanted to measure CO2 in my office, so I build a C++ WebServer/App

#35

Isn't C++ a bit overkill for a web app?

Depends, this was a question I tried to answer for myself with this project. I did not easily find a good library for Python that would work on my Mac for reading the HID messages, so writing the device part in C++ was easier for me ( and an interesting excercise in c++17'ifying C code ). I thought about just having the c++ app be called from python, but wanted to try and see how hard it would be in c++ and found it…

Did you search for... "co2 meter python"? The pypi package called "CO2meter" (https://github.com/vfilimonov/co2meter) not only works well as a library on Mac OS, but also comes with a web-based dashboard:

  $ pip install CO2meter flask pandas
  ...
  $ co2meter_server
Edit: link

Re: Show HN: I wanted to measure CO2 in my office, so I build a C++ WebServer/App

#37
post #8

Installed a CO2 monitor in my home two days ago. Already changed my life. It warns me when I need additional ventilation and even beeps if CO2 levels raise too high. It sounds silly but it's scary how quickly levels rise when the windows are closed.

Why is it so scary? There is no danger for you to get sick or die.

I saw some study that suggests that higher CO2 levels decrease cognitive abilities. You wont die, but I do tend to get headaches when the air gets worse.

Re: Show HN: I wanted to measure CO2 in my office, so I build a C++ WebServer/App

#38
post #19
post #16

Earlier quoted context omitted.

> It sounds silly but it's scary how quickly levels rise when the windows are closed. It might be scary, but is it actually dangerous? It could just be that the levels shown, even if raised, are inconsequential. Basically wondering about the "Already changed my life" line. Are we all without one risk certain CO2 death every day, or is the parent overly worried over nothing (and opens windows without really a need for…

It could be dangerous if the room is completely sealed, as the oxygen would eventually run out.

Fun fact: humans do not have oxygen levels detection, but do have CO2 levels detection. Your body would ring all kinds of the alarm bells if CO2 levels rise above the norm, even if there is enough oxygen.

Re: Show HN: I wanted to measure CO2 in my office, so I build a C++ WebServer/App

#39
post #35

Earlier quoted context omitted.

Depends, this was a question I tried to answer for myself with this project. I did not easily find a good library for Python that would work on my Mac for reading the HID messages, so writing the device part in C++ was easier for me ( and an interesting excercise in c++17'ifying C code ). I thought about just having the c++ app be called from python, but wanted to try and see how hard it would be in c++ and found it…

Did you search for... "co2 meter python"? The pypi package called "CO2meter" ( https://github.com/vfilimonov/co2meter ) not only works well as a library on Mac OS, but also comes with a web-based dashboard: $ pip install CO2meter flask pandas ... $ co2meter_server Edit: link

That looks great as well! But for some reason the library they use (pyhidapi) would always crash on my Mac.

Re: Show HN: I wanted to measure CO2 in my office, so I build a C++ WebServer/App

#40
post #35

Earlier quoted context omitted.

Depends, this was a question I tried to answer for myself with this project. I did not easily find a good library for Python that would work on my Mac for reading the HID messages, so writing the device part in C++ was easier for me ( and an interesting excercise in c++17'ifying C code ). I thought about just having the c++ app be called from python, but wanted to try and see how hard it would be in c++ and found it…

Did you search for... "co2 meter python"? The pypi package called "CO2meter" ( https://github.com/vfilimonov/co2meter ) not only works well as a library on Mac OS, but also comes with a web-based dashboard: $ pip install CO2meter flask pandas ... $ co2meter_server Edit: link

Though with your steps it at least starts, but the webserver fails, and CTRL+C doesn't work ^^

   * Serving Flask app "co2meter.server" (lazy loading)
   * Environment: production
     WARNING: Do not use the development server in a production environment.
     Use a production WSGI server instead.
   * Debug mode: off
  INFO:werkzeug: * Running on http://127.0.0.1:1201/ (Press CTRL+C to quit)
  ERROR:flask.app:Exception on / [GET]
  Traceback (most recent call last):
    File "/usr/local/lib/python2.7/site-packages/flask/app.py", line 2292, in wsgi_app
      response = self.full_dispatch_request()
    File "/usr/local/lib/python2.7/site-packages/flask/app.py", line 1815, in full_dispatch_request
      rv = self.handle_user_exception(e)
    File "/usr/local/lib/python2.7/site-packages/flask/app.py", line 1718, in handle_user_exception
      reraise(exc_type, exc_value, tb)
    File "/usr/local/lib/python2.7/site-packages/flask/app.py", line 1813, in full_dispatch_request
      rv = self.dispatch_request()
    File "/usr/local/lib/python2.7/site-packages/flask/app.py", line 1799, in dispatch_request
      return self.view_functions[rule.endpoint](**req.view_args)
    File "/usr/local/lib/python2.7/site-packages/co2meter/server.py", line 64, in home
      data = read_logs()
    File "/usr/local/lib/python2.7/site-packages/co2meter/server.py", line 236, in read_logs
      with open(os.path.join('logs', name + '.csv'), 'r') as f:
  IOError: [Errno 2] No such file or directory: 'logs/co2.csv'
  INFO:werkzeug:127.0.0.1 - - [25/Jan/2019 14:18:23] "GET / HTTP/1.1" 500 -
  INFO:werkzeug:127.0.0.1 - - [25/Jan/2019 14:18:23] "GET /favicon.ico HTTP/1.1" 404 -
  ^C^C^C^C
  ^C^C
Post reply on HN