Koenkk / zigbee2mqtt

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

[New device support]: TuYa TS0505B_1 with fingerprint _TZ3210_eejm8dcr #19656

Open talbx opened 7 months ago

talbx commented 7 months ago

Link

https://www.amazon.de/-/en/gp/product/B09MRYNTST/ref=ox_sc_act_title_1?smid=A3BLXSMQGDS33V&th=1

Database entry

{"id":23,"type":"Router","ieeeAddr":"0xa4c138df7485dce8","nwkAddr":51943,"manufId":4417,"manufName":"_TZ3210_eejm8dcr","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":{"genLevelCtrl":{"attributes":{"currentLevel":1}},"genOnOff":{"attributes":{"onOff":1}},"genBasic":{"attributes":{"stackVersion":0,"dateCode":""}},"lightingColorCtrl":{"attributes":{"colorMode":2,"currentX":0,"currentY":0,"currentHue":16,"currentSaturation":16,"colorTemperature":0,"colorCapabilities":29}}},"binds":[],"configuredReportings":[],"meta":{}},"242":{"profId":41440,"epId":242,"devId":97,"inClusterList":[],"outClusterList":[33],"clusters":{},"binds":[],"configuredReportings":[],"meta":{}}},"appVersion":65,"stackVersion":0,"hwVersion":1,"dateCode":"","zclVersion":3,"interviewCompleted":true,"meta":{"configured":1842547789},"lastSeen":1699626635971,"defaultSendRequestWhen":"immediate"}

Comments

The device gets misinterpreted by z2m. As far as I can tell from tuya.ts, the fingerprint is missing, therefore unknown.

It also throws some exception after joining the network

Exception while calling fromZigbee converter: Cannot read properties of undefined (reading 'hasOwnProperty')}

and leaves eventually

Warning 2023-11-10 15:31:56Device '0xa4c138df7485dce8' left the network

further logs messages by zigbee2mqtt:

Info 2023-11-10 15:31:35MQTT publish: topic 'zigbee2mqtt/bridge/event', payload '{"data":{"friendly_name":"0xa4c138df7485dce8","ieee_address":"0xa4c138df7485dce8"},"type":"device_announce"}'
Debug 2023-11-10 15:31:35Received MQTT message on 'zigbee2mqtt/0xa4c138df7485dce8/get' with data '{"state":0,"brightness":0,"color_temp":0,"color":0}'
Debug 2023-11-10 15:31:35Publishing get 'get' 'brightness' to '0xa4c138df7485dce8'
Debug 2023-11-10 15:31:35Received Zigbee message from '0xa4c138df7485dce8', type 'readResponse', cluster 'genLevelCtrl', data '{"currentLevel":1}' from endpoint 1 with groupID 0
Info 2023-11-10 15:31:35MQTT publish: topic 'zigbee2mqtt/0xa4c138df7485dce8', payload '{"brightness":1,"color_power_on_behavior":null,"do_not_disturb":null,"linkquality":90,"state":"ON"}'
Debug 2023-11-10 15:31:35Publishing get 'get' 'state' to '0xa4c138df7485dce8'
Debug 2023-11-10 15:31:36Received Zigbee message from '0xa4c138df7485dce8', type 'readResponse', cluster 'genOnOff', data '{"onOff":1}' from endpoint 1 with groupID 0
Info 2023-11-10 15:31:36MQTT publish: topic 'zigbee2mqtt/0xa4c138df7485dce8', payload '{"brightness":1,"color_power_on_behavior":null,"do_not_disturb":null,"linkquality":93,"state":"ON"}'
Debug 2023-11-10 15:31:36Publishing get 'get' 'color_temp' to '0xa4c138df7485dce8'
Debug 2023-11-10 15:31:36Received Zigbee message from '0xa4c138df7485dce8', type 'readResponse', cluster 'genBasic', data '{"stackVersion":0}' from endpoint 1 with groupID 0
Debug 2023-11-10 15:31:36Received Zigbee message from '0xa4c138df7485dce8', type 'readResponse', cluster 'lightingColorCtrl', data '{"colorMode":2,"colorTemperature":0,"currentHue":16,"currentSaturation":16,"currentX":0,"currentY":0}' from endpoint 1 with groupID 0
Debug 2023-11-10 15:31:36Missing colorTempPhysicalMin and/or colorTempPhysicalMax for endpoint 0xa4c138df7485dce8!
Error 2023-11-10 15:31:36Exception while calling fromZigbee converter: Cannot read properties of undefined (reading 'hasOwnProperty')}
Debug 2023-11-10 15:31:36TypeError: Cannot read properties of undefined (reading 'hasOwnProperty') at Function.fromObject (/app/node_modules/zigbee-herdsman-converters/src/lib/color.ts:226:17) at Function.fromMireds (/app/node_modules/zigbee-herdsman-converters/src/lib/color.ts:239:24) at Object.syncColorState (/app/node_modules/zigbee-herdsman-converters/src/lib/color.ts:773:32) at Object.convert (/app/node_modules/zigbee-herdsman-converters/src/converters/fromZigbee.ts:679:51) at Receive.onDeviceMessage (/app/lib/extension/receive.ts:150:51) at EventEmitter.emit (node:events:529:35) at EventBus.emitDeviceMessage (/app/lib/eventBus.ts:102:22) at Controller.<anonymous> (/app/lib/zigbee.ts:108:27) at Controller.emit (node:events:517:28) at Controller.selfAndDeviceEmit (/app/node_modules/zigbee-herdsman/src/controller/controller.ts:527:14)
Debug 2023-11-10 15:31:36Publishing get 'get' 'color' to '0xa4c138df7485dce8'
Debug 2023-11-10 15:31:36Received Zigbee message from '0xa4c138df7485dce8', type 'readResponse', cluster 'genBasic', data '{"dateCode":""}' from endpoint 1 with groupID 0
Debug 2023-11-10 15:31:36Received Zigbee message from '0xa4c138df7485dce8', type 'readResponse', cluster 'lightingColorCtrl', data '{"colorMode":2,"colorTemperature":0,"currentHue":16,"currentSaturation":16,"currentX":0,"currentY":0}' from endpoint 1 with groupID 0
Debug 2023-11-10 15:31:36Missing colorTempPhysicalMin and/or colorTempPhysicalMax for endpoint 0xa4c138df7485dce8!
Error 2023-11-10 15:31:36Exception while calling fromZigbee converter: Cannot read properties of undefined (reading 'hasOwnProperty')}
Debug 2023-11-10 15:31:36TypeError: Cannot read properties of undefined (reading 'hasOwnProperty') at Function.fromObject (/app/node_modules/zigbee-herdsman-converters/src/lib/color.ts:226:17) at Function.fromMireds (/app/node_modules/zigbee-herdsman-converters/src/lib/color.ts:239:24) at Object.syncColorState (/app/node_modules/zigbee-herdsman-converters/src/lib/color.ts:773:32) at Object.convert (/app/node_modules/zigbee-herdsman-converters/src/converters/fromZigbee.ts:679:51) at Receive.onDeviceMessage (/app/lib/extension/receive.ts:150:51) at EventEmitter.emit (node:events:529:35) at EventBus.emitDeviceMessage (/app/lib/eventBus.ts:102:22) at Controller.<anonymous> (/app/lib/zigbee.ts:108:27) at Controller.emit (node:events:517:28) at Controller.selfAndDeviceEmit (/app/node_modules/zigbee-herdsman/src/controller/controller.ts:527:14)
Debug 2023-11-10 15:31:36Received Zigbee message from '0xa4c138df7485dce8', type 'readResponse', cluster 'genBasic', data '{}' from endpoint 1 with groupID 0
Info 2023-11-10 15:31:36Successfully interviewed '0xa4c138df7485dce8', device has successfully been paired
Info 2023-11-10 15:31:36Device '0xa4c138df7485dce8' is supported, identified as: TuYa Zigbee RGB+CCT light (TS0505B_1)
Info 2023-11-10 15:31:36MQTT publish: topic 'zigbee2mqtt/bridge/event', payload '{"data":{"definition":{"description":"Zigbee RGB+CCT light","exposes":[{"features":[{"access":7,"description":"On/off state of this light","label":"State","name":"state","property":"state","type":"binary","value_off":"OFF","value_on":"ON","value_toggle":"TOGGLE"},{"access":7,"description":"Brightness of this light","label":"Brightness","name":"brightness","property":"brightness","type":"numeric","value_max":254,"value_min":0},{"access":7,"description":"Color temperature of this light","label":"Color temp","name":"color_temp","presets":[{"description":"Coolest temperature supported","name":"coolest","value":153},{"description":"Cool temperature (250 mireds / 4000 Kelvin)","name":"cool","value":250},{"description":"Neutral temperature (370 mireds / 2700 Kelvin)","name":"neutral","value":370},{"description":"Warm temperature (454 mireds / 2200 Kelvin)","name":"warm","value":454},{"description":"Warmest temperature supported","name":"warmest","value":500}],"property":"color_temp","type":"numeric","unit":"mired","value_max":500,"value_min":153},{"access":7,"description":"Color of this light in the CIE 1931 color space (x/y)","features":[{"access":7,"label":"X","name":"x","property":"x","type":"numeric"},{"access":7,"label":"Y","name":"y","property":"y","type":"numeric"}],"label":"Color (X/Y)","name":"color_xy","property":"color","type":"composite"}],"type":"light"},{"access":2,"description":"Triggers an effect on the light (e.g. make light blink for a few seconds)","label":"Effect","name":"effect","property":"effect","type":"enum","values":["blink","breathe","okay","channel_change","finish_effect","stop_effect"]},{"access":3,"description":"Do not disturb mode, when enabled this function will keep the light OFF after a power outage","label":"Do not disturb","name":"do_not_disturb","property":"do_not_disturb","type":"binary","value_off":false,"value_on":true},{"access":3,"description":"Power on behavior state","label":"Color power on behavior","name":"color_power_on_behavior","property":"color_power_on_behavior","type":"enum","values":["initial","previous","cutomized"]},{"access":1,"description":"Link quality (signal strength)","label":"Linkquality","name":"linkquality","property":"linkquality","type":"numeric","unit":"lqi","value_max":255,"value_min":0}],"model":"TS0505B_1","options":[{"access":2,"description":"Controls the transition time (in seconds) of on/off, brightness, color temperature (if applicable) and color (if applicable) changes. Defaults to `0` (no transition).","label":"Transition","name":"transition","property":"transition","type":"numeric","value_min":0},{"access":2,"description":"When enabled colors will be synced, e.g. if the light supports both color x/y and color temperature a conversion from color x/y to color temperature will be done when setting the x/y color (default true).","label":"Color sync","name":"color_sync","property":"color_sync","type":"binary","value_off":false,"value_on":true},{"access":2,"description":"State actions will also be published as 'action' when true (default false).","label":"State action","name":"state_action","property":"state_action","type":"binary","value_off":false,"value_on":true}],"supports_ota":false,"vendor":"TuYa"},"friendly_name":"0xa4c138df7485dce8","ieee_address":"0xa4c138df7485dce8","status":"successful","supported":true},"type":"device_interview"}'
Info 2023-11-10 15:31:36Configuring '0xa4c138df7485dce8'
Info 2023-11-10 15:31:36Successfully configured '0xa4c138df7485dce8'

