Controllers api

A Kervi controller is a class that acts upon input from users or events or the underlaying os.

class kervi.controllers.Controller(controller_id, name, **kwargs)

A Kervi controller is a class that acts upon input from users, hardware events or the underlaying os.

Examples for controllers are motor control, servo control, output to IO.

A controller my define one or more dynamic values as input and output.

controller_exit()

Abstract method that is called when the kervi application stops.

controller_start()

Abstract method that is called when the entire application is loaded.

static create(controller_id, name)

Turn class into a kervi controller

static input(input_id, name, value_class=<class 'kervi.values.NumberValue'>)

Add input to controller

input_changed(input_id)

Abstract method that is called by when one of the controller inputs change.

You can implement this method if your controller logic needs to respond changes in multiple inputs.

Parameters

changed_input (KerviValue) – Input that has changed. You can read the value of the changed input via the inputs value property.

Links this component to a dashboard section all input are displayed.

Parameters
  • dashboard_id – id of the dashboard to link to.

  • panel_id (str) – id of the section.

  • **kwargs – Use the kwargs below to override default values set in ui_parameters

Keyword Arguments
  • ui_size (int) – Size of the component in dashboard unit size.

    In order to make the sections and components align correct a dashboard unit is defined. Default the dashboard unit is a square that is 150 x 150 pixels. The width of the select box is ui_size * dashboard unit size.

  • type (str) – Type of select box, dropdown or list.

  • link_to_header (str) – Add this component to header of section.

  • icon (str) – Icon that should be displayed together with label.

  • flat (bool) – Flat look and feel.

static output(output_id, name, value_class=<class 'kervi.values.NumberValue'>)

Add output to controller