Sorry, your browser does not support JavaScript!
Sign In

Docker MQTT Energy Monitoring: Advanced IAMMETER-Docker Setup

Docker MQTT Energy Monitoring and Advanced Configuration

After the basic IAMMETER-Docker server is running, it can be extended into a local MQTT energy monitoring server, use MySQL for a larger dataset, forward solar data to PVOutput and accept compatible third-party measurements.

This guide covers advanced data paths and storage options. For installation, persistent volumes, first login, meter setup, backup and container upgrades, start with Self-Hosted Energy Monitoring with Docker.

IAMMETER meter / compatible device / custom application
                         │
             ┌───────────┼───────────┐
             │           │           │
            HTTP        MQTT       REST API
             │           │           │
             └───────────┼───────────┘
                         ▼
                  IAMMETER-Docker
                         │
       ┌─────────────────┼─────────────────┐
       ▼                 ▼                 ▼
 SQLite / MySQL     MQTT subscribers     PVOutput

Use only the interfaces required by the project. A simple local monitoring installation does not need MySQL, external MQTT clients or data forwarding.

1. Before Enabling Advanced Features

Confirm that the basic installation is stable:

  • the IAMMETER-Docker container is running;
  • /app/data is mapped to persistent storage;
  • the Docker host uses a stable LAN address;
  • the site timezone is correct;
  • at least one meter or test data source is working;
  • default passwords have been changed;
  • a current backup exists.

The default deployment exposes:

  • 5050 for the web application and API;
  • 1883 for MQTT.

Do not publish either port directly to the Internet. Use a firewall, VPN or another controlled access layer when remote access is necessary.

2. Choose SQLite or MySQL

IAMMETER-Docker uses SQLite for a simple default deployment and supports MySQL for installations with a larger dataset.

Database Best for Advantages Considerations
SQLite Home, test and smaller local deployments No separate database service; easy initial setup Database remains tied to the application volume
MySQL Larger or longer-running installations Separate database service and better suitability for growing datasets Requires database deployment, credentials, backup and maintenance

Do not move to MySQL only because it is available. Use it when the expected data volume, retention period or database-management requirements justify an additional service.

2.1 Prepare MySQL first

Before selecting MySQL in IAMMETER-Docker:

  1. deploy a reachable MySQL server;
  2. create a dedicated database and user;
  3. restrict that user to the required database;
  4. confirm network access from the IAMMETER-Docker container;
  5. configure regular database backups;
  6. record the database host, port, name and credentials securely.

Then enter the MySQL connection settings in IAMMETER-Docker and confirm that new measurements are being stored.

Configure MySQL in IAMMETER-Docker

Back up the existing IAMMETER-Docker data before changing database mode. Verify historical data and new uploads after the change.

3. Use IAMMETER-Docker as an MQTT Energy Monitoring Server

IAMMETER-Docker includes MQTT support for two different directions:

  1. Publish to IAMMETER-Docker: a meter or compatible application sends measurements to the Docker server.
  2. Subscribe from IAMMETER-Docker: Node-RED, a custom service or another MQTT client receives real-time measurements from the server.

These paths use the same topic pattern but different authentication modes.

3.1 MQTT topic

The documented real-time topic is:

device/<SN>/realtime

Replace <SN> with the serial number registered in IAMMETER-Docker. The SN in the MQTT topic and client configuration must match the meter created in the local platform.

3.2 Publish energy data to IAMMETER-Docker

For a publishing device or application:

Setting Value
Broker IP address or hostname of the IAMMETER-Docker server
Port 1883 by default
Authentication Client ID
Client ID Meter SN registered in IAMMETER-Docker
Topic device/<SN>/realtime
Payload IAMMETER-supported uploading-data format

Publish energy data to IAMMETER-Docker through MQTT

Before using production data:

  1. register the SN in IAMMETER-Docker;
  2. publish one test payload;
  3. verify voltage, current, power and energy fields;
  4. confirm the phase or channel count;
  5. verify units and active-power direction;
  6. only then enable continuous publishing.

3.3 Subscribe to real-time energy data

For an MQTT subscriber:

Setting Value
Broker IAMMETER-Docker server address
Port 1883 by default
Authentication IAMMETER-Docker username and password
Topic device/<SN>/realtime

Subscribe to IAMMETER-Docker real-time data

Typical subscribers include:

  • Node-RED automation flows;
  • a local data-processing service;
  • an MQTT debugging client;
  • a gateway that forwards selected measurements;
  • a custom dashboard or alerting service.

If Node-RED is the primary application and historical storage in IAMMETER-Docker is not required, the meter can also connect to Node-RED through MQTT, Modbus TCP or its local API directly. Compare the options in the Node-RED energy meter guide.

4. Test and Troubleshoot MQTT

Start with a single meter and exact topic rather than a broad wildcard subscription.

