Skip to content

[ddwrt] Initial contribution of DD-WRT/OpenWrt/Tomato SSH based binding - #20505

Merged
lsiepel merged 58 commits into
openhab:mainfrom
ballle98:18282-ddwrt
Jun 26, 2026
Merged

[ddwrt] Initial contribution of DD-WRT/OpenWrt/Tomato SSH based binding#20505
lsiepel merged 58 commits into
openhab:mainfrom
ballle98:18282-ddwrt

Conversation

@ballle98

@ballle98 ballle98 commented Apr 2, 2026

Copy link
Copy Markdown
Contributor

New binding that monitors and manages DD-WRT, OpenWrt, Tomato, and generic Linux routers/access points via SSH. It auto-detects the wireless chipset driver (Broadcom wl, Atheros wl_atheros, Marvell iwinfo, OpenWrt iwinfo, generic iw) and adapts its commands accordingly.

Features:

Device telemetry — CPU load, CPU temperature, uptime, WAN IP, interface traffic counters
Wireless radio monitoring — SSID, channel, mode, associated client list
Wireless client tracking — online/offline state, signal strength, SNR, roaming between APs, MAC randomization support (hostname-based identification)
Syslog monitoring — real-time DHCP, wireless association, warning, and error events via logread -f, tail -F, or journalctl -f
Firewall rule control — enable/disable DD-WRT GUI-configured filter rules via nvram
Device reboot — remote reboot via SSH
Automatic discovery — devices on the network bridge, radios per device, wireless clients, and firewall rules
Thing types: network (bridge), device, radio, wireless-client, firewall-rule Channel types: 40 channels across 4 thing types covering telemetry, radio status, client details, syslog events (state + trigger), and firewall state

Architecture:

Single network bridge manages multiple devices; all things are children of the bridge
Per-device SSH session with automatic recovery on connection loss
Per-device refresh thread with catch-all exception handling for resilience
Chipset auto-detection from SSH MOTD banner and runtime probing
SshLogFollower with auto-reconnect for continuous syslog streaming
DDWRTNetworkCache (ConcurrentHashMap-based) for thread-safe device/client/radio state
OUI database for generating human-readable hostnames for devices without DHCP names
Ed25519 SSH key support in OSGi via explicit JCA provider registration
SSH ~/.ssh/config integration (ProxyJump, User, Port, IdentityFile)
Tests: 58 unit tests across 3 test classes (SyslogParserTest, OuiDatabaseTest, DDWRTNetworkCacheTest)

Dependencies:

Apache SSHD 2.17.1 (sshd-osgi), net.i2p.crypto eddsa 0.3.0

Prior discussion:

fix #18282
Community forum: https://community.openhab.org/t/considering-a-new-dd-wrt-binding/162386

Marketplace

https://community.openhab.org/t/dd-wrt-binding-5-1-0-0-6-0-0-0/168973

Tested with:

DD-WRT (Netgear R7000 Broadcom & Linksys WRT1900ACS Marvell chipsets) — gateway router
OpenWrt 24.10 (MediaTek MT7981, Cudy WR3000) — mesh AP

@ballle98
ballle98 requested a review from a team as a code owner April 2, 2026 21:51
@openhab-bot

Copy link
Copy Markdown
Collaborator

This pull request has been mentioned on openHAB Community. There might be relevant details there:

https://community.openhab.org/t/considering-a-new-dd-wrt-binding/162386/9

@wborn
wborn requested a review from Copilot April 3, 2026 06:10
@wborn wborn added the new binding If someone has started to work on a binding. For a new binding PR. label Apr 3, 2026

This comment was marked as resolved.

@lsiepel lsiepel left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks, this is a first pass, review half of the files to get an impression and i think these comments can be applied on multiple places. Once these are addressed we can continue with the next review iteration.

