Koenkk / zigbee2mqtt

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

[New device support]: eWeLight ZB-RGBCW (Tuya) #21912

Open ingoratsdorf opened 7 months ago

ingoratsdorf commented 7 months ago

Link

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

Database entry

{"id":33,"type":"Router","ieeeAddr":"0xa4c138a9ccda8337","nwkAddr":16671,"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,2821],"outClusterList":[],"clusters":{"genBasic":{"attributes":{"modelId":"ZB-CL01","manufacturerName":"eWeLight","powerSource":1,"zclVersion":3,"appVersion":6,"stackVersion":2,"hwVersion":0,"dateCode":"20230629","swBuildId":"2.0.1"}},"lightingColorCtrl":{"attributes":{"colorCapabilities":25,"colorTempPhysicalMin":153,"colorTempPhysicalMax":500}}},"binds":[],"configuredReportings":[],"meta":{}}},"appVersion":6,"stackVersion":2,"hwVersion":0,"dateCode":"20230629","swBuildId":"2.0.1","zclVersion":3,"interviewCompleted":true,"meta":{"configured":1324213189},"lastSeen":1711137170310}

Comments

The above device is a LED strip light controller, RGBW. With the automatically detected device support being 'Lonsonho ZB-RGBCW', the only things that really works is on/off, all colours are mixed up. Ie: selecting blue makes everything red, selecting red makes it yellow, selecting yellow makes it blue-yellow, selecting green makes it actually blue. So looks like the colour channels are mixed up. I tried to create an external converter with the following autogenerated from Z2M:

const {philipsLight} = require('zigbee-herdsman-converters/lib/philips');

const definition = {
    zigbeeModel: ['ZB-CL01'],
    model: 'ZB-CL01',
    vendor: 'eWeLight',
    description: 'Automatically generated definition',
    extend: [philipsLight({"colorTemp":{"range":[153,500]},"color":{"modes":["xy","hs"]}})],
    meta: {},
};

But the converter does not seem to get loaded, the autodetected one is still being used. I searched for 'force external converter' but could not find anything other than a single unanswered post from some year or so ago.

external_converters:
  - 0xa4c138a9ccda8337.js

I am seeing in the logs

2024-03-23 09:16:31Publish 'get' 'color_temp' to '0xa4c138a9ccda8337' failed: 'Error: Read 0xa4c138a9ccda8337/1 lightingColorCtrl(["colorMode","currentX","currentY","enhancedCurrentHue","currentSaturation","colorTemperature"], {"timeout":10000,"disableResponse":false,"disableRecovery":false,"disableDefaultResponse":true,"direction":0,"srcEndpoint":null,"reservedBits":0,"manufacturerCode":null,"transactionSequenceNumber":null,"writeUndiv":false}) failed (Status 'UNSUPPORTED_ATTRIBUTE')'

External definition

const {philipsLight} = require('zigbee-herdsman-converters/lib/philips');

const definition = {
    zigbeeModel: ['ZB-CL01'],
    model: 'ZB-CL01',
    vendor: 'eWeLight',
    description: 'Automatically generated definition',
    extend: [philipsLight({"colorTemp":{"range":[153,500]},"color":{"modes":["xy","hs"]}})],
    meta: {},
};

module.exports = definition;

When the device is added, I see the following in the logs:

info  2024-03-27 21:13:17: Configuring '0xa4c138a9ccda8337'
info  2024-03-27 21:13:17: MQTT publish: topic 'homeassistant/light/0xa4c138a9ccda8337/light/config', payload '{"availability":[{"topic":"zigbee2mqtt/bridge/state","value_template":"{{ value_json.state }}"},{"topic":"zigbee2mqtt/0xa4c138a9ccda8337/availability","value_template":"{{ value_json.state }}"}],"availability_mode":"all","brightness":true,"brightness_scale":254,"color_mode":true,"command_topic":"zigbee2mqtt/0xa4c138a9ccda8337/set","device":{"identifiers":["zigbee2mqtt_0xa4c138a9ccda8337"],"manufacturer":"Lonsonho","model":"Zigbee 3.0 LED-bulb, RGBW LED (ZB-RGBCW)","name":"0xa4c138a9ccda8337","sw_version":"2.0.1","via_device":"zigbee2mqtt_bridge_0xe0798dfffeb1caf7"},"max_mireds":500,"min_mireds":153,"name":null,"object_id":"0xa4c138a9ccda8337","origin":{"name":"Zigbee2MQTT","sw":"1.36.0","url":"https://www.zigbee2mqtt.io"},"schema":"json","state_topic":"zigbee2mqtt/0xa4c138a9ccda8337","supported_color_modes":["xy","color_temp"],"unique_id":"0xa4c138a9ccda8337_light_zigbee2mqtt"}'
info  2024-03-27 21:13:17: MQTT publish: topic 'homeassistant/sensor/0xa4c138a9ccda8337/linkquality/config', payload '{"availability":[{"topic":"zigbee2mqtt/bridge/state","value_template":"{{ value_json.state }}"},{"topic":"zigbee2mqtt/0xa4c138a9ccda8337/availability","value_template":"{{ value_json.state }}"}],"availability_mode":"all","device":{"identifiers":["zigbee2mqtt_0xa4c138a9ccda8337"],"manufacturer":"Lonsonho","model":"Zigbee 3.0 LED-bulb, RGBW LED (ZB-RGBCW)","name":"0xa4c138a9ccda8337","sw_version":"2.0.1","via_device":"zigbee2mqtt_bridge_0xe0798dfffeb1caf7"},"enabled_by_default":false,"entity_category":"diagnostic","icon":"mdi:signal","name":"Linkquality","object_id":"0xa4c138a9ccda8337_linkquality","origin":{"name":"Zigbee2MQTT","sw":"1.36.0","url":"https://www.zigbee2mqtt.io"},"state_class":"measurement","state_topic":"zigbee2mqtt/0xa4c138a9ccda8337","unique_id":"0xa4c138a9ccda8337_linkquality_zigbee2mqtt","unit_of_measurement":"lqi","value_template":"{{ value_json.linkquality }}"}'
info  2024-03-27 21:13:17: MQTT publish: topic 'homeassistant/sensor/0xa4c138a9ccda8337/last_seen/config', payload '{"availability":[{"topic":"zigbee2mqtt/bridge/state","value_template":"{{ value_json.state }}"},{"topic":"zigbee2mqtt/0xa4c138a9ccda8337/availability","value_template":"{{ value_json.state }}"}],"availability_mode":"all","device":{"identifiers":["zigbee2mqtt_0xa4c138a9ccda8337"],"manufacturer":"Lonsonho","model":"Zigbee 3.0 LED-bulb, RGBW LED (ZB-RGBCW)","name":"0xa4c138a9ccda8337","sw_version":"2.0.1","via_device":"zigbee2mqtt_bridge_0xe0798dfffeb1caf7"},"device_class":"timestamp","enabled_by_default":true,"entity_category":"diagnostic","icon":"mdi:clock","name":"Last seen","object_id":"0xa4c138a9ccda8337_last_seen","origin":{"name":"Zigbee2MQTT","sw":"1.36.0","url":"https://www.zigbee2mqtt.io"},"state_topic":"zigbee2mqtt/0xa4c138a9ccda8337","unique_id":"0xa4c138a9ccda8337_last_seen_zigbee2mqtt","value_template":"{{ value_json.last_seen }}"}'
debug 2024-03-27 21:13:17: Received MQTT message on 'homeassistant/light/0xa4c138a9ccda8337/light/config' with data '{"availability":[{"topic":"zigbee2mqtt/bridge/state","value_template":"{{ value_json.state }}"},{"topic":"zigbee2mqtt/0xa4c138a9ccda8337/availability","value_template":"{{ value_json.state }}"}],"availability_mode":"all","brightness":true,"brightness_scale":254,"color_mode":true,"command_topic":"zigbee2mqtt/0xa4c138a9ccda8337/set","device":{"identifiers":["zigbee2mqtt_0xa4c138a9ccda8337"],"manufacturer":"Lonsonho","model":"Zigbee 3.0 LED-bulb, RGBW LED (ZB-RGBCW)","name":"0xa4c138a9ccda8337","sw_version":"2.0.1","via_device":"zigbee2mqtt_bridge_0xe0798dfffeb1caf7"},"max_mireds":500,"min_mireds":153,"name":null,"object_id":"0xa4c138a9ccda8337","origin":{"name":"Zigbee2MQTT","sw":"1.36.0","url":"https://www.zigbee2mqtt.io"},"schema":"json","state_topic":"zigbee2mqtt/0xa4c138a9ccda8337","supported_color_modes":["xy","color_temp"],"unique_id":"0xa4c138a9ccda8337_light_zigbee2mqtt"}'
debug 2024-03-27 21:13:17: Received MQTT message on 'homeassistant/sensor/0xa4c138a9ccda8337/linkquality/config' with data '{"availability":[{"topic":"zigbee2mqtt/bridge/state","value_template":"{{ value_json.state }}"},{"topic":"zigbee2mqtt/0xa4c138a9ccda8337/availability","value_template":"{{ value_json.state }}"}],"availability_mode":"all","device":{"identifiers":["zigbee2mqtt_0xa4c138a9ccda8337"],"manufacturer":"Lonsonho","model":"Zigbee 3.0 LED-bulb, RGBW LED (ZB-RGBCW)","name":"0xa4c138a9ccda8337","sw_version":"2.0.1","via_device":"zigbee2mqtt_bridge_0xe0798dfffeb1caf7"},"enabled_by_default":false,"entity_category":"diagnostic","icon":"mdi:signal","name":"Linkquality","object_id":"0xa4c138a9ccda8337_linkquality","origin":{"name":"Zigbee2MQTT","sw":"1.36.0","url":"https://www.zigbee2mqtt.io"},"state_class":"measurement","state_topic":"zigbee2mqtt/0xa4c138a9ccda8337","unique_id":"0xa4c138a9ccda8337_linkquality_zigbee2mqtt","unit_of_measurement":"lqi","value_template":"{{ value_json.linkquality }}"}'
debug 2024-03-27 21:13:17: Received MQTT message on 'homeassistant/sensor/0xa4c138a9ccda8337/last_seen/config' with data '{"availability":[{"topic":"zigbee2mqtt/bridge/state","value_template":"{{ value_json.state }}"},{"topic":"zigbee2mqtt/0xa4c138a9ccda8337/availability","value_template":"{{ value_json.state }}"}],"availability_mode":"all","device":{"identifiers":["zigbee2mqtt_0xa4c138a9ccda8337"],"manufacturer":"Lonsonho","model":"Zigbee 3.0 LED-bulb, RGBW LED (ZB-RGBCW)","name":"0xa4c138a9ccda8337","sw_version":"2.0.1","via_device":"zigbee2mqtt_bridge_0xe0798dfffeb1caf7"},"device_class":"timestamp","enabled_by_default":true,"entity_category":"diagnostic","icon":"mdi:clock","name":"Last seen","object_id":"0xa4c138a9ccda8337_last_seen","origin":{"name":"Zigbee2MQTT","sw":"1.36.0","url":"https://www.zigbee2mqtt.io"},"state_topic":"zigbee2mqtt/0xa4c138a9ccda8337","unique_id":"0xa4c138a9ccda8337_last_seen_zigbee2mqtt","value_template":"{{ value_json.last_seen }}"}'
debug 2024-03-27 21:13:17: Received Zigbee message from '0xa4c138a9ccda8337', type 'readResponse', cluster 'lightingColorCtrl', data '{"colorCapabilities":25}' from endpoint 1 with groupID 0
debug 2024-03-27 21:13:17: Missing colorTempPhysicalMin and/or colorTempPhysicalMax for endpoint 0xa4c138a9ccda8337!
debug 2024-03-27 21:13:17: Received Zigbee message from '0xa4c138a9ccda8337', type 'readResponse', cluster 'lightingColorCtrl', data '{"colorTempPhysicalMax":500,"colorTempPhysicalMin":153}' from endpoint 1 with groupID 0
info  2024-03-27 21:13:17: Successfully configured '0xa4c138a9ccda8337'
dotWee commented 6 months ago

Seems related to an issue I had too, which I put a converter together for as a workaround: https://github.com/Koenkk/zigbee2mqtt/issues/21361#issuecomment-2105394183

I'm not 100% confident that your issue here uses the same device specs as my mentioned fix tho. So here are two more potential fixes:

/*
 * Attributes zigbeeModel & fingerprint taken from the Lonsonho converter definition:
 *   https://github.com/Koenkk/zigbee-herdsman-converters/blob/c385d3fa7766ac5ab33bcc7124a1691663b6b8b6/src/devices/lonsonho.ts#L151
 *
 * Attributes model, vendor, description & light definition taken from the YSRSAI converter definition:
 *   https://github.com/Koenkk/zigbee-herdsman-converters/blob/master/src/devices/ysrsai.ts
 */
const tuya = require('zigbee-herdsman-converters/lib/tuya');

const definition1 = {
    zigbeeModel: ['ZB-RGBCW'],
    fingerprint: [{modelID: 'ZB-CL01', manufacturerName: 'eWeLight'}, {modelID: 'ZB-CL01', manufacturerName: 'eWeLink'},
        {modelID: 'ZB-CL02', manufacturerName: 'eWeLight'}, {modelID: 'ZB-CL01', manufacturerName: 'eWeLi\u0001\u0000\u0010'},
        {modelID: 'Z102LG03-1', manufacturerName: 'eWeLink'}],
    model: 'YSR-MINI-01_rgbcct',
    vendor: 'YSRSAI',
    description: 'Zigbee LED controller (RGB+CCT)',
    extend: [tuya.modernExtend.tuyaLight({colorTemp: {range: [160, 370]}, color: true})]
};

const definition2 = {
    zigbeeModel: ['ZB-CT01'],
    fingerprint: [{modelID: 'ZB-CL01', manufacturerName: 'eWeLight'}, {modelID: 'ZB-CL01', manufacturerName: 'eWeLink'},
        {modelID: 'ZB-CL02', manufacturerName: 'eWeLight'}, {modelID: 'ZB-CL01', manufacturerName: 'eWeLi\u0001\u0000\u0010'},
        {modelID: 'Z102LG03-1', manufacturerName: 'eWeLink'}],
    model: 'YSR-MINI-01_wwcw',
    vendor: 'YSRSAI',
    description: 'Zigbee LED controller (WW/CW)',
    extend: [tuya.modernExtend.tuyaLight({colorTemp: {range: [153, 500]}})],
    configure: async (device, coordinatorEndpoint) => {
        device.getEndpoint(1).saveClusterAttributeKeyValue('lightingColorCtrl', {colorCapabilities: 0x10});
    }
};

const definition3 = {
    zigbeeModel: ['ZB-DL01'],
    fingerprint: [{modelID: 'ZB-CL01', manufacturerName: 'eWeLight'}, {modelID: 'ZB-CL01', manufacturerName: 'eWeLink'},
        {modelID: 'ZB-CL02', manufacturerName: 'eWeLight'}, {modelID: 'ZB-CL01', manufacturerName: 'eWeLi\u0001\u0000\u0010'},
        {modelID: 'Z102LG03-1', manufacturerName: 'eWeLink'}],
    model: 'YSR-MINI-01_dimmer',
    vendor: 'YSRSAI',
    description: 'Zigbee LED controller (Dimmer)',
    extend: [tuya.modernExtend.tuyaLight()],
};

module.exports = definition1;

Replace the definition1 in the last line with either definition2 or definition3 to switch to a different converter definition. Make sure to restart zigbee2mqtt and remove+rejoin the device after switching the definition.

Let me know if this helps!

github-actions[bot] commented 2 hours ago

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