diff --git a/.idea/workspace.xml b/.idea/workspace.xml index baa4fef..c20bffd 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,7 +2,7 @@ - + - + - - + + @@ -167,12 +167,12 @@ - + - + @@ -287,6 +287,7 @@ @@ -342,6 +343,24 @@ \ No newline at end of file diff --git a/docs/.nojekyll b/.nojekyll similarity index 100% rename from docs/.nojekyll rename to .nojekyll diff --git a/docs/_images/picture.jpeg b/docs/_images/picture.jpeg new file mode 100644 index 0000000..36eb6a1 Binary files /dev/null and b/docs/_images/picture.jpeg differ diff --git a/docs/_sources/actor.rst.txt b/docs/_sources/actor.rst.txt index 0fed2e7..238c446 100644 --- a/docs/_sources/actor.rst.txt +++ b/docs/_sources/actor.rst.txt @@ -1,11 +1,31 @@ -Actor API +Actor ========= -Test -^^^^ +Architecture +^^^^^^^^^^^^ -HELLO WORLD +.. image:: picture.jpeg + :scale: 50% + +ActorController +^^^^^^^^^^^^^^^ .. automodule:: core.controller.actor_controller - :members: \ No newline at end of file + :members: + +Custom Actor +^^^^^^^^^^^^^ + +.. literalinclude:: ../../core/extension/dummy/__init__.py + :caption: __init__.py + :name: __init__-py + :language: python + :linenos: + + +config.yaml + +.. literalinclude:: ../../core/extension/dummy/config.yaml + :language: yaml + :linenos: \ No newline at end of file diff --git a/docs/_sources/index.rst.txt b/docs/_sources/index.rst.txt index 21379e9..ee94958 100644 --- a/docs/_sources/index.rst.txt +++ b/docs/_sources/index.rst.txt @@ -6,27 +6,6 @@ Welcome to CraftBeerPi's documentation! ======================================= -Documentation -^^^^^^^^^^^^^ - -.. automodule:: core.craftbeerpi - :members: - -.. automodule:: core.controller.notification_controller - :members: - -Example Component -^^^^^^^^^^^^^^^^^ - -.. literalinclude:: ../../core/extension/comp/__init__.py - :language: python - - -Config YAML -^^^^^^^^^^^ - -.. literalinclude:: ../../core/extension/comp/config.yaml - :language: yaml .. toctree:: :maxdepth: 1 diff --git a/docs/_sources/sensor.rst.txt b/docs/_sources/sensor.rst.txt index 8b0a365..b078b8f 100644 --- a/docs/_sources/sensor.rst.txt +++ b/docs/_sources/sensor.rst.txt @@ -1,2 +1,16 @@ -Sensor API -========== \ No newline at end of file +Sensor +========== + +Architecture +^^^^ + + + +SensorController +^^^^^^^^^^^^^^^^ + +.. automodule:: core.controller.sensor_controller + :members: + +Custom Sensor +^^^^^^^^^^^^^ \ No newline at end of file diff --git a/docs/actor.html b/docs/actor.html index 3d578b9..6305e22 100644 --- a/docs/actor.html +++ b/docs/actor.html @@ -6,7 +6,7 @@ - Actor API — CraftBeerPi 4.0 documentation + Actor — CraftBeerPi 4.0 documentation @@ -16,7 +16,7 @@ - + @@ -34,12 +34,15 @@
-
-

Actor API

-
-

Test

-

HELLO WORLD

-
+
+

Actor

+
+

Architecture

+_images/picture.jpeg +
+
+

ActorController

+
class core.controller.actor_controller.ActorController(cbpi)

The main actor controller

@@ -85,6 +88,137 @@
+
+
+

Custom Actor

+
+
__init__.py
+
 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