Comment thread bundles/org.openhab.binding.ddwrt/README.md Outdated
Comment thread bundles/org.openhab.binding.ddwrt/README.md Outdated
Comment thread bundles/org.openhab.binding.ddwrt/src/main/resources/OH-INF/addon/addon.xml Outdated
ballle98 added a commit to ballle98/openhab-addons that referenced this pull request Apr 8, 2026
From AI review of PR openhab#20505

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Lee Ballard <ballle98@gmail.com>
ballle98 added a commit to ballle98/openhab-addons that referenced this pull request Apr 8, 2026
AI code review of PR openhab#20505

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Lee Ballard <ballle98@gmail.com>
ballle98 added a commit to ballle98/openhab-addons that referenced this pull request Apr 8, 2026
AI code review PR openhab#20505

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Lee Ballard <ballle98@gmail.com>
ballle98 added a commit to ballle98/openhab-addons that referenced this pull request Apr 8, 2026
review in PR openhab#20505

Co-authored-by: lsiepel <leosiepel@gmail.com>
Signed-off-by: Lee Ballard <ballle98@gmail.com>
ballle98 added a commit to ballle98/openhab-addons that referenced this pull request Apr 8, 2026
code review PR openhab#20505

Co-authored-by: lsiepel <leosiepel@gmail.com>
Signed-off-by: Lee Ballard <ballle98@gmail.com>
ballle98 added a commit to ballle98/openhab-addons that referenced this pull request Apr 8, 2026
code review in PR openhab#20505

Co-authored-by: lsiepel <leosiepel@gmail.com>
Signed-off-by: Lee Ballard <ballle98@gmail.com>
ballle98 added a commit to ballle98/openhab-addons that referenced this pull request Apr 8, 2026
PR code review openhab#20505

Co-authored-by: lsiepel <leosiepel@gmail.com>
Signed-off-by: Lee Ballard <ballle98@gmail.com>
ballle98 added a commit to ballle98/openhab-addons that referenced this pull request Apr 8, 2026
code review PR openhab#20505

Co-authored-by: lsiepel <leosiepel@gmail.com>
Signed-off-by: Lee Ballard <ballle98@gmail.com>
ballle98 added a commit to ballle98/openhab-addons that referenced this pull request Apr 18, 2026
…an up discovery logging

- Add semantic equipment tags to all thing types (Router, NetworkAppliance, WirelessAccessPoint, Firewall)
- Add semantic tags to channels (Status, Measurement, Control, Switch, Timestamp, Temperature, Level, RSSI, SignalStrength, Speed)
- Add keywords to addon.xml for better discoverability
- Rename assoclist channel to assoc-list for consistency with other channel IDs
- Simplify discovery service: only include hostname and mac in properties, remove redundant debug logging

PR openhab#20505

Assisted-by: Windsurf:SWE-1.6
Signed-off-by: Lee Ballard <ballle98@gmail.com>
@ballle98
ballle98 requested a review from lsiepel April 18, 2026 03:36
@lsiepel
lsiepel requested a review from Copilot April 18, 2026 08:36
@lsiepel

lsiepel commented Apr 18, 2026

Copy link
Copy Markdown
Contributor

I re-opened some comments. When i try to build the binding locally, many tests fail. I also see build errors, have not checked SAT, please check that too.

[ERROR]   SyslogParserTest.testAnsiEscapesStripped:183 
Expected: is not null
     but: was null

This comment was marked as resolved.

@ballle98

Copy link
Copy Markdown
Contributor Author

I re-opened some comments. When i try to build the binding locally, many tests fail. I also see build errors, have not checked SAT, please check that too.

[ERROR]   SyslogParserTest.testAnsiEscapesStripped:183 
Expected: is not null
     but: was null

Looks like the CI build passed. And I ran a CI build locally with no issues. There are no issues in target/summary_report.html

   {
          "label": "Maven CI Verify",
          "type": "shell",
          "command": "./mvnw",
          "options": {
              "cwd": "${workspaceFolder}/../.."
          },
          "group": {
              "kind": "build"
          },
          "args": [
              "clean",
              "verify",
              "-B",
              "-T",
              "1.5C",
              "-U",
              "-am",
              "-amd",
              "-pl",
              ":org.openhab.binding.ddwrt,:org.openhab.addons.bom.openhab-core-index,:org.openhab.addons.bom.runtime-index,:org.openhab.addons.bom.test-index,-:org.openhab.addons.reactor.features.karaf,-:org.openhab.addons.features.karaf.openhab-addons,-:org.openhab.addons.features.karaf.openhab-addons-external"
          ],
          "problemMatcher": [],
          "detail": "CI-like clean verify build for ddwrt binding from openhab-addons root"
      },
