if __name__ == '__main__': from kervi.application import Application APP = Application() #add dashboard and panel from kervi.dashboards import Dashboard, DashboardPanel DASHBOARD = Dashboard("dashboard.app", "Test LSM9DS1.py", is_default=True) DASHBOARD.add_panel(DashboardPanel("accl", title="Acceleration")) DASHBOARD.add_panel(DashboardPanel("gyro", title="Gyro")) DASHBOARD.add_panel(DashboardPanel("magnetic", title="Magnetic")) from kervi.hal import GPIO from kervi.sensors import Sensor import kervi.devices.sensors.LSM9DS1 as LSM9DS1 SENSOR_ACCL = Sensor("accl", "Acceleration", LSM9DS1.LSM9DS1AccelerationDeviceDriver()) SENSOR_ACCL.link_to_dashboard("dashboard.app", "accl") SENSOR_GYRO = Sensor("gyro", "gyro", LSM9DS1.LSM9DS1GyroDeviceDriver()) SENSOR_GYRO.link_to_dashboard("dashboard.app", "gyro") SENSOR_MAG = Sensor("magnetic", "Magnetic", LSM9DS1.LSM9DS1MagneticDeviceDriver()) SENSOR_MAG.link_to_dashboard("dashboard.app", "magnetic") APP.run()
if __name__ == '__main__': from kervi.application import Application APP = Application({ "network": { "ip": "127.0.0.1", "ipc_root_address": "127.0.0.1", "ws_port": 9000, } }) #add dashboard and panel from kervi.dashboards import Dashboard, DashboardPanel DASHBOARD = Dashboard("dashboard", "colortest", is_default=True) DASHBOARD.add_panel(DashboardPanel("color", width=25, title="Color")) DASHBOARD.add_panel(DashboardPanel("color_inline", title="Color inline")) DASHBOARD.add_panel(DashboardPanel("log", title="Log", user_log=True)) from kervi.controllers import Controller from kervi.values import ColorValue 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.color = self.inputs.add("color", "Boolean", ColorValue) self.color.value = "#000f00" self.color.persist_value = True self.color.link_to_dashboard("dashboard", "boolean")
if __name__ == '__main__': from kervi.application import Application APP = Application() #add dashboard and panel from kervi.dashboards import Dashboard, DashboardPanel DASHBOARD = Dashboard("dashboard.ctrl", "Adafruit char lcd test", is_default=True) DASHBOARD.add_panel( DashboardPanel("input", columns=2, rows=4, title="input")) DASHBOARD.add_panel( DashboardPanel("log", columns=3, rows=4, title="Log", user_log=True)) #define a light controller from kervi.hal import GPIO from kervi.controllers import Controller from kervi.values import * from kervi.devices.displays.HD44780_i2c_PCF8574 import CharLCDDeviceDriver class TestController(Controller): def __init__(self): Controller.__init__(self, "controller.test", "test") self.type = "test" self.lcd = CharLCDDeviceDriver() self.lcd.enable_display(True) self.lcd.message("test") self.lcd.set_backlight(True) self.inputs.add("text", "LCD text", StringValue)
if __name__ == '__main__': from kervi.application import Application APP = Application({ "network": { "ip": "127.0.0.1", "ipc_root_address": "127.0.0.1", "ws_port": 9000, } }) #add dashboard and panel from kervi.dashboards import Dashboard, DashboardPanel DASHBOARD = Dashboard("dahsboard.ctrl", "Controller test", is_default=True) DASHBOARD.add_panel( DashboardPanel("textinput", title="date time value", width="50%")) DASHBOARD.add_panel(DashboardPanel("text_inline", title="inline")) DASHBOARD.add_panel(DashboardPanel("log", title="Log", user_log=True)) #define a light controller from kervi.hal import GPIO from kervi.controllers import Controller from kervi.values import DateTimeValue 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.input1 = self.inputs.add("d1", "DateTime 1", DateTimeValue)
"ip": "127.0.0.1", "ipc_root_address": "127.0.0.1", "ws_port": 9000, }, "location": { # greenwich "longitude": 61.563300, "latitude": -6.838634, "time_zone": 0 }, }) #add dashboard and panel from kervi.dashboards import Dashboard, DashboardPanel DASHBOARD = Dashboard("system", "Sensor test", is_default=True) DASHBOARD.add_panel(DashboardPanel("multi_sensor", title="Multi sensor")) DASHBOARD.add_panel( DashboardPanel("multi_sensor_single", title="Multi sensor single")) DASHBOARD.add_panel( DashboardPanel("color_sensor", title="Color sensor single ----xxx---")) DASHBOARD.add_panel(DashboardPanel("sun_sensor", title="Sun sensor")) DASHBOARD.add_panel(DashboardPanel("gauge", title="Gauge")) DASHBOARD.add_panel(DashboardPanel("log", title="Log", user_log=True)) from kervi.sensors import Sensor from kervi.devices.sensors.system import CPULoadSensorDeviceDriver from kervi.devices.sensors.dummy_sensor import DummyMultiDimSensorDeviceDriver cpu_sensor = Sensor("CPULoadSensor", "CPU", CPULoadSensorDeviceDriver()) cpu_sensor.store_to_db = False cpu_sensor.link_to_dashboard("*", "header_right", show_sparkline=True)
if __name__ == '__main__': from kervi.application import Application APP = Application({ "network": { "ip": "127.0.0.1", "ipc_root_address": "127.0.0.1", "ws_port": 9000, } }) #add dashboard and panel from kervi.dashboards import Dashboard, DashboardPanel DASHBOARD = Dashboard("dashboard", "Dynamic number test", is_default=True) DASHBOARD.add_panel(DashboardPanel("number", width=33, title="Number")) DASHBOARD.add_panel(DashboardPanel("number_inline", title="number inline")) DASHBOARD.add_panel(DashboardPanel("number_gauge", width=20)) DASHBOARD.add_panel(DashboardPanel("number_chart")) DASHBOARD.add_panel(DashboardPanel("number_chart_x", width=100)) DASHBOARD.add_panel(DashboardPanel("log", title="Log", user_log=True)) from kervi.sensors import Sensor from kervi.devices.sensors.system import CPULoadSensorDeviceDriver cpu_sensor = Sensor("CPULoadSensor", "CPU", CPULoadSensorDeviceDriver()) cpu_sensor.link_to_dashboard("dashboard", "number_chart", type="chart") cpu_sensor.link_to_dashboard("dashboard", "number_chart", link_to_header=True) cpu_sensor.link_to_dashboard("*", "header_right", show_sparkline=True) cpu_sensor.link_to_dashboard(
""" bootstrap your kervi dashboards here """ from kervi.dashboards import Dashboard, DashboardPanel #Create the dashboards for your Kervi application here. #Standard dashboard with several panels where sensors are placed. #Each sensor create links to one or more dashboard panels APP_DASHBOARD = Dashboard("app", "Main dahsboard", is_default=True) APP_DASHBOARD.add_panel(DashboardPanel("steering", title="Steering")) APP_DASHBOARD.add_panel(DashboardPanel("balance_pid", title="Balance PID ")) APP_DASHBOARD.add_panel(DashboardPanel("sensors", title="Sensors")) SYSTEM_DASHBOARD = Dashboard("system", "System") SYSTEM_DASHBOARD.add_panel(DashboardPanel("cpu")) SYSTEM_DASHBOARD.add_panel(DashboardPanel("memory")) SYSTEM_DASHBOARD.add_panel(DashboardPanel("disk")) SYSTEM_DASHBOARD.add_panel(DashboardPanel("power", title="Power")) SYSTEM_DASHBOARD.add_panel(DashboardPanel("log", title="Log", user_log=True))
if __name__ == '__main__': from kervi.application import Application APP = Application( { # "network":{ # "ip": "127.0.0.1", # "ipc_root_address": "127.0.0.1" # } } ) #add dashboard and panel from kervi.dashboards import Dashboard, DashboardPanel DASHBOARD = Dashboard("dashboard.app", "app dashboard", is_default=True) DASHBOARD.add_panel(DashboardPanel("cpu", columns=2, rows=4, title=None)) from kervi.sensors import Sensor from kervi.devices.sensors.system import CPULoadSensorDeviceDriver SENSOR_1 = Sensor("CPULoadSensor", "CPU", CPULoadSensorDeviceDriver()) #link to sys area top right SENSOR_1.link_to_dashboard("*", "sys-header") #link to a panel, show value in panel header and chart in panel body SENSOR_1.link_to_dashboard("dashboard.app", "cpu", type="value", size=2, link_to_header=True) SENSOR_1.link_to_dashboard("dashboard.app", "cpu", type="chart", size=2) APP.actions.shutdown.link_to_dashboard("*", "header_right", inline=True, label=None, button_text="App shutdown") APP.run()
if __name__ == '__main__': from kervi.application import Application APP = Application() #add dashboard and panel from kervi.dashboards import Dashboard, DashboardPanel DASHBOARD = Dashboard("main", "Controller Buttons", is_default=True) DASHBOARD.add_panel(DashboardPanel("gpio", columns=3, rows=3, title="GPIO")) from kervi.hal import GPIO GPIO["GPIO1"].define_as_input() GPIO["GPIO2"].define_as_output() GPIO["GPIO3"].define_as_pwm(60, 0) GPIO["GPIO1"].link_to_dashboard("main", "gpio") GPIO["GPIO2"].link_to_dashboard("main", "gpio") GPIO["GPIO3"].pwm["duty_cycle"].link_to_dashboard("main", "gpio") APP.run()
if __name__ == '__main__': from kervi.application import Application APP = Application() #add dashboard and panel from kervi.dashboards import Dashboard, DashboardPanel DASHBOARD = Dashboard("dashboard", "GPIO", is_default=True) DASHBOARD.add_panel( DashboardPanel("gpio", columns=2, rows=4, title="GPIO Width 0")) DASHBOARD.add_panel( DashboardPanel("gpio_inline", columns=3, rows=4, title="button inline")) from kervi.hal import GPIO GPIO["GPIO1"].define_as_output() GPIO["GPIO1"].link_to_dashboard("dashboard", "gpio") GPIO["GPIO1"].pwm["duty_cycle"].link_to_dashboard("dashboard", "gpio") GPIO["GPIO1"].pwm["active"].link_to_dashboard("dashboard", "gpio") GPIO["DAC1"].link_to_dashboard("dashboard", "gpio") APP.run()
if __name__ == '__main__': from kervi.application import Application APP = Application({ "network":{ "ip": "127.0.0.1", "ipc_root_address": "127.0.0.1", "ws_port": 9000, } }) #add dashboard and panel from kervi.dashboards import Dashboard, DashboardPanel DASHBOARD = Dashboard("dashboard", "Dynamic boolean test", is_default=True) DASHBOARD.add_panel(DashboardPanel("boolean", title="Boolean")) DASHBOARD.add_panel(DashboardPanel("boolean_inline", title="boolean inline")) DASHBOARD.add_panel(DashboardPanel("log", title="Log", user_log=True)) from kervi.hal import GPIO from kervi.controllers import Controller from kervi.values import BooleanValue 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.inputs.add("boolean", "Boolean", BooleanValue) self.inputs["boolean"].link_to_dashboard("dashboard", "boolean") self.inputs["boolean"].link_to_dashboard("dashboard", "boolean", label="1", label_icon="bulb", on_text="active", off_text="inactive")
if __name__ == '__main__': from kervi.application import Application APP = Application() #Important GPIO must be imported after application creation from kervi.hal import GPIO from kervi.dashboards import Dashboard, DashboardPanel DASHBOARD = Dashboard("app", "App", is_default=True) DASHBOARD.add_panel( DashboardPanel("fan", columns=3, rows=2, title="CPU fan")) SYSTEMBOARD = Dashboard("system", "System") SYSTEMBOARD.add_panel(DashboardPanel("cpu", columns=2, rows=2)) SYSTEMBOARD.add_panel(DashboardPanel("cam", columns=2, rows=2)) #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") CAMERA.pan.link_to_dashboard("system", "cpu") CAMERA.tilt.link_to_dashboard("system", "cpu") 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())
"id":"module.id", "name":"Module name" }, "log":{ "file":"kervi-module.log" }, "network" : { "ipc_root_port": 9500, "ipc_root_address": "192.168.0.137" } }) from kervi.dashboards import Dashboard, DashboardPanel DASHBOARD = Dashboard("dashboard.module", "module dashboard", is_default=True) DASHBOARD.add_panel(DashboardPanel("panel", columns=2, rows=2, title="Panel dashboard")) from kervi.sensors import Sensor from kervi.devices.sensors.system import MemoryUseSensorDeviceDriver SENSOR_1 = Sensor("MemLoadSensor", "MEM", MemoryUseSensorDeviceDriver()) #link to sys area top right SENSOR_1.link_to_dashboard("*", "sys-header") #link to a panel, show value in panel header and chart in panel body SENSOR_1.link_to_dashboard("dashboard.module", "panel", type="value", size=2, link_to_header=True) SENSOR_1.link_to_dashboard("dashboard.module", "panel", type="chart", size=2) APP_MODULE.actions.shutdown.link_to_dashboard("*", "header_right", inline=True, label=None, button_text="Module shutdown") from kervi.streams import stream_observer from kervi.streams import stream_images, stream_observer