Exemplo n.º 1
0
        [DashboardPanel("cpu"), DashboardPanel("cam")])

    #Create a streaming camera server
    from kervi.vision.camera import CameraStreamer
    CAMERA = CameraStreamer("cam1", "camera 1")
    #link camera as background
    CAMERA.link_to_dashboard("app")
    #link camera to a panel
    CAMERA.link_to_dashboard("system", "cam")

    from kervi.sensors import Sensor
    from kervi.devices.sensors.system import CPULoadSensorDeviceDriver
    from kervi.devices.sensors.system import CPUTempSensorDeviceDriver
    #build in sensor that measures cpu use
    SENSOR_CPU_LOAD = Sensor("CPULoadSensor", "CPU",
                             CPULoadSensorDeviceDriver())
    #link to sys area top right
    SENSOR_CPU_LOAD.link_to_dashboard("*", "sys-header")
    #link to a panel, show value in panel header and chart in panel body
    SENSOR_CPU_LOAD.link_to_dashboard("system",
                                      "cpu",
                                      type="value",
                                      link_to_header=True)
    SENSOR_CPU_LOAD.link_to_dashboard("system", "cpu", type="chart")

    #build in sensor that measures cpu temperature
    SENSOR_CPU_TEMP = Sensor("CPUTempSensor", "", CPUTempSensorDeviceDriver())
    #link to sys area top right
    SENSOR_CPU_TEMP.link_to_dashboard("*", "sys-header")

    #More on sensors https://kervi.github.io/sensors.html
Exemplo n.º 2
0
    Dashboard(
        "system",
        "System",
        [
            DashboardPanel("cpu-load"),
            DashboardPanel("cpu-temp")
        ]
    )
    
    from kervi.sensors import Sensor
    from kervi.devices.sensors.system import CPULoadSensorDeviceDriver
    from kervi.devices.sensors.system import CPUTempSensorDeviceDriver
    from kervi.devices.sensors.dummy_sensor import DummySensorDeviceDriver
    
    #build in sensor that measures cpu use
    SENSOR_CPU_LOAD = Sensor("CPULoadSensor", "CPU", CPULoadSensorDeviceDriver())
    
    #link to sys area top right
    SENSOR_CPU_LOAD.link_to_dashboard("*", "header_right")
    
    #link to a panel, show value in panel header and chart in panel body
    SENSOR_CPU_LOAD.link_to_dashboard("system", "cpu-load", type="value", link_to_header=True)
    SENSOR_CPU_LOAD.link_to_dashboard("system", "cpu-load", type="chart")

    #build in sensor that measures cpu temperature
    SENSOR_CPU_TEMP = Sensor("CPUTempSensor", "", DummySensorDeviceDriver())
    SENSOR_CPU_TEMP.link_to_dashboard("system", "cpu-temp", type="value", link_to_header=True)
    SENSOR_CPU_TEMP.link_to_dashboard("system", "cpu-temp", type="chart")
    
    from kervi.controllers import Controller, NumberValue
    from kervi.actions import action
Exemplo n.º 3
0
#Define dashboards and panels
Dashboard("layout",
          "Layout", [
              DashboardPanel("fan", title="CPU fan", width=50),
              DashboardPanel("p1", title="Panel 2", width=25),
              DashboardPanel("p2", title="Panel 3", width=25)
          ],
          is_default=False)

#create sensor
from kervi.sensors import Sensor
from kervi.devices.sensors.system import CPULoadSensorDeviceDriver
from kervi.devices.sensors.system import CPUTempSensorDeviceDriver
from kervi.devices.sensors.dummy_sensor import DummySensorDeviceDriver
#create a senors that uses CPU load device driver
cpu_load_sensor = Sensor("CPULoadSensor", "CPU", CPULoadSensorDeviceDriver())

#link to dashboard
cpu_load_sensor.link_to_dashboard("*", "header_right", show_sparkline=True)
cpu_load_sensor.link_to_dashboard("layout",
                                  "p1",
                                  type="value",
                                  show_sparkline=True,
                                  link_to_header=True)
cpu_load_sensor.link_to_dashboard("layout", "p1", type="chart")
cpu_load_sensor.link_to_dashboard("layout", "p2", type="chart")
#create a senors that uses CPU temp device driver
cpu_temp_sensor = Sensor("CPUTempSensor", "CPU temp",
                         DummySensorDeviceDriver())

#link to dashboard
Exemplo n.º 4
0
# Copyright (c) 2016, Tim Wentzlau
# Licensed under MIT
""" Module that defines core cpu sensors """

from kervi.sensors import Sensor
from kervi.devices.sensors.system import CPULoadSensorDeviceDriver
from kervi.devices.sensors.system import MemoryUseSensorDeviceDriver
from kervi.devices.sensors.system import DiskUseSensorDeviceDriver
from kervi.devices.sensors.system import CPUTempSensorDeviceDriver

CPU_SENSOR = Sensor("CPULoadSensor", "CPU", CPULoadSensorDeviceDriver())
CPU_SENSOR.store_to_db = False
CPU_SENSOR.link_to_dashboard("*", "header_right")
CPU_SENSOR.link_to_dashboard("system",
                             "cpu",
                             type="value",
                             size=2,
                             link_to_header=True)
CPU_SENSOR.link_to_dashboard("app", "sensors", type="value")
CPU_SENSOR.link_to_dashboard("system", "cpu", type="chart", size=2)
CPU_SENSOR.user_groups = ["admin"]

MEM_SENSOR = Sensor("MemLoadSensor", "Memory", MemoryUseSensorDeviceDriver())
MEM_SENSOR.store_to_db = False
MEM_SENSOR.link_to_dashboard("*", "header_right")
MEM_SENSOR.link_to_dashboard("system",
                             "memory",
                             type="value",
                             size=2,
                             link_to_header=True)
MEM_SENSOR.link_to_dashboard("system", "memory", type="chart", size=2)
Exemplo n.º 5
0
        },
        "plugins":{
             "kervi.plugin.routing.kervi_io": True#{
            #     "enabled": True,
            #     "api_user": "******",
            #     "api_password": "******",
            #     "api_channel": "20bddf88a4434e99ba0e014de2b875c7"
            # }
        }
    })

    
    from kervi.sensors import Sensor
    from kervi.devices.sensors.system import CPULoadSensorDeviceDriver

    SENSOR_1 = Sensor("module_CPULoadSensor", "CPU", CPULoadSensorDeviceDriver())
    SENSOR_1.link_to_dashboard(type="value", link_to_header=True)
    SENSOR_1.link_to_dashboard(type="chart")

    from kervi.controllers import Controller
    from kervi.values import NumberValue
    from kervi.messaging import Messaging

    class TestController(Controller):
        def __init__(self):
            Controller.__init__(self, "controller.test", "test")
            self.type = "test"

            #define an input and link it to the dashboard panel
            self.test_number = self.inputs.add("test_number", "Number", NumberValue)
            self.test_number.unit = "%"