Skip to content

[shelly] Add Plus/Pro Dimmer models (Gen3/Gen4): 1PM, 2PM, 10V, DALI - #19226

Open
markus7017 wants to merge 13 commits into
openhab:mainfrom
markus7017:shelly_plus_pro_dimmer
Open

[shelly] Add Plus/Pro Dimmer models (Gen3/Gen4): 1PM, 2PM, 10V, DALI#19226
markus7017 wants to merge 13 commits into
openhab:mainfrom
markus7017:shelly_plus_pro_dimmer

Conversation

@markus7017

@markus7017 markus7017 commented Aug 23, 2025

Copy link
Copy Markdown
Contributor

Summary

Adds support for the remaining Gen2/Gen3/Gen4 Plus and Pro dimmer models.

Feature:

  • Shelly Plus Dimmer: added Gen4 (S4DM-0A101WWL) and Gen2 EU (SNDM-0011EU) support
  • Shelly Plus Dimmer 0/1-10V: added Gen4 (S4DM-0010WW) and an alternate Gen2 SKU (SNGW-0A11WW010)
  • Shelly Plus DALI Dimmer (Gen3: S3DM-0A1WW, Gen4: S4DM-0A1WW)
  • Shelly Pro Dimmer 1PM (SPDM-001PE01EU)
  • Shelly Pro Dimmer 2PM (SPDM-002PE01EU)
  • Shelly Pro Dimmer 0/1-10V PM (SPCC-001PE10EU)

Fix:

  • Corrected a handful of edge cases found while adding the new multi-channel dimmer models: input-count mismatches, per-channel button-mode detection, dimmer status/meter state handling, and an error-message check for uncalibrated Gen2 Pro Dimmers.
  • Added missing power/energy meter channels for Plus Dimmer (Gen3/Gen4), Plus Dimmer US, Plus Dimmer 0-10V, and Plus DALI Dimmer.
  • Fixed missing total/history energy readings on Pro Dimmer PM models.

Change:

  • README updated with full channel tables for all new device models.

Dependency

#21226 has merged — this PR is rebased on top of it.

Still depends on #20909 (open): both PRs independently touch the same dimmer status method, so whichever merges second will need a small manual reconciliation. Not blocking — flagging so it's tracked.

Test instructions

  • Add one of the new dimmer models and confirm it is discovered as the correct device type.
  • Verify dimmer brightness and on/off control work as expected.
  • For the Pro Dimmer 2PM, confirm both channels operate independently, each with its own power/energy readings.
  • Start a timer and confirm the timer-active indicator switches on while it's running and off afterward.
  • Verify existing (non-dimmer) relay and roller devices still work without regressions.

Closing

@markus7017 markus7017 self-assigned this Aug 23, 2025
@markus7017 markus7017 added enhancement An enhancement or new feature for an existing add-on work in progress A PR that is not yet ready to be merged labels Aug 23, 2025
@markus7017
markus7017 force-pushed the shelly_plus_pro_dimmer branch from f3632c0 to c8e11cc Compare August 26, 2025 19:15
@markus7017

Copy link
Copy Markdown
Contributor Author

@wborn could you please add Copilot as a reviewer

@wborn
wborn requested a review from Copilot August 26, 2025 20:43

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

This PR adds comprehensive support for multiple new Shelly dimmer devices across the Plus and Pro product lines. It introduces support for 7 new dimmer models while also consolidating and improving the Bluetooth Low Energy (BLU) device handling.

Key changes include:

  • Addition of Plus Dimmer G3/G4, DALI Dimmer G3, 0/1-10V Dimmer, and Pro Dimmer 1PM/2PM/0-1/10V support
  • Refactoring of BLU device discovery and event handling logic
  • Test suite updates to accommodate new device types and consolidated functionality

Reviewed Changes

Copilot reviewed 26 out of 26 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
ShellyThingCreatorTest.java Updated test cases to support new dimmer devices and consolidated BLU service name validation
ShellyMDNSDiscoveryParticipantTest.java Removed file - tests moved to ShellyThingCreatorTest
ShellyDeviceProfileTest.java Added tests for new dimmer devices and BLU service name building
shellyGen2_relay.xml Added thing type definitions for Plus Dimmer and DALI Dimmer
shellyGen2_lights.xml Added Pro Dimmer 1PM/2PM/0-1/10V thing type definitions
ShellyDevices.java Added device constants and mappings for all new dimmer models
Multiple API and handler files Refactored BLU handling, improved dimmer support, and consolidated event processing
Comments suppressed due to low confidence (1)

bundles/org.openhab.binding.shelly/src/main/resources/OH-INF/thing/shellyGen2_lights.xml:1

  • The table entry for shellyprodimmer2pm incorrectly shows 'Shelly Pro 1PM' when it should be 'Shelly Pro 2PM' to match the dual channel description.
<?xml version="1.0" encoding="UTF-8"?>

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@lsiepel

