Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Getting Started with Metrum

This tutorial will guide you through the process of installing and configuring Metrum on your Reticulum network.

Step 1: Install Metrum

To install Metrum, run the following command:

uv pip install metrum

Step 2: Configure Your Reticulum Network Follow this guide on how to write your reticulum config file.

Step 3: Configure Metrum

Metrum can be configured using a TOML file. The default configuration file path is ~/.config/metrum/config.toml.

[sensor]
class = "metrum.sensors.computer.ExampleSensor"
device_id = "urn:dev:metrum:b97893bb5cb3170e5b09c653c7f759b7"
read_interval = 1                                             
collection_interval = 10
announce_interval = 20
id_filename = "id_computer_sensor" 

[influxdb]
url = "url of the influx db server"
org = "first-org"
bucket = "sensor-data"
retry_interval = 60                                          

Step 4: Define a Sensor

Create a new class that inherits from SensorInterface:

class ExampleSensor(SensorInterface):
    """Mock sensor for testing serialization"""

    def read_sensors(self):
        """Return mock sensor readings with proper SenML formatting"""
        readings = {
            "temperature": {
                "value": 25.5,
                "unit": SenmlUnits.SENML_UNIT_DEGREES_CELSIUS,
                "name": SenmlNames.KPN_SENML_TEMPERATURE,
            },
            "pressure": {
                "value": 101325,
                "unit": SenmlUnits.SENML_UNIT_PASCAL,
                "name": SenmlNames.KPN_SENML_PRESSURE,
            },
            "humidity": {
                "value": 65.0,
                "unit": SenmlUnits.SENML_UNIT_RELATIVE_HUMIDITY,
                "name": SenmlNames.KPN_SENML_HUMIDITY,
            },
        }
        return readings

Run the your custom Environmental Sensor with settings from your config:

uv run --extra computer metrum -p

Or if you have lm_sensors installed, you can run the Computer Sensor

uv run --extra computer metrum -p

Start the subscriber on any device, which is inside connected by the Reticulum network

uv run metrum -s 

Caveats

Currently, there are two bugs:

  • Announces do not show up. Workaround read log of publisher and then run uv run metrum -s --dest <dest id>
  • Loading classes is hard-coded, will be fixed ASAP. Workaround: add your class to the run_publisher function in src/metrum/cli.py