Skip to content

feat: add scene handling (move from ZHC)#1570

Draft
Nerivec wants to merge 13 commits intomasterfrom
scenes
Draft

feat: add scene handling (move from ZHC)#1570
Nerivec wants to merge 13 commits intomasterfrom
scenes

Conversation

@Nerivec
Copy link
Copy Markdown
Collaborator

@Nerivec Nerivec commented Nov 29, 2025

Move scene handling to ZH (spec).
Main goal is to better sync state/scenes so we don't get as many mismatches in e.g. frontend.

  • Adds missing barrierControl & hvacThermostat clusters with respective scene-capable attributes (per R8 spec)
  • Use more advanced sync mechanisms (depending on request)
    • scene from Zigbee
    • scene from state (clusters cache)
    • state (clusters cache) from scene
  • Sync all clusters/attributes (ZHC did only a subset)
  • Unicast sync done using view command to save "as it is on device" [subject to change, may not be necessary, needs actual tests]
  • Groupcast sync done locally on "best-effort" (no feedback on request, many view requests required otherwise)
  • Remove scenes on group(s) removal according to spec
  • Add migration from .meta.scenes to .scenes for database
  • Fix a somewhat dangerous shallow endpoint.clusters clone in Device (no cloning needed at all).

TODO:

  • Z2M API endpoints and converter bypass for old scene stuff
  • ZHC cleanup (remove all converters, remove auto-added converters on devices)
  • State publishing on recall (what old recall converter did)
    • Investigate possible friction with devices using recall off-spec
  • Handle state (sync/publish) when transition time is involved (either via recall override or in underlying state)

CC: @MfCrizz

@Nerivec
Copy link
Copy Markdown
Collaborator Author

Nerivec commented Nov 29, 2025

@Koenkk any initial thoughts on this?
For the Z2M part, could add a dedicated extension or just do pass-through in bridge.

@Koenkk
Copy link
Copy Markdown
Owner

Koenkk commented Nov 30, 2025

@Nerivec similar to groups, I agree this also deserves to be in zigbee-herdman indeed, code looks good to me!

@Nerivec Nerivec changed the title feat: add scene handling feat: add scene handling (move from ZHC) Nov 30, 2025
@Nerivec Nerivec force-pushed the scenes branch 3 times, most recently from 61388f7 to 8ea3db6 Compare December 4, 2025 20:57
@Nerivec Nerivec force-pushed the scenes branch 2 times, most recently from 766071e to 5c433fd Compare December 7, 2025 22:59
@Nerivec Nerivec force-pushed the scenes branch 2 times, most recently from 14fc79d to 98ad154 Compare December 27, 2025 13:58
@Nerivec
Copy link
Copy Markdown
Collaborator Author

Nerivec commented Dec 30, 2025

@Koenkk can you take a look at the code before I start working on missing coverage? Cleaned up quite a bit, improved typing. I think it's about right?

For the Z2M/ZHC update, we're going to need new MQTT API endpoints (bridge/request/scene/*).
We also add tempory bypasses (deprecated for 3.0) in Z2M to call ZH API directly instead of going to converter when the old API is used (e.g. old frontend). This would allow proper ZHC cleanup (remove per-device converters for scene stuff).

@Koenkk
Copy link
Copy Markdown
Owner

Koenkk commented Dec 30, 2025

LGTM!

Only question; how are we going to publish an updated state? Basically what is now done through the recalledState here.

@Nerivec
Copy link
Copy Markdown
Collaborator Author

Nerivec commented Dec 30, 2025

Haven't gotten that far yet. Still need to figure out the details for Z2M/ZHC... 😅

Also have to handle the transition time better I think (should not publish scene state immediately when it won't be like that for possibly several seconds). I figure some devices will already report parts of the state on their own (stuff that's configured in reporting). Have to check what they do when transition time is involved (do they publish at start or end of timer, or several times in-between). Need to de-conflict this.

@Nerivec Nerivec force-pushed the scenes branch 2 times, most recently from 9d33ebf to 27ad2f2 Compare March 17, 2026 19:42
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