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 > Actor — 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 >
2018-11-16 20:49:16 +01:00
< link rel = "index" title = "Index" href = "genindex.html" / >
< link rel = "search" title = "Search" href = "search.html" / >
2018-11-16 21:48:57 +01:00
< link rel = "next" title = "Sensor" href = "sensor.html" / >
2018-12-08 14:21:00 +01:00
< link rel = "prev" title = "Core" href = "core.html" / >
2018-11-18 15:40:10 +01:00
2018-12-08 14:21:00 +01:00
< link rel = "stylesheet" href = "_static/custom.css" type = "text/css" / >
< 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" >
2018-11-16 20:49:16 +01:00
2018-11-16 21:48:57 +01:00
< 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 >
2018-12-08 14:21:00 +01:00
< div class = "section" id = "actorcontroller" >
< h2 > ActorController< a class = "headerlink" href = "#actorcontroller" title = "Permalink to this headline" > ¶< / a > < / h2 >
2018-11-16 21:48:57 +01:00
< dl class = "class" >
2018-11-16 20:49:16 +01:00
< 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 >
2018-12-08 14:21:00 +01:00
< dd > < p > Bases: < code class = "xref py py-class docutils literal notranslate" > < span class = "pre" > core.controller.actor_controller.ActorHttp< / span > < / code > , < code class = "xref py py-class docutils literal notranslate" > < span class = "pre" > core.controller.crud_controller.CRUDController< / span > < / code > < / p >
< p > The main actor controller< / p >
2018-11-18 15:40:10 +01:00
< dl class = "method" >
2018-12-08 14:21:00 +01:00
< 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" >
2018-11-18 15:40:10 +01:00
< col class = "field-name" / >
< col class = "field-body" / >
< tbody valign = "top" >
2018-12-08 14:21:00 +01:00
< tr class = "field-odd field" > < th class = "field-name" > Returns:< / th > < td class = "field-body" > < / td >
2018-11-18 15:40:10 +01:00
< / tr >
< / tbody >
< / table >
< / dd > < / dl >
2018-12-08 14:21:00 +01:00
< dl class = "attribute" >
< dt id = "core.controller.actor_controller.ActorController.model" >
< code class = "descname" > model< / code > < a class = "headerlink" href = "#core.controller.actor_controller.ActorController.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.ActorModel< / span > < / code > < / p >
2018-11-18 15:40:10 +01:00
< / dd > < / dl >
< dl class = "method" >
2018-12-08 14:21:00 +01:00
< 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 >
2018-11-18 15:40:10 +01:00
< table class = "docutils field-list" frame = "void" rules = "none" >
< col class = "field-name" / >
< col class = "field-body" / >
< tbody valign = "top" >
2018-12-08 14:21:00 +01:00
< tr class = "field-odd field" > < th class = "field-name" > Parameters:< / th > < td class = "field-body" > < ul class = "first last simple" >
< li > < strong > id< / strong > – the actor id< / li >
< li > < strong > kwargs< / strong > – < / li >
< / ul >
< / td >
2018-11-18 15:40:10 +01:00
< / tr >
< / tbody >
< / table >
< / dd > < / dl >
< dl class = "method" >
2018-12-08 14:21:00 +01:00
< 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" >
2018-11-18 15:40:10 +01:00
< col class = "field-name" / >
< col class = "field-body" / >
< tbody valign = "top" >
2018-12-08 14:21:00 +01:00
< tr class = "field-odd field" > < th class = "field-name" > Parameters:< / th > < td class = "field-body" > < ul class = "first simple" >
< li > < strong > actor_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 >
2018-11-18 15:40:10 +01:00
< / tr >
2018-12-08 14:21:00 +01:00
< tr class = "field-even field" > < th class = "field-name" > Returns:< / th > < td class = "field-body" > < p class = "first last" > < / p >
< / td >
2018-11-18 15:40:10 +01:00
< / tr >
< / tbody >
< / table >
< / dd > < / dl >
< dl class = "method" >
2018-12-08 14:21:00 +01:00
< dt id = "core.controller.actor_controller.ActorController.register" >
< code class = "descname" > register< / code > < span class = "sig-paren" > (< / span > < em > name< / em > , < em > clazz< / em > < span class = "sig-paren" > )< / span > → None< a class = "headerlink" href = "#core.controller.actor_controller.ActorController.register" title = "Permalink to this definition" > ¶< / a > < / dt >
< dd > < / dd > < / dl >
2018-11-18 15:40:10 +01:00
< dl class = "method" >
2018-12-08 14:21:00 +01:00
< 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" >
2018-11-18 15:40:10 +01:00
< col class = "field-name" / >
< col class = "field-body" / >
< tbody valign = "top" >
2018-12-08 14:21:00 +01:00
< 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 > – the power as interger between 0 and 100< / li >
< / ul >
< / td >
2018-11-18 15:40:10 +01:00
< / tr >
2018-12-08 14:21:00 +01:00
< tr class = "field-even field" > < th class = "field-name" > Returns:< / th > < td class = "field-body" > < p class = "first last" > < / p >
< / td >
2018-11-18 15:40:10 +01:00
< / tr >
< / tbody >
< / table >
< / dd > < / dl >
< / dd > < / dl >
2018-12-08 14:21:00 +01:00
< / div >
< div class = "section" id = "cbpiactor" >
< h2 > CBPiActor< a class = "headerlink" href = "#cbpiactor" title = "Permalink to this headline" > ¶< / a > < / h2 >
< dl class = "class" >
< dt id = "core.api.actor.CBPiActor" >
< em class = "property" > class < / em > < code class = "descclassname" > core.api.actor.< / code > < code class = "descname" > CBPiActor< / code > < span class = "sig-paren" > (< / span > < em > *args< / em > , < em > **kwds< / em > < span class = "sig-paren" > )< / span > < a class = "headerlink" href = "#core.api.actor.CBPiActor" title = "Permalink to this definition" > ¶< / a > < / dt >
< dd > < p > Bases: < code class = "xref py py-class docutils literal notranslate" > < span class = "pre" > core.api.extension.CBPiExtension< / span > < / code > < / p >
2018-11-16 20:49:16 +01:00
< dl class = "method" >
2018-12-08 14:21:00 +01:00
< dt id = "core.api.actor.CBPiActor.off" >
< code class = "descname" > off< / code > < span class = "sig-paren" > (< / span > < span class = "sig-paren" > )< / span > < a class = "headerlink" href = "#core.api.actor.CBPiActor.off" title = "Permalink to this definition" > ¶< / a > < / dt >
< dd > < p > Code to switch the actor off< / p >
2018-11-16 20:49:16 +01:00
< table class = "docutils field-list" frame = "void" rules = "none" >
< col class = "field-name" / >
< col class = "field-body" / >
< tbody valign = "top" >
2018-12-08 14:21:00 +01:00
< tr class = "field-odd field" > < th class = "field-name" > Returns:< / th > < td class = "field-body" > None< / td >
2018-11-16 20:49:16 +01:00
< / tr >
< / tbody >
< / table >
< / dd > < / dl >
< dl class = "method" >
2018-12-08 14:21:00 +01:00
< dt id = "core.api.actor.CBPiActor.on" >
< code class = "descname" > on< / code > < span class = "sig-paren" > (< / span > < em > power< / em > < span class = "sig-paren" > )< / span > < a class = "headerlink" href = "#core.api.actor.CBPiActor.on" title = "Permalink to this definition" > ¶< / a > < / dt >
< dd > < p > Code to switch the actor on. Power is provided as integer value< / p >
2018-11-18 15:40:10 +01:00
< table class = "docutils field-list" frame = "void" rules = "none" >
2018-11-16 20:49:16 +01:00
< col class = "field-name" / >
< col class = "field-body" / >
< tbody valign = "top" >
2018-12-08 14:21:00 +01:00
< tr class = "field-odd field" > < th class = "field-name" > Parameters:< / th > < td class = "field-body" > < strong > power< / strong > – power value between 0 and 100< / td >
2018-11-16 20:49:16 +01:00
< / tr >
2018-12-08 14:21:00 +01:00
< tr class = "field-even field" > < th class = "field-name" > Returns:< / th > < td class = "field-body" > None< / td >
2018-11-18 15:40:10 +01:00
< / tr >
< / tbody >
< / table >
< / dd > < / dl >
< dl class = "method" >
2018-12-08 14:21:00 +01:00
< dt id = "core.api.actor.CBPiActor.state" >
< code class = "descname" > state< / code > < span class = "sig-paren" > (< / span > < span class = "sig-paren" > )< / span > < a class = "headerlink" href = "#core.api.actor.CBPiActor.state" title = "Permalink to this definition" > ¶< / a > < / dt >
< dd > < p > Return the current actor state< / p >
2018-11-18 15:40:10 +01:00
< table class = "docutils field-list" frame = "void" rules = "none" >
< col class = "field-name" / >
< col class = "field-body" / >
< tbody valign = "top" >
2018-12-08 14:21:00 +01:00
< tr class = "field-odd field" > < th class = "field-name" > Returns:< / th > < td class = "field-body" > < / td >
2018-11-18 15:40:10 +01:00
< / tr >
< / tbody >
< / table >
2018-11-16 20:49:16 +01:00
< / dd > < / dl >
< / dd > < / dl >
2018-11-16 21:48:57 +01:00
< / 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
2018-12-08 14:21:00 +01:00
45< / pre > < / div > < / td > < td class = "code" > < div class = "highlight" > < pre > < span > < / span > < span class = "kn" > import< / span > < span class = "nn" > logging< / span >
2018-11-16 21:48:57 +01:00
2018-12-08 14:21:00 +01:00
< 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 >
2018-11-16 21:48:57 +01:00
< span class = "k" > class< / span > < span class = "nc" > CustomActor< / span > < span class = "p" > (< / span > < span class = "n" > CBPiActor< / span > < span class = "p" > ):< / span >
2018-12-08 14:21:00 +01:00
< span class = "c1" > # Custom property which can be configured by the user< / span >
< span class = "n" > gpio< / 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 >
2018-11-16 21:48:57 +01:00
< 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 >
2018-12-08 14:21:00 +01:00
< 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" > gpio< / span > < span class = "p" > )< / span >
2018-11-16 21:48:57 +01:00
2018-12-08 14:21:00 +01:00
< span class = "c1" > # Code to swtich the actor off goes here< / span >
2018-11-16 21:48:57 +01:00
2018-12-08 14:21:00 +01:00
< span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > state< / span > < span class = "o" > =< / span > < span class = "bp" > False< / span >
2018-11-16 21:48:57 +01:00
2018-12-08 14:21:00 +01:00
< 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" > gpio< / span > < span class = "p" > )< / span >
2018-11-16 21:48:57 +01:00
2018-12-08 14:21:00 +01:00
< span class = "c1" > # Code to swtich the actor on goes here< / span >
2018-11-16 21:48:57 +01:00
2018-12-08 14:21:00 +01:00
< span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > state< / span > < span class = "o" > =< / span > < span class = "bp" > True< / span >
2018-11-16 21:48:57 +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" > ' ' ' < / 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
2018-12-08 14:21:00 +01:00
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" > DummyActor< / span >
2018-11-16 21:48:57 +01:00
< 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 >
2018-11-16 20:49:16 +01:00
< / div >
< / div >
< / div >
2018-12-08 14:21:00 +01:00
< / div >
< / div >
< div class = "sphinxsidebar" role = "navigation" aria-label = "main navigation" >
< div class = "sphinxsidebarwrapper" >
< h1 class = "logo" > < a href = "index.html" > CraftBeerPi< / a > < / h1 >
2018-11-16 20:49:16 +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 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 = "#actorcontroller" > ActorController< / a > < / li >
< li class = "toctree-l2" > < a class = "reference internal" href = "#cbpiactor" > CBPiActor< / 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 >
< li class = "toctree-l1" > < a class = "reference internal" href = "step.html" > Brewing Step< / a > < / 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 >
< div class = "relations" >
< h3 > Related Topics< / h3 >
< ul >
< li > < a href = "index.html" > Documentation overview< / a > < ul >
< li > Previous: < a href = "core.html" title = "previous chapter" > Core< / a > < / li >
< li > Next: < a href = "sensor.html" title = "next chapter" > Sensor< / a > < / li >
< / ul > < / li >
< / ul >
< / div >
< 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 >
< / div >
< script type = "text/javascript" > $ ( '#searchbox' ) . show ( 0 ) ; < / script >
2018-11-16 20:49:16 +01:00
2018-12-08 14:21:00 +01:00
< / div >
< / div >
< div class = "clearer" > < / div >
< / div >
< div class = "footer" >
© 2018, Manuel Fritsch.
|
Powered by < a href = "http://sphinx-doc.org/" > Sphinx 1.8.2< / a >
& < a href = "https://github.com/bitprophet/alabaster" > Alabaster 0.7.12< / a >
|
< a href = "_sources/actor.rst.txt"
rel="nofollow">Page source< / a >
< / div >
< / body >
2018-11-16 20:49:16 +01:00
< / html >