import logging
+
+from core.api import CBPiActor, Property, action, background_task
+
+
+
+class CustomActor(CBPiActor):
+
+    name = Property.Number(label="Test")
+    name1 = Property.Text(label="Test")
+    name2 = Property.Kettle(label="Test")
+
+    @background_task("s1", interval=2)
+    async def bg_job(self):
+        print("WOOH BG")
+
+    @action(key="name", parameters={})
+    def myAction(self):
+        pass
+
+    def state(self):
+        super().state()
+
+    def off(self):
+        print("OFF")
+        self.state = False
+
+    def on(self, power=100):
+
+        print("ON")
+        self.state = True
+
+
+    def __init__(self, cbpi=None):
+
+        if cbpi is None:
+            return
+
+        print("INIT MY ACTOR111111")
+        self.cfg = self.load_config()
+
+        self.logger = logging.getLogger(__file__)
+        logging.basicConfig(level=logging.INFO)
+
+        self.logger.info("########WOOHOO MY ACTOR")
+        self.cbpi = cbpi
+
+
+def setup(cbpi):
+
+    '''
+    This method is called by the server during startup 
+    Here you need to register your plugins at the server
+    
+    :param cbpi: the cbpi core 
+    :return: 
+    '''
+
+    cbpi.plugin.register("CustomActor", CustomActor)
+
+
+
+

config.yaml

+
1
+2
name: Manuel
+version: 4
+
+
@@ -106,8 +240,8 @@

Navigation

@@ -116,7 +250,7 @@
diff --git a/docs/genindex.html b/docs/genindex.html index f787499..fc62cfc 100644 --- a/docs/genindex.html +++ b/docs/genindex.html @@ -40,10 +40,8 @@ A | C | I - | N | O | R - | S

A

@@ -58,14 +56,10 @@
@@ -78,18 +72,6 @@ -

N

- - - -
-

O

- - -
    @@ -102,24 +84,6 @@ - -
    - -

    S

    - -
    @@ -143,8 +107,8 @@

    Navigation

    diff --git a/docs/index.html b/docs/index.html index 3a27426..c102bc5 100644 --- a/docs/index.html +++ b/docs/index.html @@ -16,7 +16,7 @@ - + @@ -35,163 +35,13 @@

    Welcome to CraftBeerPi’s documentation!

    -
    -

    Documentation

    -
    -
    -class core.craftbeerpi.CraftBeerPi
    -

    This is a Hello class docstring

    -
    -
    -notify(key, message, type='info')
    -

    This is a convinience method to send notification to the client

    - --- - - - - - -
    Parameters:
      -
    • key – notification key
    • -
    • message – notification message
    • -
    • type – notification type (info,warning,danger,successs)
    • -
    -
    Returns:

    -
    -
    - -
    -
    -register(obj, url_prefix=None)
    -

    This method parses the provided object

    - --- - - - - - -
    Parameters:
      -
    • obj – the object wich will be parsed for registration
    • -
    • url_prefix – that prefix for HTTP Endpoints
    • -
    -
    Returns:

    None

    -
    -
    - -
    -
    -register_background_task(obj)
    -

    This method parses all method for the @background_task decorator and registers the background job -which will be launched during start up of the server

    - --- - - - - - -
    Parameters:obj – the object to parse
    Returns:
    -
    - -
    -
    -register_http_endpoints(obj, url_prefix=None)
    -

    This method parses the provided object for @request_mapping decorator

    - --- - - - - - -
    Parameters:
      -
    • obj – the object which will be analyzed
    • -
    • url_prefix – the prefix which will be used for the all http endpoints of the object
    • -
    -
    Returns:

    -
    -
    - -
    -
    -setup()
    -

    This method will start the server

    - --- - - - -
    Returns:
    -
    - -
    - -
    -
    -class core.controller.notification_controller.NotificationController(cbpi)
    -

    This the notification controller

    -
    - -
    -
    -

    Example Component

    -
    from core.api.decorator import on_event
    -from core.api.extension import CBPiExtension
    -
    -class MyComp(CBPiExtension):
    -
    -    def __init__(self, cbpi):
    -        '''
    -        Initializer
    -        
    -        :param cbpi: 
    -        '''
    -        self.cbpi = cbpi
    -        # register for bus events
    -        self.cbpi.register_events(self)
    -
    -    @on_event(topic="actor/#")
    -    def listen(self, **kwargs):
    -        print("Test", kwargs)
    -
    -def setup(cbpi):
    -    '''
    -    Setup method is invoked during startup
    -    
    -    :param cbpi: the cbpi core object
    -    :return: 
    -    '''
    -    # regsiter the component to the core
    -    cbpi.plugin.register("MyComp", MyComp)
    -
    -
    -
    -
    -

    Config YAML

    -
    name: Manuel
    -version: 4
    -
    -
    -
    @@ -212,8 +62,8 @@ which will be launched during start up of the server

    Navigation

    @@ -221,7 +71,7 @@ which will be launched during start up of the server

    Related Topics

    diff --git a/docs/objects.inv b/docs/objects.inv index 5faf36e..ba3e795 100644 Binary files a/docs/objects.inv and b/docs/objects.inv differ diff --git a/docs/py-modindex.html b/docs/py-modindex.html index 0156df7..119a099 100644 --- a/docs/py-modindex.html +++ b/docs/py-modindex.html @@ -60,12 +60,7 @@
    - core.controller.notification_controller -
    - core.craftbeerpi + core.controller.sensor_controller
