Koenkk / zigbee2mqtt

Zigbee 🐝 to MQTT bridge 🌉, get rid of your proprietary Zigbee bridges 🔨
https://www.zigbee2mqtt.io
GNU General Public License v3.0
12.24k stars 1.69k forks source link

Compatibility and Behavior Issues with TS0505B (_TZ3210_bfwvfyx1) Bulbs in Zigbee2MQTT #24980

Open jordiinstalaciones opened 1 day ago

jordiinstalaciones commented 1 day ago

Link

https://es.aliexpress.com/item/1005005834314406.html?src=bing&aff_short_key=UneMJZVf&aff_platform=true&isdl=y&albch=shopping&acnt=135095331&isdl=y&albcp=555085802&albag=1298524384048003&slnk=&trgt=pla-4584757337813832&plac=&crea=81157829740251&netw=o&device=c&mtctp=e&utm_source=Bing&utm_medium=shopping&utm_campaign=PA_Bing_ES_PLA_PC_es-bigsave-24_ECPC_20240909&utm_content=es_bigsave_24&utm_term=smart%20led%20bulb%20zigbee%20a70&msclkid=e319ea1217b4165e65bd8d59533bbbcd&gatewayAdapt=glo2esp

Database entry

{ "id": 72, "type": "Router", "ieeeAddr": "0xa4c13878de461bab", "nwkAddr": 28281, "manufId": 4417, "manufName": "_TZ3210_bfwvfyx1", "powerSource": "Mains (single phase)", "modelId": "TS0505B", "epList": [1, 242], "endpoints": { "1": { "profId": 260, "epId": 1, "devId": 269, "inClusterList": [3, 4, 5, 6, 4096, 8, 768, 61184, 0], "outClusterList": [25, 10], "clusters": { "genBasic": { "attributes": { "modelId": "TS0505B", "manufacturerName": "_TZ3210_bfwvfyx1", "powerSource": 1, "zclVersion": 3, "appVersion": 101, "stackVersion": 0, "hwVersion": 1, "dateCode": "" } }, "lightingColorCtrl": { "attributes": { "colorCapabilities": 29, "colorTempPhysicalMin": 153, "colorTempPhysicalMax": 500, "currentHue": 49, "colorMode": 1 } }, "genLevelCtrl": { "attributes": { "currentLevel": 221 } }, "genOnOff": { "attributes": { "onOff": 1 } } }, "binds": [], "configuredReportings": [], "meta": {} }, "242": { "profId": 41440, "epId": 242, "devId": 97, "inClusterList": [], "outClusterList": [33], "clusters": {}, "binds": [], "configuredReportings": [], "meta": {} } }, "appVersion": 101, "stackVersion": 0, "hwVersion": 1, "dateCode": "", "zclVersion": 3, "interviewCompleted": true, "meta": { "configured": 332242049 }, "lastSeen": 1732972849607 }. { "id": 74, "type": "Router", "ieeeAddr": "0xa4c13891042d0bba", "nwkAddr": 35956, "manufId": 4417, "manufName": "_TZ3210_bfwvfyx1", "powerSource": "DC Source", "modelId": "TS0505B", "epList": [1, 242], "endpoints": { "1": { "profId": 260, "epId": 1, "devId": 269, "inClusterList": [0, 3, 4, 5, 6, 8, 768, 57346, 61184, 60928, 57344, 4096], "outClusterList": [3, 10, 4, 5, 6, 8, 768, 4096], "clusters": { "genBasic": { "attributes": { "modelId": "TS0505B", "manufacturerName": "_TZ3210_bfwvfyx1", "powerSource": 4, "zclVersion": 3, "appVersion": 162, "stackVersion": 2, "hwVersion": 1, "swBuildId": "0122052017" } }, "genOnOff": { "attributes": { "onOff": 0 } }, "lightingColorCtrl": { "attributes": { "57344": 1000, "61447": [], "61448": [], "61449": [], "61453": 88, "colorCapabilities": 29, "tuyaRgbMode": 0, "colorTempPhysicalMin": 0, "colorTempPhysicalMax": 1000 } }, "genLevelCtrl": { "attributes": { "61440": 1000 } } }, "binds": [], "configuredReportings": [], "meta": {} }, "242": { "profId": 41440, "epId": 242, "devId": 97, "inClusterList": [], "outClusterList": [33], "clusters": {}, "binds": [], "configuredReportings": [], "meta": {} } }, "appVersion": 162, "stackVersion": 2, "hwVersion": 1, "swBuildId": "0122052017", "zclVersion": 3, "interviewCompleted": true, "meta": { "configured": 332242049 }, "lastSeen": 1732978489144 }

Zigbee2MQTT version

1.41.0 commit: unknown

Comments

I have encountered compatibility issues with Tuya RGB+CCT bulbs (model TY-BK-A60, manufacturer _TZ3210_bfwvfyx1) in Zigbee2MQTT. The problem is specifically linked to firmware differences: • Firmware 1.2.5 works correctly with full attribute exposure and control. • Firmware 2.2.2 exhibits missing attributes, erratic behavior, and non-responsiveness to color adjustment commands.

