Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[New device support]: TuYa RGBW dimmer recognized as RGBCCT bulb #19465

Open
zagi988 opened this issue Oct 28, 2023 · 5 comments
Open

[New device support]: TuYa RGBW dimmer recognized as RGBCCT bulb #19465

zagi988 opened this issue Oct 28, 2023 · 5 comments
Labels
new device support New device support request

Comments

@zagi988
Copy link

zagi988 commented Oct 28, 2023

Link

https://www.aliexpress.com/item/1005004630523125.html

Database entry

{"id":27,"type":"Router","ieeeAddr":"0xa4c138fe3dbb3d59","nwkAddr":6738,"manufId":4107,"manufName":"eWeLight","powerSource":"Mains (single phase)","modelId":"ZB-CL01","epList":[1],"endpoints":{"1":{"profId":260,"epId":1,"devId":269,"inClusterList":[0,3,4,5,6,8,768,4096],"outClusterList":[],"clusters":{"genBasic":{"attributes":{"hwVersion":0,"zclVersion":3}},"lightingColorCtrl":{"attributes":{"colorCapabilities":25,"colorTempPhysicalMin":250,"colorTempPhysicalMax":454,"colorMode":2,"currentX":11272,"currentY":48955,"colorTemperature":454,"options":0}},"genOnOff":{"attributes":{"onOff":1}},"genLevelCtrl":{"attributes":{"currentLevel":254}}},"binds":[{"cluster":8,"type":"endpoint","deviceIeeeAddress":"0x00124b0024c7c695","endpointID":1},{"cluster":768,"type":"endpoint","deviceIeeeAddress":"0x00124b0024c7c695","endpointID":1}],"configuredReportings":[],"meta":{"onLevelSupported":false}}},"appVersion":3,"stackVersion":2,"hwVersion":0,"dateCode":"20211229","swBuildId":"2.0.1","zclVersion":3,"interviewCompleted":true,"meta":{"configured":2},"lastSeen":1698529121041,"defaultSendRequestWhen":"immediate"}

Comments

Tried to write a custom controller for it to not expose "color_temp" but to just have white as second option to RGB but failed because of lack of knowledge.
The model that I have is "5 pin RGBW", so it doesn't have color temperature (2000-6000K) but only has RGB channels and a single white channel.

External converter

const extend = require('zigbee-herdsman-converters/lib/extend');
const exposes = require('zigbee-herdsman-converters/lib/exposes');
const tuya = require('zigbee-herdsman-converters/lib/tuya');
const types = require('zigbee-herdsman-converters/lib/types');
const tz = require('zigbee-herdsman-converters/converters/toZigbee');
const libColor = require('zigbee-herdsman-converters/lib/color');
const utils = require('zigbee-herdsman-converters/lib/utils');
const e = exposes.presets;
const ea = exposes.access;

const definition = {
    model: 'ZB-RGBW',
    fingerprint: [
        {
            modelID: 'ZB-CL01',
            manufacturerName: 'eWeLight'
        },
    ],
    vendor: 'Lonsonho',
    description: 'ZB RGBW dimmer (converted)',
    extend: tuya.extend.light_onoff_brightness_color(),
    exposes: [
        e.light_brightness_color(false)
         .setAccess('color_xy', ea.STATE_SET)
    ],
    toZigbee: utils.replaceInArray(
        tuya.extend.light_onoff_brightness_color().toZigbee,
        [tz.light_color],
        [{
            key: ['color'],
            convertSet: async (entity, key, value, meta) => {
                const color = libColor.Color.fromConverterArg(value);
                const enableWhite =
                    // Zigbee2MQTT frontend white value
                    (color.isXY() && (color.xy.x === 0.3125 || color.xy.y === 0.32894736842105265)) ||
                    // Home Assistant white color picker value
                    (color.isXY() && (color.xy.x === 0.323 || color.xy.y === 0.329));
    
                if (enableWhite) {
                    await entity.command('lightingColorCtrl', 'tuyaRgbMode', {enable: false});
                    const newState = {color_mode: 'color_temp'};
                    if (color.isXY()) {
                        newState.color = color.xy;
                    } else {
                        newState.color = color.rgb.gammaCorrected().toXY().rounded(4);
                    }
                    return {
                        state: libColor.syncColorState(newState, meta.state, entity, meta.options, meta.logger)
                    };
                } else {
                    return await tz.light_color.convertSet(entity, key, value, meta);
                }
            },
        }]
    ),
    meta: {applyRedFix: true},
};

module.exports = definition;

Supported color modes

color (rgb), white

Color temperature range

No response

@zagi988 zagi988 added the new device support New device support request label Oct 28, 2023
@zagi988
Copy link
Author

zagi988 commented Oct 31, 2023

It's more of a problem than new device support as more as I think of it. Had to emulate over Node-Red and template light to get it to have sense.

@stonegray
Copy link

I have the bulbs for testing purposes if needed. The fingerprint is the same but the bulbs have firmware version 1.0.13/20201216. The fingerprint is otherwise identical unfortunately.

@zagi988
Copy link
Author

zagi988 commented Nov 10, 2023

Can anyone at least help me write a custom controller since the fingerprint is the same?

Copy link
Contributor

github-actions bot commented May 9, 2024

This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 30 days

@github-actions github-actions bot added the stale Stale issues label May 9, 2024
@dotWee
Copy link

dotWee commented May 12, 2024

Can anyone at least help me write a custom controller since the fingerprint is the same?

See my workaround fix here: #21361 (comment)

@github-actions github-actions bot removed the stale Stale issues label Jul 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new device support New device support request
Projects
None yet
Development

No branches or pull requests

3 participants