@@ -87,8 +82,8 @@

Navigation

diff --git a/docs/search.html b/docs/search.html index da9e3b6..c268af4 100644 --- a/docs/search.html +++ b/docs/search.html @@ -82,8 +82,8 @@

Navigation

diff --git a/docs/searchindex.js b/docs/searchindex.js index 474b9c9..0974c32 100644 --- a/docs/searchindex.js +++ b/docs/searchindex.js @@ -1 +1 @@ -Search.setIndex({docnames:["actor","index","sensor","step"],envversion:{"sphinx.domains.c":1,"sphinx.domains.changeset":1,"sphinx.domains.cpp":1,"sphinx.domains.javascript":1,"sphinx.domains.math":1,"sphinx.domains.python":1,"sphinx.domains.rst":1,"sphinx.domains.std":1,sphinx:55},filenames:["actor.rst","index.rst","sensor.rst","step.rst"],objects:{"core.controller":{actor_controller:[0,0,0,"-"],notification_controller:[1,0,0,"-"]},"core.controller.actor_controller":{ActorController:[0,1,1,""]},"core.controller.actor_controller.ActorController":{init:[0,2,1,""],off:[0,2,1,""],register:[0,2,1,""]},"core.controller.notification_controller":{NotificationController:[1,1,1,""]},"core.craftbeerpi":{CraftBeerPi:[1,1,1,""]},"core.craftbeerpi.CraftBeerPi":{notify:[1,2,1,""],register:[1,2,1,""],register_background_task:[1,2,1,""],register_http_endpoints:[1,2,1,""],setup:[1,2,1,""]},core:{craftbeerpi:[1,0,0,"-"]}},objnames:{"0":["py","module","Python module"],"1":["py","class","Python class"],"2":["py","method","Python method"]},objtypes:{"0":"py:module","1":"py:class","2":"py:method"},terms:{"class":[0,1],"import":1,"new":0,"return":[0,1],The:0,__init__:1,actor:1,actor_control:0,actorcontrol:0,all:[0,1],analyz:1,api:1,background:1,background_task:1,bus:1,cbpi:[0,1],cbpiextens:1,clazz:0,client:1,control:[0,1],convini:1,core:[0,1],creat:0,danger:1,decor:1,def:1,docstr:1,dure:[0,1],endpoint:1,event:1,extens:1,from:1,hello:[0,1],http:1,info:1,init:0,initi:[0,1],instanc:0,invok:1,job:1,kei:1,kwarg:[0,1],launch:1,listen:1,main:0,manuel:1,messag:1,method:[0,1],mycomp:1,name:[0,1],none:[0,1],notif:1,notifi:1,notification_control:1,notificationcontrol:1,obj:1,object:1,off:0,on_ev:1,param:[0,1],paramet:[0,1],pars:1,plugin:1,prefix:1,print:1,provid:1,regist:[0,1],register_background_task:1,register_ev:1,register_http_endpoint:1,registr:1,regsit:1,request_map:1,self:1,send:1,sensor:1,server:1,setup:1,start:1,startup:[0,1],step:1,successs:1,test:1,thi:[0,1],topic:1,type:[0,1],url_prefix:1,used:1,version:1,warn:1,which:1,wich:1,world:0},titles:["Actor API","Welcome to CraftBeerPi\u2019s documentation!","Sensor API","Step API"],titleterms:{actor:0,api:[0,2,3],compon:1,config:1,craftbeerpi:1,document:1,exampl:1,sensor:2,step:3,test:0,welcom:1,yaml:1}}) \ No newline at end of file +Search.setIndex({docnames:["actor","index","sensor","step"],envversion:{"sphinx.domains.c":1,"sphinx.domains.changeset":1,"sphinx.domains.cpp":1,"sphinx.domains.javascript":1,"sphinx.domains.math":1,"sphinx.domains.python":1,"sphinx.domains.rst":1,"sphinx.domains.std":1,sphinx:55},filenames:["actor.rst","index.rst","sensor.rst","step.rst"],objects:{"core.controller":{actor_controller:[0,0,0,"-"],sensor_controller:[2,0,0,"-"]},"core.controller.actor_controller":{ActorController:[0,1,1,""]},"core.controller.actor_controller.ActorController":{init:[0,2,1,""],off:[0,2,1,""],register:[0,2,1,""]}},objnames:{"0":["py","module","Python module"],"1":["py","class","Python class"],"2":["py","method","Python method"]},objtypes:{"0":"py:module","1":"py:class","2":"py:method"},terms:{"class":0,"import":0,"new":0,"return":0,"super":0,"true":0,The:0,__file__:0,__init__:0,action:0,actor111111:0,actor:1,actor_control:0,all:0,api:[0,1],async:0,background_task:0,basicconfig:0,bg_job:0,call:0,cbpi:0,cbpiactor:0,cfg:0,clazz:0,config:0,control:0,core:0,creat:0,customactor:0,def:0,dure:0,fals:0,from:0,getlogg:0,here:0,info:0,init:0,initi:0,instanc:0,interv:0,kei:0,kettl:0,kwarg:0,label:0,level:0,load_config:0,log:0,logger:0,main:0,manuel:0,method:0,myaction:0,name1:0,name2:0,name:0,need:0,none:0,number:0,off:0,param:0,paramet:0,pass:0,plugin:0,power:0,print:0,properti:0,regist:0,self:0,sensor:1,server:0,setup:0,startup:0,state:0,step:1,test:0,text:0,thi:0,type:0,version:0,wooh:0,woohoo:0,yaml:0,you:0,your:0},titles:["Actor","Welcome to CraftBeerPi\u2019s documentation!","Sensor","Step API"],titleterms:{actor:0,actorcontrol:0,api:3,architectur:[0,2],craftbeerpi:1,custom:[0,2],document:1,sensor:2,sensorcontrol:2,step:3,welcom:1}}) \ No newline at end of file diff --git a/docs/sensor.html b/docs/sensor.html index 1adeb17..a3a5e79 100644 --- a/docs/sensor.html +++ b/docs/sensor.html @@ -6,7 +6,7 @@ - Sensor API — CraftBeerPi 4.0 documentation + Sensor — CraftBeerPi 4.0 documentation @@ -17,7 +17,7 @@ - + @@ -34,8 +34,17 @@
-
-

