Skip to content

Secondary mcu with dimmer support - #484

Open
charliesjc wants to merge 30 commits into
romasku:mainfrom
charliesjc:secondary_mcu
Open

Secondary mcu with dimmer support#484
charliesjc wants to merge 30 commits into
romasku:mainfrom
charliesjc:secondary_mcu

Conversation

@charliesjc

@charliesjc charliesjc commented Aug 19, 2026

Copy link
Copy Markdown

Full UART comms to use a secondary MCU and a new cluster for dimmer support was added. While I've focused on dimmers for my needs, there are only small changes required to make this useful for any device that uses a secondary MCU. I.e. I've assumed pins B1 and B7 for UART which might not be valid for all Zigbee boards, but easily fixed.

I've also used device_db.yaml for datapoint parameter assignment of various functions for the secondary MCU.

Add missing clusterRegisterFunc so the 0xFC10 dimmer config cluster is
advertised, fixing Z2M "no input cluster manuSpecificTuyaDimmerConfig".
Register manufacturer-specific clusters (0xFC00-0xFFFF) with the Tuya
manufacturer code (0x125D) instead of 0, so Z2M can recognize them as
manufacturer-specific and match them to the converter's custom cluster
definitions.
HA turns dimmers on by sending MoveToLevelWithOnOff (0x04), which carries
only a brightness value - it never sends a plain OnOff ON. Per ZCL, that
command also changes the OnOff state, so the dimmer cluster now writes the
on/off DP (bool 1 when level > 0, 0 when level == 0) alongside the level DP.
This makes the relay actually switch on/off instead of only dimming.
Only initialise the MCU UART when the device has dimmers (secondary MCU),
so PB1/PB7 aren't reassigned as UART pins on the ~199 Telink boards that
use them as GPIOs.
The Tuya MCU protocol expects the frame sequence number to advance by
+1 per frame, wrapping from 0xFFF0 back to 0x0000. The previous code
advanced by +0x10, producing gaps in the sequence the MCU ignored.
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.

1 participant