[INFO] Reactor Summary for openHAB Add-ons 5.2.0-SNAPSHOT:
[INFO] 
[INFO] openHAB Add-ons .................................... SUCCESS [ 12.419 s]
[INFO] openHAB Add-ons :: BOM ............................. SUCCESS [  0.042 s]
[INFO] openHAB Add-ons :: BOM :: Runtime Index ............ SUCCESS [  2.985 s]
[INFO] openHAB Add-ons :: BOM :: Test Index ............... SUCCESS [  1.698 s]
[INFO] openHAB Add-ons :: BOM :: openHAB Core Index ....... SUCCESS [ 37.721 s]
[INFO] openHAB Add-ons :: Bundles ......................... SUCCESS [01:15 min]
[INFO] openHAB Add-ons :: Bundles :: ddwrt Binding ........ SUCCESS [ 30.316 s]
[INFO] openHAB Add-ons :: BOM :: openHAB Add-ons .......... SUCCESS [01:27 min]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  03:28 min (Wall Clock)
[INFO] Finished at: 2026-04-18T07:44:20-05:00
[INFO] ------------------------------------------------------------------------

ballle98 added a commit to ballle98/openhab-addons that referenced this pull request Apr 19, 2026
From AI review of PR openhab#20505

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Lee Ballard <ballle98@gmail.com>
ballle98 added a commit to ballle98/openhab-addons that referenced this pull request Apr 19, 2026
AI code review of PR openhab#20505

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Lee Ballard <ballle98@gmail.com>
ballle98 added a commit to ballle98/openhab-addons that referenced this pull request Apr 19, 2026
AI code review PR openhab#20505

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Lee Ballard <ballle98@gmail.com>
ballle98 added a commit to ballle98/openhab-addons that referenced this pull request Apr 19, 2026
review in PR openhab#20505

Co-authored-by: lsiepel <leosiepel@gmail.com>
Signed-off-by: Lee Ballard <ballle98@gmail.com>
ballle98 added a commit to ballle98/openhab-addons that referenced this pull request Apr 19, 2026
code review PR openhab#20505

Co-authored-by: lsiepel <leosiepel@gmail.com>
Signed-off-by: Lee Ballard <ballle98@gmail.com>
ballle98 added a commit to ballle98/openhab-addons that referenced this pull request Apr 19, 2026
code review in PR openhab#20505

Co-authored-by: lsiepel <leosiepel@gmail.com>
Signed-off-by: Lee Ballard <ballle98@gmail.com>
ballle98 added a commit to ballle98/openhab-addons that referenced this pull request Apr 19, 2026
PR code review openhab#20505

Co-authored-by: lsiepel <leosiepel@gmail.com>
Signed-off-by: Lee Ballard <ballle98@gmail.com>
ballle98 added a commit to ballle98/openhab-addons that referenced this pull request May 29, 2026
- Change 8 non-compliant logger.info calls to logger.debug per openHAB guidelines
  (info should only be used for newly started components or loaded files)
- Remove MAC address from wireless client discovery properties

PR openhab#20505

Assisted-by: Windsurf:SWE-1.6
Signed-off-by: Lee Ballard <ballle98@gmail.com>
ballle98 added a commit to ballle98/openhab-addons that referenced this pull request May 29, 2026
PR openhab#20505

