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