Skip to content

[shelly] Add support for Duo E27 G3 and Multicolor Bulb E27 G3 - #20909

Open
markus7017 wants to merge 12 commits into
openhab:mainfrom
markus7017:shelly_duog3
Open

[shelly] Add support for Duo E27 G3 and Multicolor Bulb E27 G3#20909
markus7017 wants to merge 12 commits into
openhab:mainfrom
markus7017:shelly_duog3

Conversation

@markus7017

@markus7017 markus7017 commented Jun 7, 2026

Copy link
Copy Markdown
Contributor

Description

[New Device Support]

Add support for the Shelly Duo Bulb E27 Gen3 (shellyplusduobulb) and Shelly Multicolor Bulb E27 Gen3 (shellypluscolorbulb). Both devices use the Gen2 RPC API. While integrating them, the shared light-handling code used by all Shelly light devices was reviewed and adjusted so each bulb's actual color profile (CCT-only, RGB+CCT, or RGBW2's fixed 4-channel color+white) is handled correctly — this also affects the existing Gen1 Duo, Duo RGBW and Vintage bulbs, which share the same code paths. README documentation was updated for both new thing types.

Features:

  • Add support for the Shelly Duo Bulb E27 Gen3: tunable-white (CCT) bulb with brightness, color temperature and auto-on/off timer control
  • Add support for the Shelly Multicolor Bulb E27 Gen3: RGB+CCT bulb whose color and white channel groups are both always active and can be controlled independently at the same time

Fixes:

  • Corrected several control calls (status fetch, brightness, turn, auto-on/off timer) that used the wrong RPC method for the Multicolor Bulb G3, so they did not work
  • Removed a false "with Power Meter" claim from both new thing-type descriptions
  • Reviewed the light status/command handling shared by all bulb and RGBW2 devices (Gen1 and Gen2) and adjusted it so each device's actual color profile is respected, instead of assuming the RGBW2 shape everywhere — this also benefits the existing Gen1 Duo, Duo RGBW and Vintage bulbs

Changes:

  • Each bulb model's color profile (CCT-only Duo Bulb G3, RGB+CCT Multicolor Bulb G3, RGBW2's fixed 4-channel color+white) is now handled on its own terms

Testing

How to verify on hardware

  • Channel state updates arrive at the normal polling interval, not instantly on change; this matches the existing Duo/RGBW2 bulb behaviour on this branch.
  • No meter channels are created for either new device; their status payload carries power/energy fields, but the binding does not yet wire them into channels.
  • Duo Bulb G3: verify brightness, color temperature and auto-on/off timer control.
  • Multicolor Bulb G3: verify RGB/HSB control in color mode, brightness/color-temperature control in white mode, and that switching between the two modes updates the right channel group.
  • Existing Gen1 Duo, Duo RGBW and Vintage bulbs: verify behavior is unchanged from before this PR (power/brightness/color-temperature channels and color/white mode switching still work as before).

Acceptance criteria

  • Implementation done
  • Documentation is up-to-date
  • Verified by Community

Closing

Backport assessment

New device support bundled with a review/fix pass on the shared light-handling code it depends on; not backport-eligible.

@markus7017 markus7017 self-assigned this Jun 7, 2026
@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 Jun 7, 2026

@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, LGTM

This is still marked WIP, how to proceed. We only have about a week left for code freeze. There is also a conflict to solve.

@markus7017

Copy link
Copy Markdown
Contributor Author

@lsiepel Yes, I already spend some time, but couldn't get it stable - fixing here breaks there. This will not go into 5.2. I'm focusing of bug fixes and "easy integrations" of new devices (there are 15 more...). WS90 and LORA might be good candidates because almost done.

@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-binding/56862/5689

@markus7017 markus7017 added the additional testing preferred The change works for the pull request author. A test from someone else is preferred though. label Jul 11, 2026
@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

@matmai

matmai commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

I am also willing to test if you could provide a jar.

@andrewfg andrewfg 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.

Just a few comments concerning terminology

@andrewfg andrewfg added awaiting other PR Depends on another PR and removed awaiting other PR Depends on another PR labels Aug 5, 2026
@lsiepel

lsiepel commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

@markus7017 there is an offer to get this tested by @matmai, couldyou provide a jar where the conflicts and feedback have been resolved ?

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

Adds Gen3 Shelly Duo and Multicolor bulbs using the Gen2 RPC API.

Changes:

  • Registers both bulb types and channel definitions.
  • Adds CCT/RGB DTO and RPC handling.
  • Adds profile and deserialization tests.

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 13 comments.

