New final

This commit is contained in:
Milan Toman
2021-01-20 15:03:50 +01:00
parent 7f7b593450
commit 58b74300cb
19 changed files with 2203 additions and 0 deletions

331
doc/build/introduction.html vendored Normal file
View File

@@ -0,0 +1,331 @@
<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Introduction to Plutonium &mdash; Plutonium reporter 1.0 documentation</title>
<script type="text/javascript" src="_static/js/modernizr.min.js"></script>
<script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<script type="text/javascript" src="_static/language_data.js"></script>
<script type="text/javascript" src="_static/js/theme.js"></script>
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="prev" title="DOC: Plutonium reporter" href="index.html" />
</head>
<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search" >
<a href="index.html" class="icon icon-home"> Plutonium reporter
</a>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="search.html" method="get">
<input type="text" name="q" placeholder="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
<p class="caption"><span class="caption-text">Contents:</span></p>
<ul class="current">
<li class="toctree-l1 current"><a class="current reference internal" href="#">Introduction to Plutonium</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#directory-structure">Directory structure</a></li>
<li class="toctree-l2"><a class="reference internal" href="#cherrypy-configuration-config-py">CherryPy configuration (config.py)</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#cherrypy-configuration-file-plutonium-ini">CherryPy configuration file (plutonium.ini)</a></li>
<li class="toctree-l3"><a class="reference internal" href="#configuration-classes-and-functions">Configuration classes and functions</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="#cherrypy-server-chttpd-py">CherryPy server (chttpd.py)</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#modules-and-web-paths">Modules and web paths</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="#index-index-py">Index (index.py)</a></li>
<li class="toctree-l2"><a class="reference internal" href="#indices-and-tables">Indices and tables</a></li>
</ul>
</li>
</ul>
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
<nav class="wy-nav-top" aria-label="top navigation">
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="index.html">Plutonium reporter</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="breadcrumbs navigation">
<ul class="wy-breadcrumbs">
<li><a href="index.html">Docs</a> &raquo;</li>
<li>Introduction to Plutonium</li>
<li class="wy-breadcrumbs-aside">
<a href="_sources/introduction.rst.txt" rel="nofollow"> View page source</a>
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<div class="section" id="introduction-to-plutonium">
<h1>Introduction to Plutonium<a class="headerlink" href="#introduction-to-plutonium" title="Permalink to this headline"></a></h1>
<div class="toctree-wrapper compound">
</div>
<div class="section" id="directory-structure">
<h2>Directory structure<a class="headerlink" href="#directory-structure" title="Permalink to this headline"></a></h2>
<p>Following structure is applied to this project. Some directories are
minified in this view on purpose.</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>.
├── chttpd.py
├── config
│   └── plutonium.ini
├── config.py
├── doc ... (documentation in sphinx)
├── index.py
├── localdeploy.sh
├── modules
│   ├── dynamic.py
│   ├── status.py
│   ├── temphumi.py
│   ├── voltage.py
│   └── weather.py
├── static
│   ├── css
│   │   ├── bootstrap.css
│   │   └── dygraph.css ...
│   ├── img
│   │   ├── battery_0.png ...
│   └── js
│   ├── solar_graph.js
│   ├── status_graph.js
│   ├── temphum_graph.js
│   └── weather_graph.js ...
├── templates
│   ├── footer.html
│   ├── header.html
│   ├── landing_page.html
│   ├── status_admin.html
│   ├── temphumi_admin.html
│   ├── top_menu.html
│   ├── voltage_admin.html
│   └── weather_admin.html
└── TODO.txt
</pre></div>
</div>
</div>
<div class="section" id="cherrypy-configuration-config-py">
<h2>CherryPy configuration (config.py)<a class="headerlink" href="#cherrypy-configuration-config-py" title="Permalink to this headline"></a></h2>
<p>Configuration is stored in a separate file statically, so each submodule can
load the same configuration. This should be variables, that are project-wide.</p>
<div class="section" id="cherrypy-configuration-file-plutonium-ini">
<h3>CherryPy configuration file (plutonium.ini)<a class="headerlink" href="#cherrypy-configuration-file-plutonium-ini" title="Permalink to this headline"></a></h3>
<p>Configuration file, .ini style. Option = value. File resides in ./config
directory. It is read by confi.py and parsed into a dict(), available
throughout the project.</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">_server_protocol</span> <span class="o">=</span> <span class="n">https</span>
<span class="n">_server_name</span> <span class="o">=</span> <span class="n">bastart</span><span class="o">.</span><span class="n">spoton</span><span class="o">.</span><span class="n">cz</span>
<span class="n">_server_port</span> <span class="o">=</span> <span class="mi">80</span>
<span class="n">_server_bind_ip</span> <span class="o">=</span> <span class="mf">0.0</span><span class="o">.</span><span class="mf">0.0</span>
<span class="n">_influx_host</span> <span class="o">=</span> <span class="n">localhost</span>
<span class="n">_influx_port</span> <span class="o">=</span> <span class="mi">8086</span>
<span class="n">_influx_user</span> <span class="o">=</span> <span class="n">pi</span>
<span class="n">_influx_pwd</span> <span class="o">=</span> <span class="n">password</span>
<span class="n">_influx_weather_db</span> <span class="o">=</span> <span class="n">weather_v2</span>
<span class="n">_influx_status_db</span> <span class="o">=</span> <span class="n">status</span>
<span class="n">_influx_voltage_db</span> <span class="o">=</span> <span class="n">voltage</span>
<span class="n">_influx_IoT_db</span> <span class="o">=</span> <span class="n">weather_v2</span>
</pre></div>
</div>
</div>
<div class="section" id="configuration-classes-and-functions">
<h3>Configuration classes and functions<a class="headerlink" href="#configuration-classes-and-functions" title="Permalink to this headline"></a></h3>
</div>
</div>
<div class="section" id="cherrypy-server-chttpd-py">
<h2>CherryPy server (chttpd.py)<a class="headerlink" href="#cherrypy-server-chttpd-py" title="Permalink to this headline"></a></h2>
<p>The server uses CherryPy module. For more information, please consult the
Cherrypy documentation.</p>
<p>CHTTPD.py is also the executable, that can be launched as a standalone
application by simply typing ./chttpd.py, or python3 chttpd.py</p>
<div class="section" id="modules-and-web-paths">
<h3>Modules and web paths<a class="headerlink" href="#modules-and-web-paths" title="Permalink to this headline"></a></h3>
<p>Modules are located in the <cite>modules</cite> directory, hence the imports from a
subdirectory</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">modules</span> <span class="k">import</span> <span class="n">voltage</span>
<span class="kn">from</span> <span class="nn">modules</span> <span class="k">import</span> <span class="n">weather</span>
<span class="kn">from</span> <span class="nn">modules</span> <span class="k">import</span> <span class="n">dynamic</span>
<span class="kn">from</span> <span class="nn">modules</span> <span class="k">import</span> <span class="n">status</span>
<span class="kn">from</span> <span class="nn">modules</span> <span class="k">import</span> <span class="n">temphumi</span>
</pre></div>
</div>
<p>As can be seen, each class / module is mounted under a specific web path. This
is the preferred way of future expansion modules.</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">cherrypy</span><span class="o">.</span><span class="n">tree</span><span class="o">.</span><span class="n">mount</span><span class="p">(</span><span class="n">voltage</span><span class="o">.</span><span class="n">EnergyInfo</span><span class="p">(),</span> <span class="s2">&quot;/&quot;</span><span class="p">,</span> <span class="n">conf</span><span class="p">)</span>
<span class="n">cherrypy</span><span class="o">.</span><span class="n">tree</span><span class="o">.</span><span class="n">mount</span><span class="p">(</span><span class="n">voltage</span><span class="o">.</span><span class="n">EnergyInfo</span><span class="p">(),</span> <span class="s2">&quot;/energy&quot;</span><span class="p">,</span> <span class="n">conf</span><span class="p">)</span>
<span class="n">cherrypy</span><span class="o">.</span><span class="n">tree</span><span class="o">.</span><span class="n">mount</span><span class="p">(</span><span class="n">weather</span><span class="o">.</span><span class="n">WeatherInfo</span><span class="p">(),</span> <span class="s2">&quot;/weather&quot;</span><span class="p">,</span> <span class="n">conf</span><span class="p">)</span>
<span class="n">cherrypy</span><span class="o">.</span><span class="n">tree</span><span class="o">.</span><span class="n">mount</span><span class="p">(</span><span class="n">status</span><span class="o">.</span><span class="n">StatusInfo</span><span class="p">(),</span> <span class="s2">&quot;/status&quot;</span><span class="p">,</span> <span class="n">conf</span><span class="p">)</span>
<span class="n">cherrypy</span><span class="o">.</span><span class="n">tree</span><span class="o">.</span><span class="n">mount</span><span class="p">(</span><span class="n">dynamic</span><span class="o">.</span><span class="n">Expose</span><span class="p">(),</span> <span class="s2">&quot;/data&quot;</span><span class="p">,</span> <span class="n">conf</span><span class="p">)</span>
<span class="n">cherrypy</span><span class="o">.</span><span class="n">tree</span><span class="o">.</span><span class="n">mount</span><span class="p">(</span><span class="n">temphumi</span><span class="o">.</span><span class="n">PuerhInfo</span><span class="p">(),</span> <span class="s2">&quot;/temphumi&quot;</span><span class="p">,</span> <span class="n">conf</span><span class="p">)</span>
</pre></div>
</div>
</div>
</div>
<div class="section" id="index-index-py">
<h2>Index (index.py)<a class="headerlink" href="#index-index-py" title="Permalink to this headline"></a></h2>
<p>Reserved for future use. Currently not displayed, as the EnergyInfo() class is
mounted under root(/) of the web, defined in chttpd.py</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">cherrypy</span><span class="o">.</span><span class="n">tree</span><span class="o">.</span><span class="n">mount</span><span class="p">(</span><span class="n">voltage</span><span class="o">.</span><span class="n">EnergyInfo</span><span class="p">(),</span> <span class="s2">&quot;/&quot;</span><span class="p">,</span> <span class="n">conf</span><span class="p">)</span>
</pre></div>
</div>
</div>
<div class="section" id="indices-and-tables">
<h2>Indices and tables<a class="headerlink" href="#indices-and-tables" title="Permalink to this headline"></a></h2>
<ul class="simple">
<li><p><a class="reference internal" href="genindex.html"><span class="std std-ref">Index</span></a></p></li>
<li><p><a class="reference internal" href="py-modindex.html"><span class="std std-ref">Module Index</span></a></p></li>
<li><p><a class="reference internal" href="search.html"><span class="std std-ref">Search Page</span></a></p></li>
</ul>
</div>
</div>
</div>
</div>
<footer>
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
<a href="index.html" class="btn btn-neutral float-left" title="DOC: Plutonium reporter" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a>
</div>
<hr/>
<div role="contentinfo">
<p>
&copy; Copyright 2019, Milan &#39;Ventil&#39; Toman
</p>
</div>
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
</section>
</div>
<script type="text/javascript">
jQuery(function () {
SphinxRtdTheme.Navigation.enable(true);
});
</script>
</body>
</html>