lsiepel commented Sep 17, 2025

Copy link
Copy Markdown
Contributor

Besides the copilot comments there are also conflicts to solve.

@lsiepel

lsiepel commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

#20044 was closed, so i guess this can be moved forward?

@markus7017 markus7017 added the awaiting other PR Depends on another PR label Jun 7, 2026
@markus7017

Copy link
Copy Markdown
Contributor Author

@lsiepel I started this PR a long time ago. In between some refactoring happened, lately with PR #20909. This is adding new Duo bulbs - not the same scope from a first point of view, but those also utilizes dimmer structures. It was a significant reduced scope to this one here so I would like first #20909 getting merged and then work on this one here.

@markus7017

Copy link
Copy Markdown
Contributor Author

Are you able to extract bugfixes into a separate PR? I keep asking for small dedicated PR's.

Went through everything labeled as a "bug fix" here. Most of it turned out to be corrections inside the new Gen2/3/4 dimmer code this PR itself adds, so there's nothing to extract — that code doesn't exist on main without this PR.

Two items were genuine, independent bugs in the already-shipped Gen1 Dimmer 1/2 support, so I split those into #21226 (requested your review there). Once that merges I'll rebase this PR on top.

@markus7017

Copy link
Copy Markdown
Contributor Author

#21226 has merged — this PR is now rebased on top of it, build green (see below).

Re #20909: confirmed it's a real dependency, not just a precaution. Both PRs independently touch updateDimmerStatus() in Shelly2ApiClient.java (this PR adds bounds checks, null-guards, and Pro Dimmer EM meter routing; #20909 carries an older, simpler version of the same method as part of its applyLightStatus() refactor). Whichever merges second will need to reconcile that method by hand. Not blocking from my side — flagging so it's tracked, and I'll rebase again once #20909 lands.

@markus7017

markus7017 commented Jul 26, 2026

Copy link
Copy Markdown
Contributor Author

Updated test build available — rebased on latest main, Pro Dimmer 2PM thing-type reverted to its already-released ID (no re-discovery needed for anyone who already tested).

New devices supported:

  • Shelly Plus Dimmer (now also Gen4, Gen2 EU)
  • Shelly Plus Dimmer 0/1-10V (now also Gen4, alt Gen2 SKU)
  • Shelly Plus DALI Dimmer (Gen3/Gen4)
  • Shelly Pro Dimmer 1PM
  • Shelly Pro Dimmer 2PM
  • Shelly Pro Dimmer 0/1-10V PM

org.openhab.binding.shelly-5.3.0-SNAPSHOT-plus_pro_dimmer.jar — see README-plus_pro_dimmer for updated README.

@markus7017

Copy link
Copy Markdown
Contributor Author

Carved out the Button 1/Button 2 label fix into a standalone bugfix branch (shelly_fixdimmers2) — it turned out to be a pre-existing bug in shared code (system:button trigger channels), not something specific to the new dimmer models, so it can be backported independently. PR to follow; this PR's body has been trimmed accordingly.

The meter-capability-map fix stays here since it only applies to thing types this PR itself introduces.

@markus7017

markus7017 commented Jul 31, 2026

Copy link
Copy Markdown
Contributor Author

@lsiepel

Still depends on #20909 (open): both PRs independently touch the same dimmer status method, so whichever merges second will need a small manual reconciliation. Not blocking — flagging so it's tracked.

This PR has to go first

testing by @ijasan started

@markus7017

Copy link
Copy Markdown
Contributor Author

@lsiepel Could you please trigger a Copilot

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 18 out of 18 changed files in this pull request and generated no new comments.

Suppressed comments (1)

bundles/org.openhab.binding.shelly/src/main/resources/OH-INF/thing/shellyGen2_relay.xml:653

  • The for shellyplus10v is split across two lines, which can lead to an unintended newline/extra whitespace in the rendered thing-type description. Keep it as a single line to avoid UI formatting artifacts.
		<description>Shelly Plus 0/1-10V Dimmer - analog interface dimmer controller for compatible LED drivers and ballasts
			(Gen2/Gen3/Gen4)</description>

lsiepel

This comment was marked as outdated.

@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/shelly-beta-with-plus-pro-mini-and-blu-support/139554/1

@markus7017

Copy link
Copy Markdown
Contributor Author

Rebased on latest main (no conflicts) and fixed a bug: resetting the meter totals on a PM-capable dimmer (Pro Dimmer 1PM/2PM/0-10V) called the wrong RPC method (Switch.ResetCounters instead of Light.ResetCounters), so it silently failed.

org.openhab.binding.shelly-5.3.0-SNAPSHOT-plus_pro_dimmer.jar — see README-plus_pro_dimmer for updated README.

@ijasan updated build available if you want to re-test.

@ijasan

ijasan commented Aug 15, 2026

Copy link
Copy Markdown

