mirror of
https://github.com/PiBrewing/craftbeerpi4.git
synced 2024-11-25 08:28:23 +01:00
619 lines
No EOL
24 KiB
HTML
619 lines
No EOL
24 KiB
HTML
|
||
|
||
<!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>Actor — CraftBeerPi 4.0 documentation</title>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<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="next" title="Sensor" href="sensor.html" />
|
||
<link rel="prev" title="Core" href="core.html" />
|
||
|
||
|
||
<script src="_static/js/modernizr.min.js"></script>
|
||
|
||
</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"> CraftBeerPi
|
||
|
||
|
||
|
||
</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">
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<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 current"><a class="current reference internal" href="#">Actor</a><ul>
|
||
<li class="toctree-l2"><a class="reference internal" href="#architecture">Architecture</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="#module-core.controller.actor_controller">ActorController</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="#custom-actor">Custom Actor</a></li>
|
||
</ul>
|
||
</li>
|
||
<li class="toctree-l1"><a class="reference internal" href="sensor.html">Sensor</a></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">CraftBeerPi</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> »</li>
|
||
|
||
<li>Actor</li>
|
||
|
||
|
||
<li class="wy-breadcrumbs-aside">
|
||
|
||
|
||
<a href="_sources/actor.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="actor">
|
||
<h1>Actor<a class="headerlink" href="#actor" title="Permalink to this headline">¶</a></h1>
|
||
<div class="section" id="architecture">
|
||
<h2>Architecture<a class="headerlink" href="#architecture" title="Permalink to this headline">¶</a></h2>
|
||
<a class="reference internal image-reference" href="_images/picture.jpeg"><img alt="_images/picture.jpeg" src="_images/picture.jpeg" style="width: 512.0px; height: 326.5px;" /></a>
|
||
</div>
|
||
<div class="section" id="module-core.controller.actor_controller">
|
||
<span id="actorcontroller"></span><h2>ActorController<a class="headerlink" href="#module-core.controller.actor_controller" title="Permalink to this headline">¶</a></h2>
|
||
<dl class="class">
|
||
<dt id="core.controller.actor_controller.ActorController">
|
||
<em class="property">class </em><code class="descclassname">core.controller.actor_controller.</code><code class="descname">ActorController</code><span class="sig-paren">(</span><em>cbpi</em><span class="sig-paren">)</span><a class="headerlink" href="#core.controller.actor_controller.ActorController" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The main actor controller</p>
|
||
<dl class="method">
|
||
<dt id="core.controller.actor_controller.ActorController.get_all">
|
||
<code class="descname">get_all</code><span class="sig-paren">(</span><em>force_db_update=False</em><span class="sig-paren">)</span><a class="headerlink" href="#core.controller.actor_controller.ActorController.get_all" 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">Parameters:</th><td class="field-body"><strong>force_db_update</strong> – </td>
|
||
</tr>
|
||
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"></td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
</dd></dl>
|
||
|
||
<dl class="method">
|
||
<dt id="core.controller.actor_controller.ActorController.http_add">
|
||
<code class="descname">http_add</code><span class="sig-paren">(</span><em>request</em><span class="sig-paren">)</span><a class="headerlink" href="#core.controller.actor_controller.ActorController.http_add" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>—
|
||
description: This end-point allow to test that service is up.
|
||
tags:
|
||
- REST API
|
||
produces:
|
||
- application/json
|
||
responses:</p>
|
||
<blockquote>
|
||
<div><dl class="docutils">
|
||
<dt>“200”:</dt>
|
||
<dd>description: successful operation. Return “pong” text</dd>
|
||
<dt>“405”:</dt>
|
||
<dd>description: invalid HTTP Method</dd>
|
||
</dl>
|
||
</div></blockquote>
|
||
</dd></dl>
|
||
|
||
<dl class="method">
|
||
<dt id="core.controller.actor_controller.ActorController.http_delete_one">
|
||
<code class="descname">http_delete_one</code><span class="sig-paren">(</span><em>request</em><span class="sig-paren">)</span><a class="headerlink" href="#core.controller.actor_controller.ActorController.http_delete_one" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>—
|
||
description: This end-point allow to test that service is up.
|
||
tags:
|
||
- REST API
|
||
produces:
|
||
- text/plain
|
||
responses:</p>
|
||
<blockquote>
|
||
<div><dl class="docutils">
|
||
<dt>“200”:</dt>
|
||
<dd>description: successful operation. Return “pong” text</dd>
|
||
<dt>“405”:</dt>
|
||
<dd>description: invalid HTTP Method</dd>
|
||
</dl>
|
||
</div></blockquote>
|
||
</dd></dl>
|
||
|
||
<dl class="method">
|
||
<dt id="core.controller.actor_controller.ActorController.http_get_all">
|
||
<code class="descname">http_get_all</code><span class="sig-paren">(</span><em>request</em><span class="sig-paren">)</span><a class="headerlink" href="#core.controller.actor_controller.ActorController.http_get_all" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>test</p>
|
||
<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">Parameters:</th><td class="field-body"><strong>request</strong> – </td>
|
||
</tr>
|
||
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"></td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
</dd></dl>
|
||
|
||
<dl class="method">
|
||
<dt id="core.controller.actor_controller.ActorController.http_get_one">
|
||
<code class="descname">http_get_one</code><span class="sig-paren">(</span><em>request</em><span class="sig-paren">)</span><a class="headerlink" href="#core.controller.actor_controller.ActorController.http_get_one" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>—
|
||
description: This end-point allow to test that service is up.
|
||
tags:
|
||
- REST API
|
||
produces:
|
||
- application/json
|
||
parameters:
|
||
- name: “id”</p>
|
||
<blockquote>
|
||
<div>in: “path”
|
||
description: “ID of object to return”
|
||
required: true
|
||
type: “integer”
|
||
format: “int64”</div></blockquote>
|
||
<dl class="docutils">
|
||
<dt>responses:</dt>
|
||
<dd><dl class="first last docutils">
|
||
<dt>“200”:</dt>
|
||
<dd>description: successful operation. Return “pong” text</dd>
|
||
<dt>“405”:</dt>
|
||
<dd>description: invalid HTTP Method</dd>
|
||
</dl>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="method">
|
||
<dt id="core.controller.actor_controller.ActorController.http_off">
|
||
<code class="descname">http_off</code><span class="sig-paren">(</span><em>request</em><span class="sig-paren">)</span> → aiohttp.web_response.Response<a class="headerlink" href="#core.controller.actor_controller.ActorController.http_off" 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">Parameters:</th><td class="field-body"><strong>request</strong> – </td>
|
||
</tr>
|
||
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"></td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
</dd></dl>
|
||
|
||
<dl class="method">
|
||
<dt id="core.controller.actor_controller.ActorController.http_on">
|
||
<code class="descname">http_on</code><span class="sig-paren">(</span><em>request</em><span class="sig-paren">)</span> → aiohttp.web_response.Response<a class="headerlink" href="#core.controller.actor_controller.ActorController.http_on" 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">Parameters:</th><td class="field-body"><strong>request</strong> – </td>
|
||
</tr>
|
||
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"></td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
</dd></dl>
|
||
|
||
<dl class="method">
|
||
<dt id="core.controller.actor_controller.ActorController.http_toggle">
|
||
<code class="descname">http_toggle</code><span class="sig-paren">(</span><em>request</em><span class="sig-paren">)</span> → aiohttp.web_response.Response<a class="headerlink" href="#core.controller.actor_controller.ActorController.http_toggle" 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">Parameters:</th><td class="field-body"><strong>request</strong> – </td>
|
||
</tr>
|
||
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"></td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
</dd></dl>
|
||
|
||
<dl class="method">
|
||
<dt id="core.controller.actor_controller.ActorController.http_update">
|
||
<code class="descname">http_update</code><span class="sig-paren">(</span><em>request</em><span class="sig-paren">)</span><a class="headerlink" href="#core.controller.actor_controller.ActorController.http_update" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>—
|
||
description: This end-point allow to test that service is up.
|
||
tags:
|
||
- REST API
|
||
produces:
|
||
- application/json
|
||
parameters:
|
||
- in: body</p>
|
||
<blockquote>
|
||
<div><p>name: body
|
||
description: Created user object
|
||
required: false
|
||
schema:</p>
|
||
<blockquote>
|
||
<div><p>type: object
|
||
properties:</p>
|
||
<blockquote>
|
||
<div><dl class="docutils">
|
||
<dt>id:</dt>
|
||
<dd>type: integer
|
||
format: int64</dd>
|
||
</dl>
|
||
</div></blockquote>
|
||
</div></blockquote>
|
||
</div></blockquote>
|
||
<dl class="docutils">
|
||
<dt>responses:</dt>
|
||
<dd><dl class="first last docutils">
|
||
<dt>“200”:</dt>
|
||
<dd>description: successful operation. Return “pong” text</dd>
|
||
<dt>“405”:</dt>
|
||
<dd>description: invalid HTTP Method</dd>
|
||
</dl>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="method">
|
||
<dt id="core.controller.actor_controller.ActorController.init">
|
||
<code class="descname">init</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#core.controller.actor_controller.ActorController.init" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>This method initializes all actors during startup. It creates actor instances</p>
|
||
<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="method">
|
||
<dt id="core.controller.actor_controller.ActorController.off">
|
||
<code class="descname">off</code><span class="sig-paren">(</span><em>id</em>, <em>**kwargs</em><span class="sig-paren">)</span> → None<a class="headerlink" href="#core.controller.actor_controller.ActorController.off" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Method to switch and actor off
|
||
Supporting Event Topic “actor/+/off”</p>
|
||
<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">Parameters:</th><td class="field-body"><ul class="first last simple">
|
||
<li><strong>id</strong> – </li>
|
||
<li><strong>kwargs</strong> – </li>
|
||
</ul>
|
||
</td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
</dd></dl>
|
||
|
||
<dl class="method">
|
||
<dt id="core.controller.actor_controller.ActorController.on">
|
||
<code class="descname">on</code><span class="sig-paren">(</span><em>id</em>, <em>power=100</em>, <em>**kwargs</em><span class="sig-paren">)</span> → None<a class="headerlink" href="#core.controller.actor_controller.ActorController.on" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Method to switch an actor on.
|
||
Supporting Event Topic “actor/+/on”</p>
|
||
<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">Parameters:</th><td class="field-body"><ul class="first simple">
|
||
<li><strong>id</strong> – the actor id</li>
|
||
<li><strong>power</strong> – as integer value between 1 and 100</li>
|
||
<li><strong>kwargs</strong> – </li>
|
||
</ul>
|
||
</td>
|
||
</tr>
|
||
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last"></p>
|
||
</td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
</dd></dl>
|
||
|
||
<dl class="method">
|
||
<dt id="core.controller.actor_controller.ActorController.toggle">
|
||
<code class="descname">toggle</code><span class="sig-paren">(</span><em>id</em>, <em>power=100</em>, <em>**kwargs</em><span class="sig-paren">)</span> → None<a class="headerlink" href="#core.controller.actor_controller.ActorController.toggle" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Method to toggle an actor on or off
|
||
Supporting Event Topic “actor/+/toggle”</p>
|
||
<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">Parameters:</th><td class="field-body"><strong>power</strong> – </td>
|
||
</tr>
|
||
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"></td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
</dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
</div>
|
||
<div class="section" id="custom-actor">
|
||
<h2>Custom Actor<a class="headerlink" href="#custom-actor" 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
|
||
36
|
||
37
|
||
38
|
||
39
|
||
40
|
||
41
|
||
42
|
||
43
|
||
44
|
||
45
|
||
46
|
||
47
|
||
48
|
||
49
|
||
50
|
||
51
|
||
52
|
||
53
|
||
54
|
||
55
|
||
56
|
||
57
|
||
58
|
||
59</pre></div></td><td class="code"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">logging</span>
|
||
|
||
<span class="kn">from</span> <span class="nn">core.api</span> <span class="kn">import</span> <span class="n">CBPiActor</span><span class="p">,</span> <span class="n">Property</span><span class="p">,</span> <span class="n">action</span><span class="p">,</span> <span class="n">background_task</span>
|
||
|
||
|
||
|
||
<span class="k">class</span> <span class="nc">CustomActor</span><span class="p">(</span><span class="n">CBPiActor</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">"Test"</span><span class="p">)</span>
|
||
<span class="n">name1</span> <span class="o">=</span> <span class="n">Property</span><span class="o">.</span><span class="n">Text</span><span class="p">(</span><span class="n">label</span><span class="o">=</span><span class="s2">"Test"</span><span class="p">)</span>
|
||
<span class="n">name2</span> <span class="o">=</span> <span class="n">Property</span><span class="o">.</span><span class="n">Kettle</span><span class="p">(</span><span class="n">label</span><span class="o">=</span><span class="s2">"Test"</span><span class="p">)</span>
|
||
|
||
<span class="nd">@background_task</span><span class="p">(</span><span class="s2">"s1"</span><span class="p">,</span> <span class="n">interval</span><span class="o">=</span><span class="mi">2</span><span class="p">)</span>
|
||
<span class="n">async</span> <span class="k">def</span> <span class="nf">bg_job</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
|
||
<span class="k">print</span><span class="p">(</span><span class="s2">"WOOH BG"</span><span class="p">)</span>
|
||
|
||
<span class="nd">@action</span><span class="p">(</span><span class="n">key</span><span class="o">=</span><span class="s2">"name"</span><span class="p">,</span> <span class="n">parameters</span><span class="o">=</span><span class="p">{})</span>
|
||
<span class="k">def</span> <span class="nf">myAction</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
|
||
<span class="k">pass</span>
|
||
|
||
<span class="k">def</span> <span class="nf">state</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
|
||
<span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">state</span><span class="p">()</span>
|
||
|
||
<span class="k">def</span> <span class="nf">off</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
|
||
<span class="k">print</span><span class="p">(</span><span class="s2">"OFF"</span><span class="p">)</span>
|
||
<span class="bp">self</span><span class="o">.</span><span class="n">state</span> <span class="o">=</span> <span class="bp">False</span>
|
||
|
||
<span class="k">def</span> <span class="nf">on</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">power</span><span class="o">=</span><span class="mi">100</span><span class="p">):</span>
|
||
|
||
<span class="k">print</span><span class="p">(</span><span class="s2">"ON"</span><span class="p">)</span>
|
||
<span class="bp">self</span><span class="o">.</span><span class="n">state</span> <span class="o">=</span> <span class="bp">True</span>
|
||
|
||
|
||
<span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">cbpi</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
|
||
|
||
<span class="k">if</span> <span class="n">cbpi</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
|
||
<span class="k">return</span>
|
||
|
||
<span class="k">print</span><span class="p">(</span><span class="s2">"INIT MY ACTOR111111"</span><span class="p">)</span>
|
||
<span class="bp">self</span><span class="o">.</span><span class="n">cfg</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">load_config</span><span class="p">()</span>
|
||
|
||
<span class="bp">self</span><span class="o">.</span><span class="n">logger</span> <span class="o">=</span> <span class="n">logging</span><span class="o">.</span><span class="n">getLogger</span><span class="p">(</span><span class="vm">__file__</span><span class="p">)</span>
|
||
<span class="n">logging</span><span class="o">.</span><span class="n">basicConfig</span><span class="p">(</span><span class="n">level</span><span class="o">=</span><span class="n">logging</span><span class="o">.</span><span class="n">INFO</span><span class="p">)</span>
|
||
|
||
<span class="bp">self</span><span class="o">.</span><span class="n">logger</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s2">"########WOOHOO MY ACTOR"</span><span class="p">)</span>
|
||
<span class="bp">self</span><span class="o">.</span><span class="n">cbpi</span> <span class="o">=</span> <span class="n">cbpi</span>
|
||
|
||
|
||
<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">'''</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>
|
||
<span class="sd"> </span>
|
||
<span class="sd"> :param cbpi: the cbpi core </span>
|
||
<span class="sd"> :return: </span>
|
||
<span class="sd"> '''</span>
|
||
|
||
<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">"CustomActor"</span><span class="p">,</span> <span class="n">CustomActor</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">Manuel</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>
|
||
</div>
|
||
|
||
|
||
</div>
|
||
|
||
</div>
|
||
<footer>
|
||
|
||
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
|
||
|
||
<a href="sensor.html" class="btn btn-neutral float-right" title="Sensor" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a>
|
||
|
||
|
||
<a href="core.html" class="btn btn-neutral" title="Core" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a>
|
||
|
||
</div>
|
||
|
||
|
||
<hr/>
|
||
|
||
<div role="contentinfo">
|
||
<p>
|
||
© Copyright 2018, Manuel Fritsch
|
||
|
||
</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" 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/js/theme.js"></script>
|
||
|
||
<script type="text/javascript">
|
||
jQuery(function () {
|
||
SphinxRtdTheme.Navigation.enable(true);
|
||
});
|
||
</script>
|
||
|
||
</body>
|
||
</html> |