Assisted-by: Windsurf:SWE-1.6
Signed-off-by: Lee Ballard <ballle98@gmail.com>
ballle98 added a commit to ballle98/openhab-addons that referenced this pull request May 29, 2026
- SyslogParser: Reuse static Gson instance instead of per-call allocation
- SyslogParser: Add Locale.ENGLISH to timestamp DateTimeFormatter
- SshRunner: Add timeout to ch.open().verify() to prevent indefinite blocking
- SshClientManager: Add shutdown() method for OSGi lifecycle cleanup
- DDWRTHandlerFactory: Call SshClientManager.shutdown() on deactivate
- DDWRTRadioThingHandler: Pass ifaceName (not interfaceId) to setRadioEnabled
- DDWRTRadioThingHandler: Normalize interfaceId in initialize for manual config
- thing-types.xml: Update radio interfaceId description to document mac:iface format
- ddwrt.properties: Update radio interfaceId description
- DDWRTBaseDevice: Change radioName separator from hyphen to space

PR openhab#20505

Assisted-by: Windsurf:Claude Opus 4.6
Signed-off-by: Lee Ballard <ballle98@gmail.com>
ballle98 added a commit to ballle98/openhab-addons that referenced this pull request May 29, 2026
PR openhab#20505

Assisted-by: Windsurf:Claude Opus 4.6
Signed-off-by: Lee Ballard <ballle98@gmail.com>
ballle98 added a commit to ballle98/openhab-addons that referenced this pull request May 29, 2026
1. DDWRTDiscoveryService.java — Null-guard on inbox (line 246)
2. DDWRTDiscoveryService.java — Wrong thing type filter (line 257)
3. DDWRTClientHandler.java — Missing status on config error (line 78)

PR openhab#20505

Assisted-by: Windsurf:Claude Opus 4.6
Signed-off-by: Lee Ballard <ballle98@gmail.com>
ballle98 added a commit to ballle98/openhab-addons that referenced this pull request May 29, 2026
1. DDWRTDiscoveryService.java (line 154) moved properties from discovery to refresh.
2. addon.xml (line 9) removed duplicate addon keywords

PR openhab#20505

Assisted-by: Windsurf:Claude Opus 4.6
Signed-off-by: Lee Ballard <ballle98@gmail.com>
Fixes #68

Assisted-by: Windsurf:SWE-1.6 Fast
Assisted-by: Copilot:GPT 5.5 Think Deeper
Signed-off-by: Lee Ballard <ballle98@gmail.com>
@ballle98

Copy link
Copy Markdown
Contributor Author

@lsiepel please review. Install from marketplace should work now.

@ballle98
ballle98 requested a review from lsiepel June 8, 2026 17:51
ballle98 added 2 commits June 10, 2026 12:51
… a DHCP event

Fixes #73
Assisted-by: Devin:Claude Opus 4.6

Signed-off-by: Lee Ballard <ballle98@gmail.com>
Fixes #75

Assisted-by: Devin:Claude Opus 4.8 Medium
Signed-off-by: Lee Ballard <ballle98@gmail.com>
@ballle98

Copy link
Copy Markdown
Contributor Author

@lsiepel I believe I have addressed all your comments. Did I miss anything? Do you have additional comments?

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 54 out of 55 changed files in this pull request and generated 3 comments.

Comment thread bundles/org.openhab.binding.ddwrt/src/main/feature/feature.xml Outdated

@lsiepel lsiepel left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Another pass, not yet fully covered everything, but don;t want to hold back these comments.

Comment thread bundles/org.openhab.binding.ddwrt/src/main/resources/OH-INF/thing/thing-types.xml Outdated
Comment thread bundles/org.openhab.binding.ddwrt/src/main/resources/OH-INF/thing/thing-types.xml Outdated
Comment thread bundles/org.openhab.binding.ddwrt/src/main/resources/OH-INF/thing/thing-types.xml Outdated
Comment thread bundles/org.openhab.binding.ddwrt/src/main/resources/OH-INF/thing/thing-types.xml Outdated
Comment thread bundles/org.openhab.binding.ddwrt/src/main/resources/OH-INF/thing/thing-types.xml Outdated
Comment thread bundles/org.openhab.binding.ddwrt/src/main/resources/OH-INF/thing/thing-types.xml Outdated
Comment thread bundles/org.openhab.binding.ddwrt/src/main/resources/OH-INF/thing/thing-types.xml Outdated
<category>QualityOfService</category>
<tags>
<tag>Measurement</tag>
<tag>SignalStrength</tag>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Not sure about the signalstrength, as it is more quality of sigtnal