External converter

const fz = require('zigbee-herdsman-converters/converters/fromZigbee');
const tz = require('zigbee-herdsman-converters/converters/toZigbee');
const exposes = require('zigbee-herdsman-converters/lib/exposes');
const reporting = require('zigbee-herdsman-converters/lib/reporting');
const extend = require('zigbee-herdsman-converters/lib/extend');
const e = exposes.presets;
const ea = exposes.access;
const tuya = require('zigbee-herdsman-converters/lib/tuya');

const definition = {
    // Since a lot of TuYa devices use the same modelID, but use different datapoints
    // it's necessary to provide a fingerprint instead of a zigbeeModel
    fingerprint: [
        {
            // The model ID from: Device with modelID 'TS0601' is not supported
            // You may need to add \u0000 at the end of the name in some cases
            modelID: 'TS0505B_1',
            // The manufacturer name from: Device with modelID 'TS0601' is not supported.
            manufacturerName: '_TZ3210_eejm8dcr',
        },
    ],
    model: 'TS0505B_1',
    vendor: 'TuYa',
    description: 'Zigbee RGB+CCT light',
    fromZigbee: [tuya.fz.datapoints],
    toZigbee: [tuya.tz.datapoints],
    onEvent: tuya.onEventSetTime, // Add this if you are getting no converter for 'commandMcuSyncTime'
    configure: tuya.configureMagicPacket,
    exposes: [
        // Here you should put all functionality that your device exposes
    ],
    meta: {
        // All datapoints go in here
        tuyaDatapoints: [
        ],
    },
};

module.exports = definition;

Supported color modes

No response

Color temperature range

No response

talbx commented 7 months ago

I tried to map the datapoints by my own but the expected log messages weren't showing up in the debug log

github-actions[bot] commented 1 month 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

talbx commented 1 month ago

keep open