craftbeerpi4-pione/docs/step.html

371 lines
19 KiB
HTML
Raw Normal View History

2018-11-16 20:49:16 +01:00
2018-12-08 14:21:00 +01:00
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Brewing Step &#8212; CraftBeerPi 4.0 documentation</title>
<link rel="stylesheet" href="_static/alabaster.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<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>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="Kettle" href="kettle_controller.html" />
<link rel="prev" title="Sensor" href="sensor.html" />
<link rel="stylesheet" href="_static/custom.css" type="text/css" />
2018-11-18 15:40:10 +01:00
2018-12-08 14:21:00 +01:00
<meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9" />
2018-11-18 15:40:10 +01:00
2018-12-08 14:21:00 +01:00
</head><body>
2018-11-18 15:40:10 +01:00
2018-12-08 14:21:00 +01:00
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
2018-11-18 15:40:10 +01:00
2018-12-08 14:21:00 +01:00
<div class="body" role="main">
<div class="section" id="brewing-step">
<h1>Brewing Step<a class="headerlink" href="#brewing-step" title="Permalink to this headline"></a></h1>
<div class="section" id="stepcontroller">
<h2>StepController<a class="headerlink" href="#stepcontroller" title="Permalink to this headline"></a></h2>
<dl class="class">
<dt id="core.controller.step_controller.StepController">
<em class="property">class </em><code class="descclassname">core.controller.step_controller.</code><code class="descname">StepController</code><span class="sig-paren">(</span><em>cbpi</em><span class="sig-paren">)</span><a class="headerlink" href="#core.controller.step_controller.StepController" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">core.http_endpoints.http_api.HttpAPI</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">core.controller.crud_controller.CRUDController</span></code></p>
<dl class="method">
<dt id="core.controller.step_controller.StepController._step_done">
<code class="descname">_step_done</code><span class="sig-paren">(</span><em>task</em><span class="sig-paren">)</span><a class="headerlink" href="#core.controller.step_controller.StepController._step_done" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="core.controller.step_controller.StepController.get_manged_fields_as_array">
<code class="descname">get_manged_fields_as_array</code><span class="sig-paren">(</span><em>type_cfg</em><span class="sig-paren">)</span><a class="headerlink" href="#core.controller.step_controller.StepController.get_manged_fields_as_array" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="core.controller.step_controller.StepController.handle">
<code class="descname">handle</code><span class="sig-paren">(</span><em>topic</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#core.controller.step_controller.StepController.handle" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="core.controller.step_controller.StepController.handle_action">
<code class="descname">handle_action</code><span class="sig-paren">(</span><em>topic</em>, <em>action</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#core.controller.step_controller.StepController.handle_action" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="core.controller.step_controller.StepController.handle_next">
<code class="descname">handle_next</code><span class="sig-paren">(</span><em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#core.controller.step_controller.StepController.handle_next" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="core.controller.step_controller.StepController.handle_reset">
<code class="descname">handle_reset</code><span class="sig-paren">(</span><em>topic</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#core.controller.step_controller.StepController.handle_reset" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="core.controller.step_controller.StepController.handle_start">
<code class="descname">handle_start</code><span class="sig-paren">(</span><em>topic</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#core.controller.step_controller.StepController.handle_start" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="core.controller.step_controller.StepController.handle_stop">
<code class="descname">handle_stop</code><span class="sig-paren">(</span><em>topic</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#core.controller.step_controller.StepController.handle_stop" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="core.controller.step_controller.StepController.http_action">
<code class="descname">http_action</code><span class="sig-paren">(</span><em>request</em><span class="sig-paren">)</span><a class="headerlink" href="#core.controller.step_controller.StepController.http_action" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="core.controller.step_controller.StepController.http_reset">
<code class="descname">http_reset</code><span class="sig-paren">(</span><em>request</em><span class="sig-paren">)</span><a class="headerlink" href="#core.controller.step_controller.StepController.http_reset" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="core.controller.step_controller.StepController.http_start">
<code class="descname">http_start</code><span class="sig-paren">(</span><em>request</em><span class="sig-paren">)</span><a class="headerlink" href="#core.controller.step_controller.StepController.http_start" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="core.controller.step_controller.StepController.init">
<code class="descname">init</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#core.controller.step_controller.StepController.init" title="Permalink to this definition"></a></dt>
<dd><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body"></td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="attribute">
<dt id="core.controller.step_controller.StepController.model">
<code class="descname">model</code><a class="headerlink" href="#core.controller.step_controller.StepController.model" title="Permalink to this definition"></a></dt>
<dd><p>alias of <code class="xref py py-class docutils literal notranslate"><span class="pre">core.database.model.StepModel</span></code></p>
</dd></dl>
<dl class="method">
<dt id="core.controller.step_controller.StepController.start">
<code class="descname">start</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#core.controller.step_controller.StepController.start" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="core.controller.step_controller.StepController.stop">
<code class="descname">stop</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#core.controller.step_controller.StepController.stop" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>
2018-11-18 15:40:10 +01:00
2018-12-08 14:21:00 +01:00
</div>
<div class="section" id="simplestep">
<h2>SimpleStep<a class="headerlink" href="#simplestep" title="Permalink to this headline"></a></h2>
<dl class="class">
<dt id="core.api.step.SimpleStep">
<em class="property">class </em><code class="descclassname">core.api.step.</code><code class="descname">SimpleStep</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#core.api.step.SimpleStep" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p>
<dl class="attribute">
<dt id="core.api.step.SimpleStep._SimpleStep__dirty">
<code class="descname">_SimpleStep__dirty</code><em class="property"> = False</em><a class="headerlink" href="#core.api.step.SimpleStep._SimpleStep__dirty" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="core.api.step.SimpleStep._exception_count">
<code class="descname">_exception_count</code><em class="property"> = 0</em><a class="headerlink" href="#core.api.step.SimpleStep._exception_count" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="core.api.step.SimpleStep._interval">
<code class="descname">_interval</code><em class="property"> = 1</em><a class="headerlink" href="#core.api.step.SimpleStep._interval" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="core.api.step.SimpleStep._max_exceptions">
<code class="descname">_max_exceptions</code><em class="property"> = 2</em><a class="headerlink" href="#core.api.step.SimpleStep._max_exceptions" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="core.api.step.SimpleStep.is_dirty">
<code class="descname">is_dirty</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#core.api.step.SimpleStep.is_dirty" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="core.api.step.SimpleStep.managed_fields">
<code class="descname">managed_fields</code><em class="property"> = []</em><a class="headerlink" href="#core.api.step.SimpleStep.managed_fields" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="core.api.step.SimpleStep.next">
<code class="descname">next</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#core.api.step.SimpleStep.next" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="core.api.step.SimpleStep.reset">
<code class="descname">reset</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#core.api.step.SimpleStep.reset" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="core.api.step.SimpleStep.reset_dirty">
<code class="descname">reset_dirty</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#core.api.step.SimpleStep.reset_dirty" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="core.api.step.SimpleStep.run">
<code class="descname">run</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#core.api.step.SimpleStep.run" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="core.api.step.SimpleStep.run_cycle">
<code class="descname">run_cycle</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#core.api.step.SimpleStep.run_cycle" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="core.api.step.SimpleStep.running">
<code class="descname">running</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#core.api.step.SimpleStep.running" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="core.api.step.SimpleStep.stop">
<code class="descname">stop</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#core.api.step.SimpleStep.stop" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>
2018-11-16 20:49:16 +01:00
2018-12-08 14:21:00 +01:00
</div>
<div class="section" id="custom-step">
<h2>Custom Step<a class="headerlink" href="#custom-step" title="Permalink to this headline"></a></h2>
<div class="literal-block-wrapper docutils container" id="init-py">
<div class="code-block-caption"><span class="caption-text">__init__.py</span><a class="headerlink" href="#init-py" title="Permalink to this code"></a></div>
<div class="highlight-python notranslate"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre> 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35</pre></div></td><td class="code"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">asyncio</span>
<span class="kn">from</span> <span class="nn">core.api</span> <span class="kn">import</span> <span class="n">Property</span><span class="p">,</span> <span class="n">action</span>
<span class="kn">from</span> <span class="nn">core.api.step</span> <span class="kn">import</span> <span class="n">SimpleStep</span>
<span class="k">class</span> <span class="nc">CustomStep</span><span class="p">(</span><span class="n">SimpleStep</span><span class="p">):</span>
<span class="n">name</span> <span class="o">=</span> <span class="n">Property</span><span class="o">.</span><span class="n">Number</span><span class="p">(</span><span class="n">label</span><span class="o">=</span><span class="s2">&quot;Test&quot;</span><span class="p">)</span>
<span class="n">i</span> <span class="o">=</span> <span class="mi">0</span>
<span class="nd">@action</span><span class="p">(</span><span class="n">key</span><span class="o">=</span><span class="s2">&quot;name&quot;</span><span class="p">,</span> <span class="n">parameters</span><span class="o">=</span><span class="bp">None</span><span class="p">)</span>
<span class="k">def</span> <span class="nf">test</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
<span class="bp">self</span><span class="o">.</span><span class="n">name</span><span class="o">=</span><span class="s2">&quot;WOOHOO&quot;</span>
2018-11-18 15:40:10 +01:00
2018-12-08 14:21:00 +01:00
<span class="n">async</span> <span class="k">def</span> <span class="nf">run_cycle</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
2018-11-18 15:40:10 +01:00
2018-12-08 14:21:00 +01:00
<span class="c1">#await asyncio.sleep(1)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">i</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">i</span> <span class="o">+</span> <span class="mi">1</span>
2018-11-16 20:49:16 +01:00
2018-12-08 14:21:00 +01:00
<span class="k">print</span><span class="p">(</span><span class="s2">&quot;RUN STEP&quot;</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">id</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">name</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="vm">__dict__</span><span class="p">)</span>
2018-11-18 15:40:10 +01:00
2018-11-16 20:49:16 +01:00
2018-12-08 14:21:00 +01:00
<span class="k">def</span> <span class="nf">setup</span><span class="p">(</span><span class="n">cbpi</span><span class="p">):</span>
<span class="sd">&#39;&#39;&#39;</span>
<span class="sd"> This method is called by the server during startup </span>
<span class="sd"> Here you need to register your plugins at the server</span>
2018-11-18 15:40:10 +01:00
2018-12-08 14:21:00 +01:00
<span class="sd"> :param cbpi: the cbpi core </span>
<span class="sd"> :return: </span>
<span class="sd"> &#39;&#39;&#39;</span>
2018-11-18 15:40:10 +01:00
2018-12-08 14:21:00 +01:00
<span class="n">cbpi</span><span class="o">.</span><span class="n">plugin</span><span class="o">.</span><span class="n">register</span><span class="p">(</span><span class="s2">&quot;CustomStep&quot;</span><span class="p">,</span> <span class="n">CustomStep</span><span class="p">)</span>
</pre></div>
</td></tr></table></div>
</div>
<p>config.yaml</p>
<div class="highlight-yaml notranslate"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1
2</pre></div></td><td class="code"><div class="highlight"><pre><span></span><span class="l l-Scalar l-Scalar-Plain">name</span><span class="p p-Indicator">:</span> <span class="l l-Scalar l-Scalar-Plain">DummyStep</span>
<span class="l l-Scalar l-Scalar-Plain">version</span><span class="p p-Indicator">:</span> <span class="l l-Scalar l-Scalar-Plain">4</span>
</pre></div>
</td></tr></table></div>
</div>
2018-11-16 20:49:16 +01:00
</div>
2018-12-08 14:21:00 +01:00
</div>
2018-11-16 20:49:16 +01:00
</div>
</div>
2018-12-08 14:21:00 +01:00
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<h1 class="logo"><a href="index.html">CraftBeerPi</a></h1>
2018-11-18 15:40:10 +01:00
2018-12-08 14:21:00 +01:00
<h3>Navigation</h3>
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="install.html">Installation</a></li>
<li class="toctree-l1"><a class="reference internal" href="core.html">Core</a></li>
<li class="toctree-l1"><a class="reference internal" href="actor.html">Actor</a></li>
<li class="toctree-l1"><a class="reference internal" href="sensor.html">Sensor</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">Brewing Step</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#stepcontroller">StepController</a></li>
<li class="toctree-l2"><a class="reference internal" href="#simplestep">SimpleStep</a></li>
<li class="toctree-l2"><a class="reference internal" href="#custom-step">Custom Step</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="kettle_controller.html">Kettle</a></li>
<li class="toctree-l1"><a class="reference internal" href="properties.html">Properties</a></li>
</ul>
2018-11-18 15:40:10 +01:00
2018-12-08 14:21:00 +01:00
<div class="relations">
<h3>Related Topics</h3>
<ul>
<li><a href="index.html">Documentation overview</a><ul>
<li>Previous: <a href="sensor.html" title="previous chapter">Sensor</a></li>
<li>Next: <a href="kettle_controller.html" title="next chapter">Kettle</a></li>
</ul></li>
</ul>
2018-11-16 20:49:16 +01:00
</div>
2018-12-08 14:21:00 +01:00
<div id="searchbox" style="display: none" role="search">
<h3>Quick search</h3>
<div class="searchformwrapper">
<form class="search" action="search.html" method="get">
<input type="text" name="q" />
<input type="submit" value="Go" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
2018-11-16 20:49:16 +01:00
</div>
2018-12-08 14:21:00 +01:00
<script type="text/javascript">$('#searchbox').show(0);</script>
2018-11-16 20:49:16 +01:00
</div>
</div>
2018-12-08 14:21:00 +01:00
<div class="clearer"></div>
</div>
<div class="footer">
&copy;2018, Manuel Fritsch.
|
Powered by <a href="http://sphinx-doc.org/">Sphinx 1.8.2</a>
&amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.12</a>
|
<a href="_sources/step.rst.txt"
rel="nofollow">Page source</a>
</div>
2018-11-16 20:49:16 +01:00
2018-11-18 15:40:10 +01:00
2018-12-08 14:21:00 +01:00
</body>
2018-11-16 20:49:16 +01:00
</html>