Check the following when no data appears:

  • port 1883 is mapped from the container;
  • the client can reach the Docker host over the LAN;
  • the SN exists in IAMMETER-Docker;
  • the MQTT client ID and topic use the same SN;
  • the topic is device/<SN>/realtime with the expected capitalization;
  • publishing and subscribing authentication modes are not being confused;
  • the JSON payload matches the supported field order and units;
  • another MQTT client is not disconnecting the session by reusing the same client ID.

For reliable flows:

  • use a unique client ID for each subscriber;
  • handle reconnects and duplicate messages;
  • validate the payload before writing it to a database;
  • record the source SN with every stored measurement;
  • use network isolation instead of exposing the unencrypted MQTT port publicly.

5. Forward Solar Data to PVOutput

PVOutput is a third-party service for sharing and comparing solar generation and energy-consumption data. IAMMETER-Docker can forward site data to PVOutput.

Use this option when IAMMETER-Docker remains the local collection server but PVOutput is required for public or external solar reporting.

Before enabling forwarding:

  1. create or select the correct PVOutput system;
  2. obtain the required PVOutput credentials;
  3. confirm that Grid and Inverter channels are assigned correctly in IAMMETER-Docker;
  4. check the site timezone;
  5. enable forwarding for the intended site only;
  6. compare a daily total in both systems after the first complete day.

Forward IAMMETER-Docker solar data to PVOutput

PVOutput forwarding requires Internet access from the Docker host. It is separate from local monitoring: a temporary PVOutput connection failure should not prevent the meter from continuing to upload to the local server.

6. Receive Data from a Compatible Tasmota Device

IAMMETER-Docker includes a documented MQTT workflow for a metering-capable device running Tasmota. The original example used a Sonoff POW R2.

This is a compatibility path for supported energy payloads, not a claim that every Tasmota device or template produces the same measurement structure. Test the actual device and firmware before deployment.

Use the following Tasmota MQTT structure:

Setting Value
Host IAMMETER-Docker IP address
Port IAMMETER-Docker MQTT port, normally 1883
Client SN registered in IAMMETER-Docker
User Leave blank for this documented publishing workflow
Password Leave blank for this documented publishing workflow
Topic SN registered in IAMMETER-Docker
Full Topic device/%topic%/%prefix%/

Configure a compatible Tasmota meter for IAMMETER-Docker

After configuration, verify each reported value in IAMMETER-Docker, including voltage, current, active power, energy and power factor when supported by the device.

Tasmota electricity data in IAMMETER-Docker

7. Use the IAMMETER-Docker REST API

IAMMETER-Docker exposes interactive API documentation on the local server:

http://<docker-host-ip>:5050/docs

The REST API can be used to:

  • upload supported measurements from a custom gateway;
  • query data for a private dashboard;
  • connect a local application to the self-hosted server;
  • test payloads before automating an integration.

Keep API access on a trusted network. If an external system must connect remotely, place the service behind an appropriate secure access layer rather than exposing the application port without protection.

For developers building a complete receiver or custom platform instead of using IAMMETER-Docker, see Develop Your Own Energy Monitoring System.

8. Combine Local Storage and Cloud Services

Self-hosting does not have to mean that every external service is disabled. IAMMETER-Docker can be the local system of record while selected data is forwarded elsewhere.

Architecture Local data Internet dependency Best for
Local only IAMMETER-Docker Not required after deployment Privacy, offline sites and LAN dashboards
Local + IAMMETER-Cloud IAMMETER-Docker and IAMMETER-Cloud Required for forwarding Local copy plus IAMMETER-Cloud reports and remote access
Local + PVOutput IAMMETER-Docker and PVOutput Required for forwarding Solar users who use PVOutput
Local + MQTT subscriber IAMMETER-Docker plus subscriber-defined storage Not required with a local subscriber Node-RED, automation and custom processing

Enable only the destinations that serve a clear purpose. More destinations create more credentials, network dependencies and troubleshooting paths.

9. Advanced Deployment Checklist

  • Basic IAMMETER-Docker collection is already stable.
  • Persistent data and database backups are verified.
  • MySQL is used only when its operational overhead is justified.
  • MQTT port 1883 is reachable only from trusted networks.
  • Every MQTT client uses an appropriate and unique client ID.
  • Meter SN, topic and registered device match.
  • Payload units, phase count and power direction have been tested.
  • PVOutput or cloud forwarding failures do not interrupt local collection.
  • Tasmota compatibility has been confirmed with the actual device and firmware.
  • Changes are tested on one meter before being applied to a larger deployment.

10. Version History and Legacy Notes

The sections above describe the currently documented IAMMETER-Docker workflows. The original page was written around V1.8 and V1.9; the following history is retained for users maintaining older installations.

V2.4

V2.3

  • Fixed a PVOutput upload issue.

V2.2

  • Added logs for IAMMETER-Cloud forwarding failures.

V2.1

V1.9

  • Added MySQL support.
  • Added a custom image option for each Place.

IAMMETER-Docker V1.9

V1.8

  • Added MQTT upload to IAMMETER-Docker.
  • Added MQTT subscription to real-time data.
  • Added direct PVOutput forwarding.
  • Added the documented Tasmota/Sonoff metering workflow.

Last updated: July 17, 2026.

Top