Skip to content

Add MQTT bridge implementation for OpenEMS Edge#3458

Merged
sfeilmeier merged 12 commits intoOpenEMS:developfrom
Sn0w3y:implement-mqtt-bridge
Dec 6, 2025
Merged

Add MQTT bridge implementation for OpenEMS Edge#3458
sfeilmeier merged 12 commits intoOpenEMS:developfrom
Sn0w3y:implement-mqtt-bridge

Conversation

@Sn0w3y
Copy link
Copy Markdown
Collaborator

@Sn0w3y Sn0w3y commented Dec 1, 2025

Introduces the 'io.openems.edge.bridge.mqtt' module, providing MQTT communication support for OpenEMS Edge with MQTT 3.1, 3.1.1, and 5.0 via HiveMQ client. Adds configuration, connection handlers, API interfaces, and subscription management. Updates build and application files to include the new bridge and its dependencies.

Based on #1408

Introduces the 'io.openems.edge.bridge.mqtt' module, providing MQTT communication support for OpenEMS Edge with MQTT 3.1, 3.1.1, and 5.0 via HiveMQ client. Adds configuration, connection handlers, API interfaces, and subscription management. Updates build and application files to include the new bridge and its dependencies.
@codecov
Copy link
Copy Markdown

codecov bot commented Dec 1, 2025

Codecov Report

❌ Patch coverage is 28.54123% with 338 lines in your changes missing coverage. Please review.

Additional details and impacted files
@@              Coverage Diff              @@
##             develop    #3458      +/-   ##
=============================================
- Coverage      59.54%   59.38%   -0.16%     
  Complexity       112      112              
=============================================
  Files           2901     2912      +11     
  Lines         124935   125408     +473     
  Branches        9357     9394      +37     
=============================================
+ Hits           74381    74459      +78     
- Misses         47737    48122     +385     
- Partials        2817     2827      +10     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

This commit replaces the HiveMQ client with the Eclipse Paho client for both MQTT 3.x and MQTT 5.0 connection handlers in the MQTT bridge component. The change includes adapting the connection, publishing, subscription, and disconnection logic to utilize the Eclipse Paho API. This upgrade addresses compatibility issues with the previous client and improves the stability and flexibility of MQTT communications. The implementation now supports detailed configuration options provided by Eclipse Paho, such as automatic reconnection handling, advanced authentication mechanisms, and Last Will and Testament (LWT) features. Additionally, the commit introduces a custom reconnection strategy and enhances the handling of MQTT message subscriptions and deliveries, ensuring more robust and reliable MQTT service integration.
This commit updates the MQTT dependencies for the io.openems.edge.bridge.mqtt module. Specifically, it adds bcpkix and bcprov with version 1.78.1 to the buildpath, and replaces the com.hivemq:hivemq-mqtt-client-shaded and io.reactivex.rxjava2.rxjava dependencies with io.openems.wrapper.paho-mqttv5, org.eclipse.paho.client.mqttv3, and org.eclipse.paho.mqttv5.client, all versioned at 1.2. This change aims to standardize MQTT client usage across the project and ensure compatibility with the latest MQTT protocol versions.
This commit introduces unit tests for MQTT connection handlers across different MQTT protocol versions (3.1, 3.1.1, and 5). It includes tests for constructor behavior, connection status checks, publish/subscribe/unsubscribe operations when not connected, and topic matching with various wildcard scenarios. The tests ensure that the connection handlers behave as expected across different scenarios, including handling SSL connections, and correctly interpreting MQTT quality of service (QoS) levels. This comprehensive test suite aims to improve the reliability and robustness of the MQTT bridge by validating its core functionalities.
@Sn0w3y
Copy link
Copy Markdown
Collaborator Author

Sn0w3y commented Dec 1, 2025

@sfeilmeier @da-Kai would be ready to Review

Copy link
Copy Markdown
Contributor

@da-Kai da-Kai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @Sn0w3y,
here my initial review 😊

Sn0w3y and others added 2 commits December 2, 2025 00:35
This commit introduces a dummy implementation of the MQTT bridge (`DummyBridgeMqtt.java`) and its corresponding unit tests (`BridgeMqttImplTest.java`). Additionally, it includes package information (`package-info.java`) for proper OSGi bundle export. The dummy implementation is designed for use in unit testing by providing a mock MQTT bridge environment. This allows for testing of MQTT-related functionalities without the need for an actual MQTT broker connection. The removal of the Checkstyle build command and nature from the `.project` file suggests a simplification of the build process, possibly to streamline development or due to the Checkstyle configuration being managed differently.
@Sn0w3y Sn0w3y requested a review from da-Kai December 1, 2025 23:52
@da-Kai da-Kai requested a review from sfeilmeier December 2, 2025 15:10
Sn0w3y and others added 3 commits December 2, 2025 23:08
This commit removes the HiveMQ MQTT client shaded dependency from the cnf/pom.xml file. As it is not needed!
@sfeilmeier sfeilmeier merged commit 25fe1a0 into OpenEMS:develop Dec 6, 2025
6 of 7 checks passed
@Sn0w3y Sn0w3y deleted the implement-mqtt-bridge branch January 30, 2026 08:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants