Emulator application for an IoT device (with LwM2M).
- Features
- Application
- Configuration Profiles
- Run with Docker
- Technologies
- Repository
- Build from source
- LwM2M protocol support for objects:
LwM2M Server (1),Device (3),Firmware Update (5),Light Control (3311).
- HTTP UI for device management (REST API and Angular UI).
- Docker build.
Application has just one view, displaying (refreshing automatically thanks to websocket connection) management UI for the device.
It's possible to define multiple .yml files within data/ directory and control profile name with --{profile}
program argument.
Consider following configuration files:
$ tree data/
data
├── config.yml
└── config-demo.ymlThen selecting profile name looks following:
| config file | profile |
|---|---|
config.yml |
|
config-demo.yml |
--demo |
- Run LwM2M server (consider Leshan Demo Server from official repository or check here on how to use Leshan's playground).
- Set appropriate configuration in
data/config.yml(seedata/config-demo.ymlif using Leshan's playground). See also chapter about configuration profiles.
No need to compile Angular, as static dist files from webapp are included as static resources in jar.
You can use pre-built Docker image - malczuuu/iemu. Consider checking for
most recent image tags.
docker run --rm -p 4500:4500 malczuuu/iemu
To run application with demo profile, use following command:
docker run --rm --env APP_ARGS=--demo -p 4500:4500 malczuuu/iemu
To mount your own profiles, use /data volume. Predefined profiles are available in data/ directory for
reference.
The repository is a monorepo:
- root project is a Java backend (Gradle project),
webapp/contains Angular frontend.
Expand...
Project uses Java 17, mainly for compatibility reasons. You can change Java version in build.gradle.kts - project
uses Foojay plugin to automatically resolve and download JDKs (see settings.gradle.kts). Minimal version for
Gradle 9+ is also Java 17.
Simply locate App class and run it's main method. Setting profile parameter depends on your IDE, but it
should be somewhere named "Program Arguments" (not "JVM Options").
Project uses Gradle application plugin. To run application from Gradle, simply use run task.
./gradlew runTo run application with demo profile, use following command.
./gradlew run --args="--demo"Then, browse client UI or check in your LwM2M server if the client is connected.
Run install task to produce build/install/ output. This project does not produce a fat jar, it relies on Gradle
application plugin only.
./gradlew installThen, simply call iemu executable script from bin/ directory. It launches application using jars from lib/
directory.
./build/install/iemu/bin/iemuTo run application with demo profile, use following command.
./build/install/iemu/bin/iemu --demoFor more info about see Building the distribution chapter.