Sensor API

+
+

Sensor

+
+

Architecture

+
+
+

SensorController

+
+
+

Custom Sensor

+
@@ -56,8 +65,8 @@

Navigation

@@ -65,7 +74,7 @@

Related Topics

diff --git a/docs/step.html b/docs/step.html index 344e183..ef4578c 100644 --- a/docs/step.html +++ b/docs/step.html @@ -16,7 +16,7 @@ - + @@ -55,8 +55,8 @@

Navigation

@@ -64,7 +64,7 @@

Related Topics

diff --git a/docs_src/source/index.rst b/docs_src/source/index.rst index 21379e9..ee94958 100644 --- a/docs_src/source/index.rst +++ b/docs_src/source/index.rst @@ -6,27 +6,6 @@ Welcome to CraftBeerPi's documentation! ======================================= -Documentation -^^^^^^^^^^^^^ - -.. automodule:: core.craftbeerpi - :members: - -.. automodule:: core.controller.notification_controller - :members: - -Example Component -^^^^^^^^^^^^^^^^^ - -.. literalinclude:: ../../core/extension/comp/__init__.py - :language: python - - -Config YAML -^^^^^^^^^^^ - -.. literalinclude:: ../../core/extension/comp/config.yaml - :language: yaml .. toctree:: :maxdepth: 1