Show a summary per file
File Description
ShellyApiConfigurationTest.java Improves setup failure reporting.
Shelly2DuoBulbProfileTest.java Tests bulb DTO deserialization.
ShellyDeviceProfileTest.java Tests new profile flags.
shellyGen2_lights.xml Defines new thing types.
shellyGen1_lights.xml Adds Duo temperature range type.
shelly.properties Adds labels and descriptions.
ShellyHandlerFactory.java Removes an unused field.
ShellyDevices.java Registers device identifiers and groups.
ShellyChannelDefinitions.java Creates CCT channels dynamically.
ShellyLightHandler.java Handles Gen3 bulb state and commands.
Shelly2ApiRpc.java Adds bulb RPC dispatch.
Shelly2ApiJsonDTO.java Adds RGB/CCT RPC DTOs.
Shelly2ApiClient.java Maps bulb configuration and status.
ShellyDeviceProfile.java Adds Gen3 bulb capability flags.
Suppressed comments (2)

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

  • The description still claims a power meter, contradicting the PR description and the implementation, which does not map the bulb's power/energy fields to meter channels. Remove the claim so users are not promised unavailable channels.
		<description>Shelly Multicolor Bulb E27 - Dimmable RGB+CCT Bulb with Power Meter</description>

bundles/org.openhab.binding.shelly/src/main/resources/OH-INF/i18n/shelly.properties:84

  • The localized description reintroduces the false power-meter claim that the PR description says was removed. This string will override the corrected thing XML in localized UIs.
thing-type.shelly.shellypluscolorbulb.description = Shelly Multicolor Bulb E27 Gen3 (Dimmable RGB+CCT Bulb with Power Meter)

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@markus7017

Copy link
Copy Markdown
Contributor Author

@lsiepel

@markus7017 there is an offer to get this tested by @matmai, couldyou provide a jar where the conflicts and feedback have been resolved ?

That's to early. We discussed

  • bug fix pr
  • feature pr
  • oh core light
  • duo g3

@lsiepel

lsiepel commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

@lsiepel

@markus7017 there is an offer to get this tested by @matmai, couldyou provide a jar where the conflicts and feedback have been resolved ?

That's to early. We discussed

  • bug fix pr
  • feature pr
  • oh core light
  • duo g3

According to the core light pr startpost it depends on this PR.
According to the feature pr start post it also depends on this. So it looks like this needs to go first.

so after the almost finished bug fix I assumed this PR is next. If not please update the above linked PR start post. And verify with @andrewfg about the core pr dependency

@andrewfg

andrewfg commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

My PR will only come after @markus7017 three light related PRs (including this one) are finished.

@lsiepel

lsiepel commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

Be carefull when rebasing, when done, i'll run another review round. Are there any device owners who mentioned they are willing to test?

@markus7017

Copy link
Copy Markdown
Contributor Author

The commit history has been rebased and reorganized into review-friendly, cherry-pickable commits (one per fix/feature/test group).

This PR adds support for the Shelly Duo Bulb E27 Gen3 and Shelly Multicolor Bulb E27 Gen3. While integrating them, the shared light-handling code used by all Shelly light devices was reviewed and fixed — this also covers the existing Gen1 Duo, Duo RGBW and Vintage bulbs, since they share the same code paths. Each bulb model's color profile (CCT-only, RGB+CCT, or RGBW2's fixed color+white) is now handled on its own terms instead of assuming one shape for all of them.

A build is available for testing:

@matmai @andrewfg would appreciate your help testing this on real hardware — Duo Bulb G3, Multicolor Bulb G3, and, if you have one, an existing Gen1 Duo/Duo RGBW/Vintage bulb to confirm nothing regressed there.

@markus7017

Copy link
Copy Markdown
Contributor Author

@lsiepel Please trigger an AI review

@markus7017

Copy link
Copy Markdown
Contributor Author

This gives an overview of the different color profiles, device types and how they map to channels
light-devices-overview.md

@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.

Here are the review results.

This review was AI-assisted.

@mstormi

mstormi commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Did some testing, here's the feedback (if I understood correctly you want it here).

FWIW, I didn't use discovery but statically created a bulb thing.

So: can control brightness but not color temperature. The latter channel has no effect.

And the brightness channel seems to reset itself to 0 or 100 at times. Not sure if my testing method or some other bug that still references the old (standard binding) channel is still active (cannot restart my system).

@markus7017

Copy link
Copy Markdown
Contributor Author

@matmai Please use updated build and try to use discovery initially, maybe the are issues when using the .things file. Delete the thing (also from jsondb to avoid some old stuff to get restored)