Comment thread bundles/org.openhab.binding.ddwrt/src/main/resources/OH-INF/thing/thing-types.xml Outdated
Comment thread bundles/org.openhab.binding.ddwrt/src/main/resources/OH-INF/thing/thing-types.xml Outdated
@ballle98
ballle98 requested a review from lsiepel June 19, 2026 17:33
ballle98 and others added 3 commits June 19, 2026 12:42
PR openhab#20505

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Lee Ballard <ballle98@gmail.com>
PR openhab#20505

Co-authored-by: lsiepel <leosiepel@gmail.com>
Signed-off-by: Lee Ballard <ballle98@gmail.com>
PR openhab#20505

Assisted-by: Devin:Claude Opus 4.6
Signed-off-by: Lee Ballard <ballle98@gmail.com>

@lsiepel lsiepel left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Many minor/nitpicks. The exception handling and logging need to be checked binding wide.
Regarding progress; only the handlers are left. I believe we can still get this into 5.2.

Comment thread bundles/org.openhab.binding.ddwrt/src/main/resources/OH-INF/thing/thing-types.xml Outdated
Comment thread bundles/org.openhab.binding.ddwrt/src/main/resources/OH-INF/thing/thing-types.xml Outdated

@lsiepel lsiepel left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks, i have now covered all files. Found a few more in the handlers.

ballle98 and others added 2 commits June 21, 2026 17:47
PR openhab#20505

Co-authored-by: lsiepel <leosiepel@gmail.com>
Signed-off-by: Lee Ballard <ballle98@gmail.com>
- Replace generic catch(Exception) with catch(IOException | RuntimeException)
  in DDWRTBaseDevice, DDWRTNetwork, SshAuthSession, and DDWRTDiscoveryService
- Remove redundant try-catch around SshAuthSession.close() in
  DDWRTBaseDevice.closeSessionQuietly()
- Add debug logging for NumberFormatException in DDWRTBroadcomDevice
  (noise, channel, temperature parsing)
- Remove section splitter comments in DDWRTClient
- Downgrade logger.error to logger.warn for SSH command failures in SshRunner
- Refactor SyslogParser to accept ZoneId at construction and derive
  currentYear internally, removing the year parameter from parseLine()
- Extract property key constants (INTERFACE_ID, PARENT_DEVICE_MAC, MAC,
  RULE_ID, CHIPSET) into DDWRTBindingConstants
- Extract REFRESH_DEBOUNCE_SECONDS constant in DDWRTDiscoveryService
- Validate hostnames config in DDWRTNetworkBridgeHandler.initialize()
  with i18n error message
- Remove MAC from client discovery properties (unstable with randomization)
- Update README to reflect channel moves from device to network bridge,
  new client/device channels, and updated thing configuration
- Update SyslogParserTest for revised parseLine() signature

PR openhab#20505

Assisted-by: Devin:Claude Opus 4.6
Signed-off-by: Lee Ballard <ballle98@gmail.com>
@ballle98
ballle98 requested a review from lsiepel June 23, 2026 03:17

@lsiepel lsiepel left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks, while there are still some minor cleanups possible, i think the model is solid and as this is a new binding the risk is about zero and certainly not warrants postponing for another 6 months.

LGTM

You could add the addon's logo to the openHAB website. See https://www.openhab.org/docs/developer/addons/#add-your-add-on-s-logo-to-the-openhab-website-and-the-ui

@lsiepel
lsiepel merged commit 5445391 into openhab:main Jun 26, 2026
2 checks passed
@lsiepel lsiepel changed the title [ddwrt] Initial contribution of OH5 DD-WRT/OpenWrt/Tomato SSH based binding [ddwrt] Initial contribution of DD-WRT/OpenWrt/Tomato SSH based binding Jun 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

new binding If someone has started to work on a binding. For a new binding PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ddwrt] New OH4/5 dd-wrt binding

5 participants