Skip to content

Instantly share code, notes, and snippets.

View reubenmiller's full-sized avatar

Reuben Miller reubenmiller

  • Hamburg, Germany
View GitHub Profile
@reubenmiller
reubenmiller / tedge-workflow-punchlist.md
Last active November 27, 2023 16:33
WIP: thin-edge.io workflow punchlist (firmware update)

1. restart state file is not being deleted (after image has been restarted)

After a successfully completed firmware workflow, if the tedge-agent service is restarted, then tedge-agent will reprocess the restart-current-operation file again as the file is not deleted after the workflow has been completed.

file: /data/tedge/.agent/restart-current-operation

// cat /data/tedge/.agent/restart-current-operation
{"target":"device/main//","cmd_id":"c8y-mapper-2023-11-26T12:26:39.248420821Z","payload":{"status":"executing","context":{"command":{"topic":{"name":"te/device/main///cmd/firmware_update/c8y-mapper-2023-11-26T12:26:39.248420821Z"},"status":"rollback_restart","payload":{"name":"core-image-tedge-mender-raspberrypi4-64","reason":"Nothing to commit. Either the boot loader triggered the rollback, the device was rebooted after switching to new partition, or someone did a manual rollback!","remoteUrl":"https://t2873877.latest.stage.c8y.io/inventory/binaries/4785008","status":"rollback_restart","
@reubenmiller
reubenmiller / c8y-onboarding-devices-manually.md
Created November 17, 2023 23:31
Onboarding thin-edge.io device's to Cumulocity IoT without automatic registration enabled

Onboarding thin-edge.io to Cumulocity IoT without auto registration enabled

Part 1: Create and upload the device certificate without auto registration

  1. On the device, create the device certificate

    tedge cert create --device-id mytestdevice001
@reubenmiller
reubenmiller / copy_managed_objects.md
Created November 15, 2023 08:54
go-c8y-cli: copy managed objects across tenants

Copy managed objects across tenants

Long Version

  1. Activate a session to the source tenant

    set-session
    
@reubenmiller
reubenmiller / c8y-custom-operation-handler.md
Created November 11, 2023 19:49
thin-edge.io - custom operation handler guide

Before creating a custom operation handler, create the configuration and confirm that the operation will be delivered to the device. Once you have confirm this, then you can add your custom handler.

Part 1: Send operations from Cumulocity IoT to thin-edge.io

Below shows the steps to create a custom SmartREST collection for Cumulocity IoT, and how to check that the message arrives on the local thin-edge.io MQTT broker.

  1. Create a SmartREST template collection in Cumulocity IoT, and create a custom "response"

    Below is an example collection which create two custom operations for the message ids:

@reubenmiller
reubenmiller / debug-qos-issue.sh
Last active November 5, 2023 18:31
thin-edge.io script to debug an issue with the tedge-mapper-c8y and jwt request
#!/bin/bash
########################################################################################################################
# Debug script to check the behaviour of the tedge-mapper-c8y/mosquitto and the responsiveness of the
# Cumulocity IoT token request/response topics (c8y/s/uat and c8y/s/dat).
#
# The script does the following:
# 1. Install a systemd service (and enables it)
# 2. Create mqtt subscriber to c8y/s/dat
# 3. Publish a mqtt message to c8y/s/uat
# 4. Wait for a message on the c8y/s/dat topic (give up after a few seconds)
@reubenmiller
reubenmiller / thin-edge.io-custom-topic-schema.md
Created November 3, 2023 14:47
thin-edge.io custom topic schema example

Using custom topic schema with thin-edge.io (>= 0.13.0)

This is a short informal overview of how to use thin-edge.io and a custom topic schema to model different IoT use-cases.

This documentation is provided to help people understand thin-edge.io and to provide some early feedback before adding it to the official docs.

Building management system

This example explores the building management system use-case where thin-edge.io provides the communication from the cloud to a local piece of software which translates the thin-edge.io MQTT API to the required building management system API calls.

@reubenmiller
reubenmiller / simulate.py
Last active October 9, 2023 01:36
thin-edge.io benchmarking script
"""thin-edge.io data simulator"""
import argparse
import time
import random
import json
from multiprocessing import Pool
import datetime
import logging
import paho.mqtt.client as mqtt
@reubenmiller
reubenmiller / debug.sh
Last active May 22, 2025 12:31
thin-edge.io debug info
#!/bin/sh
MODEL=$(cat /proc/cpuinfo | grep Model | cut -d: -f2- | xargs)
OS_NAME=$(cat /etc/os-release | grep PRETTY_NAME | cut -d= -f2- | tr -d '"')
printf '\n'
printf 'Debug information: (copy/paste to the ticket)\n'
printf '\n'
printf '|Property|Value|\n'
printf '|--------|-----|\n'
printf '|OS [incl. version]|`%s`|\n' "${OS_NAME:-unknown}"
@reubenmiller
reubenmiller / INSTALL_GO_C8Y_CLI_MANUALLY.md
Last active September 7, 2023 03:22
Manually install go-c8y-cli just using the binary

Manually download and install the binary

  1. Download the binary

    Linux / MacOS / WSL

    Make sure you choose the appropriate cpu architecture for your machine! Check out the options in the assets section of the latest release.

    mkdir -p "$HOME/bin"
@reubenmiller
reubenmiller / tedge-debug.sh
Created August 15, 2023 16:25
thin-edge.io debug script
#!/bin/sh
# -----------------------------------------------------------------------------------------------
# thin-edge.io debugging
# -----------------------------------------------------------------------------------------------
# Collect debug information to access the health of the installation
# -----------------------------------------------------------------------------------------------
set -e
LOG_FILE=/tmp/tedge-debug.log