@andrewfg

Copy link
Copy Markdown
Contributor

@markus7017 I could not really tell from your code, but it looks like you are reclassifying the RGBWWPM rgbcct mode to be one "light" (essentially the same as a Gen 3 full color bulb) rather than a separate rgb primary with a cct secondary. Is that correct?

@markus7017

Copy link
Copy Markdown
Contributor Author

@andrewfg
Correct, and intentional — they're different hardware shapes that happen to share the "rgbcct" name. Pro RGBWW PM's rgbcct firmware profile is two independent components (RGB primary + CCT secondary). The Gen3 Multicolor
Bulb's rgbcct:0 is a single RPC component per Shelly's own Gen3 docs - no separate RGB/CCT components
exist on that device, so modeling it as one light is the accurate representation, not a simplification.

Maybe to reduce future confusion (not implemented yes): the isRGBCCT flag name is what's colliding with the Pro RGBWW PM's rgbcct profile string in reviewers' heads even though the code paths never overlap (isRGBCCT is gated behind isDuo everywhere). If you want to preempt this coming up again, renaming the flag to something bulb-specific (e.g. isMulticolorBulb) or adding a one-line Javadoc contrast note on the field would remove the ambiguity without touching behavior.

@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.

This is probably the last one

Shelly2RpcRequestParams params = new Shelly2RpcRequestParams();
params.id = 0;
params.mode = SHELLY_MODE_COLOR.equals(mode) ? SHELLY_RGBCCT_MODE_RGB : SHELLY_RGBCCT_MODE_CCT;
apiRequest(SHELLYRPC_METHOD_RGBCCT_SET, params, String.class);

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.

RGBCCT.Set requires at least one of on or brightness, so this mode-only request is invalid. The same precondition is missed by the setLightParms() RGBCCT branch when it sends only rgb or ct; the temperature path first sends this request and then a ct-only request, so switching to white/CCT can fail before the temperature is applied. Please ensure every RGBCCT.Set request includes on/brightness (or combine mode and value into one valid request), and make the transport-stub test reject payloads that violate the documented requirement.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 9823a91 - the handler now folds the mode switch into the same RGBCCT.Set request as the new rgb/ct value (one request instead of mode-only + value-only), and the RPC layer adds on=true whenever a request would otherwise carry neither on nor brightness. setLightMode() goes through the same path. The transport-stub test now rejects any RGBCCT.Set payload without on/brightness, and new tests cover the combined mode+ct / mode+rgb requests. (CCT.Set is unaffected: per the docs it accepts ct alone.)

@markus7017

Copy link
Copy Markdown
Contributor Author

@lsiepel changes applied, ready for the next round:

  • Fix: switching the Multicolor Bulb G3 between color and white mode and setting the color/temperature now goes out as a single valid RGBCCT.Set request; every RGBCCT.Set carries on/brightness as required by the API (9823a91)
  • Fix: the Gen3 bulbs' brightness/power state no longer drops to OFF / 0 % on every status poll while the bulb is on (d8d24f0) - @mstormi this is very likely the "brightness resets itself to 0 or 100" you observed, please re-test with the build below
  • Cleanup from a final self-review, no functional change (a3a4b4d)

Branch is rebased on current main, full build incl. tests is green.

Updated build: org.openhab.binding.shelly-5.3.0-SNAPSHOT-duog3.jar

@mstormi

mstormi commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

this is very likely the "brightness resets itself to 0 or 100" you observed, please re-test with the build below

Yes that seems to have fixed it.
The other problem (color temp not changeable) persists, though.

…profile flags

Signed-off-by: Markus Michels <markus7017@gmail.com>
Signed-off-by: Markus Michels <markus7017@gmail.com>
Signed-off-by: Markus Michels <markus7017@gmail.com>
…d mode switching

Signed-off-by: Markus Michels <markus7017@gmail.com>
…nitions

Signed-off-by: Markus Michels <markus7017@gmail.com>
…tch handling

Signed-off-by: Markus Michels <markus7017@gmail.com>
Signed-off-by: Markus Michels <markus7017@gmail.com>
- derive isRGBCCT from the thing type at init time (Multicolor Bulb is always rgbcct:0),
  runtime config detection stays as confirmation
- drop the Gen1-Bulb-only mode channel update for the Multicolor Bulb (it has no mode channel)
- remove redundant isDuo guard and no-op list write in Shelly2ApiClient
- rename Shelly2DuoBulbProfileTest to Shelly2DuoBulbDtoTest (it tests DTO mapping only),
  use the Multicolor thing type in color-mode tests, drop comments/FQNs in unit tests
- README: one sentence per line for the Multicolor Bulb paragraph; trim comments

Signed-off-by: Markus Michels <markus7017@gmail.com>
…tus blanking, CCT.Set guard

- updateRGBW: skip partial status notifications without rgb instead of dereferencing null
- applyBulbLightSettings: preserve the persisted light status across profile refreshes
- CCT.Set: don't send an empty request (device requires on, brightness or ct)
- RGBCCT.Set: repeat the current power state instead of forcing on when only rgb/ct/mode is sent
- Multicolor Bulb: white#temperature reports UNDEF in color mode; Gen3 bulbs push Kelvin
- ShellyColorUtils copy constructor now carries the mode

Signed-off-by: Markus Michels <markus7017@gmail.com>
…eep Gen1 bulb behaviour

- color#hsb/red/green/blue now switch the Multicolor Bulb to color mode, white#temperature switches back
- Gen3 bulbs have no power channel: brightness 0 turns the light off, color picker brightness is applied
- Gen1 Bulb/Duo/Vintage/Duo RGBW keep their power channel and brightness semantics

Signed-off-by: Markus Michels <markus7017@gmail.com>
…r Gen3 bulbs

- Gen3 Duo/Multicolor Bulb white#temperature is Number:Temperature 2700..6500 K
- Gen1 devices keep the Dimmer based whiteTemp channel type
- Thing descriptions aligned with i18n properties, Duo Bulb category Lightbulb
- README documents the channel type and mode switching

Signed-off-by: Markus Michels <markus7017@gmail.com>
…ests

- Shelly2RGBCCTStatus nested in Shelly2DeviceStatusResult like the other status DTOs
- SHELLYDT_COLORBLBG3 renamed to SHELLYDT_COLORBULBG3 (value unchanged)
- Discovery tests cover the Gen3 bulb service names and model IDs

Signed-off-by: Markus Michels <markus7017@gmail.com>
@markus7017

Copy link
Copy Markdown
Contributor Author

Pushed a self-review round for both Gen3 bulbs (f3a72e23b0). Gen1 Bulb/Duo/Vintage/Duo RGBW behaviour is unchanged, all Gen3-specific handling is gated on the Gen3 bulb thing types.

Fixes

  • Fix: A partial status push from the Multicolor Bulb (e.g. only brightness) no longer causes an exception; the channels are updated from the values that were sent.
  • Fix: color#hsb, color#red/green/blue now switch the Multicolor Bulb to color mode instead of being ignored while the bulb is in white mode; white#temperature switches back to white mode.
  • Fix: Changing only the color or color temperature no longer turns a switched-off bulb on; the current power state is kept.
  • Fix: Setting brightness 0 turns the Gen3 bulbs off in both color and white mode.
  • Fix: white#temperature no longer shows a stale value while the Multicolor Bulb is in color mode (reports UNDEF).
  • Fix: Color temperature commands without a value change are no longer sent as an empty request the device rejects.

Changes

  • Change: white#temperature for the Duo Bulb G3 and Multicolor Bulb G3 is now a Number:Temperature channel in Kelvin (2700..6500 K) instead of a percentage. Existing Gen1 bulbs keep the percent based channel.
  • Change: The Gen3 bulbs have no control#power channel; use white#brightness (0 = off) or color#hsb.
  • Change: Thing descriptions aligned with the i18n texts, Duo Bulb category is now Lightbulb.

README updated accordingly. Test build: org.openhab.binding.shelly-5.3.0-SNAPSHOT-duog3.jar in the usual myfiles location.

@markus7017

Copy link
Copy Markdown
Contributor Author

@mstormi please re-test

@mstormi

mstormi commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

yes color temp is working now, thanks

@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, LGTM

awaiting confirmation by markus

@matmai

matmai commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

I also have also tested a S3BL-C010007AEU bulb with org.openhab.binding.shelly-5.3.0-SNAPSHOT-duog3.jar (5.3.0.202608291343) on openHAB 5.3.0 Snapshot Build 5566.

  • It is discovered in the inbox
  • brightness works
  • color#HSB works
  • ``clor#full` works

white#temperature works not fully:

  • Sometimes it needs multiple changes until the bulb changes its temperature. From the web UI it always works.
  • The values in Kelvin are not the same as in the web UI, examples:
    • 2700K (OH) was set to 2993K (web)
    • 5000 (OH) was set to 5273K (web)
    • 6500L (web) was set to 6230K (OH)

BTW: SHBLB-1 was not supported by this bundle

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 work in progress A PR that is not yet ready to be merged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants