HA discovery: don't advertise a TuyaMCU LED's raw channels as entities (#2218) - #2235
Open
codypendant wants to merge 2 commits into
Open
codypendant wants to merge 2 commits into
codypendant wants to merge 2 commits into
Conversation
…openshwprojects#2218) On a device configured with tuyaMcu_setupLED, the toggle+dimmer path publishes a light bound to the raw on/off and dimmer channels. Those channels are not what drives the LED -- real state lives in led_dimmer and led_basecolor_rgb -- so they sit at 0 permanently and the entity is inert. The LED itself is already advertised correctly by the ENABLE_LED_BASIC block, so HA ends up with two lights for one device: one that works and one that never will. Skip the raw pair when an LED is configured. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…ay loop (openshwprojects#2218) Breaking out of the light path left the toggle and dimmer channels unclaimed, so the relay loop below picked the toggle up and published it as a switch -- the same dead channel in a different form. Mark both channels as published instead, which suppresses the light and the switch in one go. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2218.
On a device configured with
tuyaMcu_setupLED, discovery advertises the rawon/off and dimmer channels as entities. The LED is driven from
led_dimmer/led_basecolor_rgb, so those channels stay at 0 and the entities are inert.HA ends up with a working light plus a dead one, and a dead switch — the toggle
channel falls through to the relay loop.
The LED light itself is published correctly by the existing
pwmCount == 5branch;
ledDriverChipRunningis 1 on these devices, sopwmCountisreassigned from
CFG_CountLEDRemapChannels(). Only the duplicates are wrong.TuyaMCU_HasLED()marks the toggle and dimmer channels as published withoutemitting them, which suppresses both the duplicate light and the switch.
Before:
After:
Verified on two Costco Feit FETAPE/RGBW/CONT strip controllers (BK7231T) with
tuyaMcu_setupLED 24 1. No other TuyaMCU LED hardware here.