Documentation
Example Extension
The example extension provides a set of demonstration interfaces for testing without connecting to any real hardware.
Overview
The example extension provides a set of interfaces to the core components for demonstration purposes. Example components don't connect to any real system but mimic functionality for testing.
This extension does not take an extension-level config and is focused on interfaces.
Sensor Interface
Provides a sensor that returns a random integer.
| Option | Type | Required | Description |
|---|---|---|---|
key |
String | Yes | Unique slug id for the component |
name |
String | No | Friendly display name of component. Useful for UI. |
data |
Integer | No | Returns a number between 0 and data. Default: 10 |
Config Example
mudpi.config.json
{
"sensor": [
{
"key": "example_sensor_1",
"interface": "example",
"data": 10
}
]
}
Control Interface
Provides a control that will randomly change its state based on update_chance.
| Option | Type | Required | Description |
|---|---|---|---|
key |
String | Yes | Unique slug id for the component |
name |
String | No | Friendly display name of component. Useful for UI. |
update_chance |
Integer | No | Percent chance (0-100) it should change state. Default: 25 |
type |
String | No | Type of control behavior. Options: button, control, or potentiometer. Default: button |
Config Example
mudpi.config.json
{
"control": [
{
"key": "example_control_1",
"interface": "example",
"update_chance": 10,
"type": "switch"
}
]
}
Toggle Interface
Provides a toggle that is a boolean in memory you can toggle.
| Option | Type | Required | Description |
|---|---|---|---|
key |
String | Yes | Unique slug id for the component |
name |
String | No | Friendly display name of component. Useful for UI. |
max_duration |
Integer | No | Failsafe duration (in seconds) to turn off toggle after. 0 means off. Default: 0 |
Config Example
mudpi.config.json
{
"toggle": [
{
"key": "example_toggle_1",
"interface": "example",
"max_duration": 360
}
]
}
Character Display Interface
Provides a character display that prints messages to the log.
| Option | Type | Required | Description |
|---|---|---|---|
key |
String | Yes | Unique slug id for the component |
name |
String | No | Friendly display name of component. Useful for UI. |
message_limit |
Integer | No | Max number of messages to take in queue before overwriting. Default: 20 |
max_duration |
Integer | No | Max duration allowed to display a message in seconds. Default: 60 |
default_duration |
Integer | No | Default duration fallback if one is not set for a new message. Default: 5 |
topic |
String | No | Topic display listens on for events. Default: char_display/{key} |
Config Example
mudpi.config.json
{
"char_display": [
{
"key": "example_display_1",
"interface": "example",
"max_duration": 30,
"default_duration": 10,
"topic": "char_display/example_display_1"
}
]
}