Rebased on latest main (no conflicts) and fixed a bug: resetting the meter totals on a PM-capable dimmer (Pro Dimmer 1PM/2PM/0-10V) called the wrong RPC method (Switch.ResetCounters instead of Light.ResetCounters), so it silently failed.

org.openhab.binding.shelly-5.3.0-SNAPSHOT-plus_pro_dimmer.jar — see README-plus_pro_dimmer for updated README.

@ijasan updated build available if you want to re-test.

@markus7017

Re-Test completed.

Environment:
Binding Version: org.openhab.binding.shelly-5.3.0-SNAPSHOT-plus_pro_dimmer.jar / 5.3.0.202608081843
OH Release: openHAB 5.2.0 Stable

Test Results:

Dimmer2 (Gen1) / SHDM-2 / Firmware 1.14.0

  • Everything is OK

Dimmer Plus (G3) / S3DM-0A101WWL / Firmware 2.0.0

The labels for the relay#button1 and relay#button2 channels have the same value without the number in the name, just as is the case with the other channels, such as relay#input1 and relay#input2.

grafik

Otherwise, everything is OK.

Dimmer Plus (G4) / S4DM-0A101WWL / Firmware 2.0.0

The labels for the relay#button1 and relay#button2 channels have the same value without the number in the name, just as is the case with the other channels, such as relay#input1 and relay#input2.

grafik

Otherwise, everything is OK.

@markus7017

Copy link
Copy Markdown
Contributor Author

@ijasan Thanks for testing! The button1/button2 label issue on Dimmer Plus (G3/G4) is fixed now - the channel labels correctly show the number suffix like the other indexed channels (input1/input2 etc.).

@markus7017

Copy link
Copy Markdown
Contributor Author

Re: the earlier low-confidence Copilot comment about shellyprodimmer2pm showing a "Shelly Pro 1PM" label - that's stale, the thing type definitions have since moved to shellyGen2_relay.xml and 1PM/2PM each have their own correct, distinct label ("Shelly Pro Dimmer 1PM" / "Shelly Pro Dimmer 2PM").

Comment on lines +1365 to +1371
Double currentTc = tmp.tC;
if (!getBool(tmp.isValid) || currentTc == null || tC > currentTc) {
tmp.isValid = true;
tmp.tC = tC;
tmp.tF = temperature.tF;
tmp.units = "C";
}

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.

[P2] Do not retain the historical maximum temperature

status.tmp survives between full polls and WebSocket notifications. After the first value, this comparison only replaces it with a higher value, while the device temperature channel is published from status.tmp; a dimmer that cools from 60 C to 40 C therefore remains at 60 C indefinitely. The existing relay status mapping keeps the latest component reading, which would also avoid this stale state here.

Suggested change
Double currentTc = tmp.tC;
if (!getBool(tmp.isValid) || currentTc == null || tC > currentTc) {
tmp.isValid = true;
tmp.tC = tC;
tmp.tF = temperature.tF;
tmp.units = "C";
}
tmp.isValid = true;
tmp.tC = tC;
tmp.tF = temperature.tF;
tmp.units = "C";

Signed-off-by: Markus Michels <markus7017@gmail.com>
Signed-off-by: Markus Michels <markus7017@gmail.com>
Signed-off-by: Markus Michels <markus7017@gmail.com>
…ndling for multi-channel devices

Signed-off-by: Markus Michels <markus7017@gmail.com>
Signed-off-by: Markus Michels <markus7017@gmail.com>
Signed-off-by: Markus Michels <markus7017@gmail.com>
Signed-off-by: Markus Michels <markus7017@gmail.com>
The system:button core channel type had no i18n label override in
this binding, so the digit-numbering logic in
ShellyChannelDefinitions.createChannel() (gated on a non-empty label)
never ran for it. Plus Dimmer relay#button1/relay#button2 channels
(the only case where the digit suffix must come from the channel name
rather than the group name) showed as plain "Button" with no index.
Adding an explicit label override lets the existing numbering logic
apply.

Signed-off-by: Markus Michels <markus7017@gmail.com>
Pro Dimmer PM devices measure power on their light:N RPC component,
not switch:N, so resetting the resetTotals channel called the
non-existent Switch.ResetCounters and failed. isDimmer now selects
Light.ResetCounters, checked before the generic hasRelays fallback
(dimmers always set hasRelays=true).

Signed-off-by: Markus Michels <markus7017@gmail.com>
Expose the number of control gears found on the DALI bus and whether a
bus scan is currently active as new advanced channels on Plus/Pro
Dimmer things that have a DALI interface.

Signed-off-by: Markus Michels <markus7017@gmail.com>
Signed-off-by: Markus Michels <markus7017@gmail.com>
Signed-off-by: Markus Michels <markus7017@gmail.com>
Signed-off-by: Markus Michels <markus7017@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

additional testing preferred The change works for the pull request author. A test from someone else is preferred though. enhancement An enhancement or new feature for an existing add-on

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants