Skip to content

Fix Alexa discovery and relay control for Hue and Wemo emulation - #2280

Open
DavidL54 wants to merge 9 commits into
openshwprojects:mainfrom
DavidL54:main
Open

DavidL54 wants to merge 9 commits into
openshwprojects:mainfrom
DavidL54:main

Conversation

@DavidL54

Copy link
Copy Markdown

This PR improves local Alexa integration through Philips Hue and Belkin Wemo emulation.

Changes

  • Expose relay channels through the Hue API with stable device identifiers.
  • Support Hue discovery requests before user registration, including /api/config and /api/nouser/lights.
  • Handle fragmented HTTP request bodies and Hue transitiontime parameters.
  • Preserve native OpenBeken API routes while Hue is enabled.
  • Fix SSDP responses and Wemo descriptors and relay control.
  • Add host tests and setup documentation.

Validation

  • BK7231N firmware builds successfully.
  • All 18 host tests pass.
  • Firmware installed via OTA on a BK7231N, with complete OTA readback verification.
  • Alexa discovery and operation confirmed by the user in Hue mode.
  • Wemo still requires validation with a physical Echo device.

@JimbobSquelchy

JimbobSquelchy commented Oct 25, 2026 •

Copy link
Copy Markdown

Hi @DavidL54, I opened #2283 a couple of days after this without spotting it, sorry! We've both rewritten most of drv_hue.c, so whichever is merged first, the other will conflict. They mostly cover different ground, so I think they can be combined:

#2283 adds:

  • the LED driver as a Hue light: Color temperature light (CW, RGBCW or an LED driver chip) or Dimmable light, with bri and ct mapped to the dimmer and colour temperature
  • relays as On/Off plug-in units (label, device name, or " ")
  • cJSON parsing, and selftests in the simulator suite (selftest_hue.c)
  • tested with Echo devices on two BK7231T CW bulbs: discovery, on/off, brightness and colour temperature by voice

#2280 adds, and #2283 doesn't have:

  • pre-registration discovery (/api/config, /api/nouser/lights)
  • incomplete-body handling and transitiontime
  • the SSDP change so Hue and Wemo can both answer a search
  • the Wemo fixes (serial/IP swap in setup.xml, controlling the reported output, stricter SetBinaryState parsing)
  • the \r\n header fix

Possible ways forward:

  1. Merge this one first, and I'll rebase HUE: implement the Hue API for Alexa (lights and relays) #2283 onto it so it only adds the LED light (dimmer and CT) on top.
  2. Merge HUE: implement the Hue API for Alexa (lights and relays) #2283 first, and you rebase the Hue extras onto it, with the SSDP, Wemo and HTTP fixes as they are (they don't overlap).

I'm happy with either, whichever the maintainers prefer. On my bulbs the dimming and colour temperature are the main reason to use Hue rather than Wemo, so I'd like to keep those. Happy to help test, too: I have Echo devices and BK7231T bulbs here.

One thing to factor in: your failing check is the ESP32-C3 2M image not fitting (1,440 bytes over). It isn't a bug, that build is simply nearly full. main leaves 4,576 bytes free there; #2283 passes all checks and, after trimming, leaves 608. Combined, the two won't fit as things stand, so the ESP32-C3 2M build might need ENABLE_DRIVER_HUE (or something else) switched off, or some trimming. Maintainers, do you have a preference?

@DavidL54

Copy link
Copy Markdown
Author

Hi @JimbobSquelchy !

Great work on your side! 🙂

I've reduced the code size and adjusted the ESP32-C3 2M build configuration, so all CI checks should pass now.
Either merge order is completely fine with me, but let's merge your PR first, and I'll rebase mine and adapt my changes afterwards. 😉

I also have Alexa devices and plenty of bulbs and switches available, so I can help test the combined changes too!

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.

2 participants