I have tried the following:

  1. Adding custom fingerprints in tuya.js and an external converter.
  2. Analyzing database.db to identify differences between working and non-working firmware attributes.
  3. Modifying lightingColorCtrl configurations to address the unsupported attributes.

Despite these efforts, bulbs with firmware 2.2.2 remain problematic, while bulbs with firmware 1.2.5 work as expected.

I am seeking guidance on:

  1. Whether a firmware downgrade is possible for Tuya devices.
  2. Additional configuration options in Zigbee2MQTT for better compatibility with firmware 2.2.2.
  3. Any planned updates in Zigbee2MQTT or related libraries to address firmware-specific compatibility issues.

Your assistance would be greatly appreciated.

External definition

const { light, commandsOnOff, commandsLevelCtrl, commandsColorCtrl } = require('zigbee-herdsman-converters/lib/modernExtend');

const definition = {
    fingerprint: [
        { modelID: 'TS0505B', manufacturerName: '_TZ3210_bfwvfyx1' }
    ],
    model: 'TS0505B_custom',
    vendor: 'Tuya',
    description: 'Zigbee RGB+CCT light (Custom)',
    extend: [
        light({
            colorTemp: { range: [153, 500] },
            color: { modes: ['xy', 'hs'], applyRedFix: true, enhancedHue: false },
        }),
        commandsOnOff(),
        commandsLevelCtrl(),
        commandsColorCtrl(),
    ],
    exposes: [
        e.light_brightness_colortemp_colorhs([153, 500]).removeFeature('color_temp_startup')
    ],
    configure: async (device, coordinatorEndpoint) => {
        const endpoint = device.getEndpoint(1);
        await endpoint.write('lightingColorCtrl', { colorCapabilities: 29 });
    },
};

module.exports = [definition];

What works with the external definition:

    1.  Pairing: The bulb is recognized as TS0505B with manufacturer _TZ3210_bfwvfyx1.
    2.  On/Off Control: Bulb responds correctly to On/Off commands.
    3.  Brightness Control: Adjusting brightness works as expected.
    4.  Partial Color Temperature Control: Range [153, 500] is recognized, but there is inconsistency for firmware 2.2.2.

What doesn’t work:

    1.  Color Control: Bulbs with firmware 2.2.2 don’t respond to HS/XY color commands.
    2.  Firmware-Specific Issues:
    •   Firmware 1.2.5 works well, but 2.2.2 has incomplete/missing attributes (currentHue, currentX, currentY).
    •   Unsupported attributes during Zigbee commands for firmware 2.2.2.

The external definition significantly improves functionality for firmware 1.2.5, but further work is needed to address compatibility with firmware 2.2.2.

What does/doesn't work with the external definition?

What Works with the External Definition:

1.  Pairing:
•   The bulb is recognized correctly in Zigbee2MQTT as a TS0505B with the manufacturer _TZ3210_bfwvfyx1.
•   The device is successfully added to the network and shows up in the Zigbee2MQTT dashboard.
2.  On/Off Control:
•   The bulb responds correctly to On and Off commands from Zigbee2MQTT.
3.  Brightness Control:
•   Adjusting the brightness level works as expected.
4.  Color Temperature (Partially):
•   The colorTemp values (range [153, 500]) are recognized, but the behavior is inconsistent, especially on bulbs with firmware version 2.2.2.

What Doesn’t Work or Is Inconsistent:

1.  Color Control:
•   Bulbs with firmware 2.2.2 don’t properly respond to HS or XY color commands.
•   The currentHue, currentX, and currentY attributes either don’t update or return incorrect values.
2.  Color Temperature Range:
•   The expected range [153, 500] works only on firmware 1.2.5. Bulbs with firmware 2.2.2 ignore the lower bounds and often misinterpret the colorTemp values.
3.  Firmware-Specific Issues:
•   Bulbs with firmware 1.2.5 work almost perfectly with the external definition.
•   Bulbs with firmware 2.2.2:
•   Fail to respond to currentHue or colorMode.
•   Return unsupported attributes during Zigbee commands (UNSUPPORTED_ATTRIBUTE).
4.  Color Modes:
•   Modes like HS and XY don’t switch correctly on firmware 2.2.2, causing erratic behavior when attempting to change colors.
5.  Attributes Handling:
•   Attributes like currentX, currentY, and colorTemperature don’t sync properly with the external converter on firmware 2.2.2.

Conclusion:

The external definition works well for bulbs with firmware 1.2.5. However, the firmware differences (1.2.5 vs. 2.2.2) introduce inconsistencies, particularly in color and color temperature controls. Additional firmware-specific logic may be required in the external converter to handle these differences effectively.

grericht commented 7 hours ago

i have 4 of these bulbs added with z2m last week i could set: "color_power_on_behavior": "customized" today i get log: no interpreter. whats wrong?