Koenkk / zigbee2mqtt

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

[New device support]: ZigbeeModel: TS0601, Zigbee Manufacturer: _TZE204_nklqjk62 #18633

Closed Twiistz closed 1 year ago

Twiistz commented 1 year ago

Link

https://www.aliexpress.com/item/1005005408244662.html?spm=a2g0o.productlist.main.1.1e6b76det9vY8u&algo_pvid=37317f1a-da25-42d6-b117-8e804a81c959&algo_exp_id=37317f1a-da25-42d6-b117-8e804a81c959-0&pdp_npi=4%40dis%21DKK%21287.95%21133.2%21%21%21307.28%21%21%402101d8b516922084668336921e680b%2112000032981943354%21sea%21DK%210%21A&curPageLogUid=PjaRT3WzDqgh

Database entry

{"id":32,"type":"Router","ieeeAddr":"0xa4c138056d02e8c6","nwkAddr":6587,"manufId":4417,"manufName":"_TZE204_nklqjk62","powerSource":"Mains (single phase)","modelId":"TS0601","epList":[1,242],"endpoints":{"1":{"profId":260,"epId":1,"devId":81,"inClusterList":[4,5,61184,0],"outClusterList":[25,10],"clusters":{"genBasic":{"attributes":{"65506":56,"65508":0,"65534":0,"modelId":"TS0601","manufacturerName":"_TZE204_nklqjk62","powerSource":1,"zclVersion":3,"appVersion":74,"stackVersion":0,"hwVersion":1,"dateCode":""}}},"binds":[{"cluster":0,"type":"endpoint","deviceIeeeAddress":"0x00124b0024c9ede4","endpointID":1}],"configuredReportings":[],"meta":{}},"242":{"profId":41440,"epId":242,"devId":97,"inClusterList":[],"outClusterList":[33],"clusters":{},"binds":[],"configuredReportings":[],"meta":{}}},"appVersion":74,"stackVersion":0,"hwVersion":1,"dateCode":"","zclVersion":3,"interviewCompleted":true,"meta":{"configured":132068476},"lastSeen":1692207669530,"defaultSendRequestWhen":"immediate"}

Comments

The devices is the same as https://www.zigbee2mqtt.io/devices/PJ-ZGD01.html, but the Zigbee Manufacturer ID was different than the ones I could find here: https://github.com/Koenkk/zigbee-herdsman-converters/blob/master/src/devices/tuya.ts

External converter

This seems to work:

const legacy = require('zigbee-herdsman-converters/lib/legacy');
const tuya = require('zigbee-herdsman-converters/lib/tuya');
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 definition = {
    zigbeeModel: ['TS0601'], // The model ID from: Device with modelID 'lumi.sens' is not supported.
    model: '_TZE204_nklqjk62', // Vendor model number, look on the device for a model number
    vendor: 'TuYa', // Vendor of the device (only used for documentation and startup logging)
    description: 'Garage door opener', // Description of the device, copy from vendor site. (only used for documentation and startup logging)
    fromZigbee: [legacy.fromZigbee.matsee_garage_door_opener, fz.ignore_basic_report], // We will add this later
    toZigbee: [legacy.toZigbee.matsee_garage_door_opener, legacy.toZigbee.tuya_data_point_test], // Should be empty, unless device can be controlled (e.g. lights, switches).
    whiteLabel: [{vendor: 'MatSee Plus', model: 'PJ-ZGD01'}],
    configure: async (device, coordinatorEndpoint, logger) => {
        await tuya.configureMagicPacket(device, coordinatorEndpoint, logger);
        const endpoint = device.getEndpoint(1);
        await reporting.bind(endpoint, coordinatorEndpoint, ['genBasic']);
    },
    exposes: [e.binary('trigger', ea.STATE_SET, true, false).withDescription('Trigger the door movement'),
    e.binary('garage_door_contact', ea.STATE, true, false)], // Defines what this device exposes, used for e.g. Home Assistant discovery and in the frontend
};

module.exports = definition;

Supported color modes

No response

Color temperature range

No response

Koenkk commented 1 year ago

Added!

Changes will be available in the dev branch in a few hours from now. (https://www.zigbee2mqtt.io/advanced/more/switch-to-dev-branch.html)

fmnamado commented 1 year ago

Hello,

I just received my Garage Door Opener and when I try to pair it, I got the unsuported message. It has never happened to me before, and I chose this hardware because I thought it was supported. Now I understand that it must be a different revision.

I got the message in the notification during pairing and I saw the model is slightly different.

Is as it is in this thread.

'_TZE204_nklqjk62'

I am running my z2m via docker container.

I tried the following: 1- As described in this thread, https://github.com/Koenkk/zigbee2mqtt/issues/18474, i created a PJ-ZGD01.js and referenced it in the configuration.yaml of z2m. Restarted the container. Gave me this error

Zigbee2MQTT:debug 2023-09-14 12:48:16: Received MQTT message on 'homeassistant/sensor/0xa4c138aa5d85f379/linkquality/config' with data '{"availability":[{"topic":"zigbee2mqtt/bridge/state","value_template":"{{ value_json.state }}"},{"topic":"zigbee2mqtt/Sirene.Hall/availability","value_template":"{{ value_json.state }}"}],"availability_mode":"all","device":{"identifiers":["zigbee2mqtt_0xa4c138aa5d85f379"],"manufacturer":"Neo","model":"Alarm (NAS-AB02B2)","name":"Sirene.Hall"},"enabled_by_default":false,"entity_category":"diagnostic","icon":"mdi:signal","name":"Linkquality","object_id":"sirene.hall_linkquality","origin":{"name":"Zigbee2MQTT","sw":"1.33.0","url":"https://www.zigbee2mqtt.io"},"state_class":"measurement","state_topic":"zigbee2mqtt/Sirene.Hall","unique_id":"0xa4c138aa5d85f379_linkquality_zigbee2mqtt","unit_of_measurement":"lqi","value_template":"{{ value_json.linkquality }}"}'
Zigbee2MQTT:debug 2023-09-14 12:48:16: Received MQTT message on 'homeassistant/sensor/0xa4c138aa5d85f379/last_seen/config' with data '{"availability":[{"topic":"zigbee2mqtt/bridge/state","value_template":"{{ value_json.state }}"},{"topic":"zigbee2mqtt/Sirene.Hall/availability","value_template":"{{ value_json.state }}"}],"availability_mode":"all","device":{"identifiers":["zigbee2mqtt_0xa4c138aa5d85f379"],"manufacturer":"Neo","model":"Alarm (NAS-AB02B2)","name":"Sirene.Hall"},"device_class":"timestamp","enabled_by_default":false,"entity_category":"diagnostic","icon":"mdi:clock","name":"Last seen","object_id":"sirene.hall_last_seen","origin":{"name":"Zigbee2MQTT","sw":"1.33.0","url":"https://www.zigbee2mqtt.io"},"state_topic":"zigbee2mqtt/Sirene.Hall","unique_id":"0xa4c138aa5d85f379_last_seen_zigbee2mqtt","value_template":"{{ value_json.last_seen }}"}'
Zigbee2MQTT:debug 2023-09-14 12:51:19: Saving state to file /app/data/state.json
Using '/app/data' as data directory
/app/data/extension/externally-loaded.js:17
    toZigbee: [legacy.toZigbee.matsee_garage_door_opener, legacy.toZigbee.tuya_data_point_test],
                               ^
TypeError: Cannot read properties of undefined (reading 'matsee_garage_door_opener')
    at /app/data/extension/externally-loaded.js:17:32
    at Script.runInContext (node:vm:141:12)
    at Script.runInNewContext (node:vm:146:17)
    at Object.runInNewContext (node:vm:300:38)
    at loadModuleFromText (/app/lib/util/utils.ts:150:8)
    at loadModuleFromFile (/app/lib/util/utils.ts:157:12)
    at Object.getExternalConvertersDefinitions (/app/lib/util/utils.ts:167:25)
    at getExternalConvertersDefinitions.next (<anonymous>)
    at new ExternalConverters (/app/lib/extension/externalConverters.ts:12:20)
    at new Controller (/app/lib/controller.ts:84:58)

The container doesn't start this way. it is in reboot loop I removed the external converter mention, the container starts ok.

2- As you mention to change to the latest dev, I changed it i went to my docker compose file it was

zigbee2mqtt: container_name: zigbee2mqtt_2_garagem image: koenkk/zigbee2mqtt

i changed to

zigbee2mqtt: container_name: zigbee2mqtt_2_garagem image: koenkk/zigbee2mqtt:latest-dev

now the container starts the device is added and recognized (image etc), but not 100% good yet. in the logs

Zigbee2MQTT:debug 2023-09-14 13:00:29: Received MQTT message on 'homeassistant/sensor/0xa4c1382571d7a1c1/linkquality/config' with data '{"availability":[{"topic":"zigbee2mqtt_garagem/bridge/state","value_template":"{{ value_json.state }}"},{"topic":"zigbee2mqtt_garagem/garagemzigbee/availability","value_template":"{{ value_json.state }}"}],"availability_mode":"all","device":{"identifiers":["zigbee2mqtt_0xa4c1382571d7a1c1"],"manufacturer":"TuYa","model":"Garage door opener (PJ-ZGD01)","name":"garagemzigbee"},"enabled_by_default":false,"entity_category":"diagnostic","icon":"mdi:signal","name":"Linkquality","object_id":"garagemzigbee_linkquality","origin":{"name":"Zigbee2MQTT","sw":"1.33.0-dev","url":"https://www.zigbee2mqtt.io"},"state_class":"measurement","state_topic":"zigbee2mqtt_garagem/garagemzigbee","unique_id":"0xa4c1382571d7a1c1_linkquality_zigbee2mqtt_garagem","unit_of_measurement":"lqi","value_template":"{{ value_json.linkquality }}"}' Zigbee2MQTT:debug 2023-09-14 13:00:29: Received MQTT message on 'homeassistant/binary_sensor/0xa4c1382571d7a1c1/garage_door_contact/config' with data '{"availability":[{"topic":"zigbee2mqtt_garagem/bridge/state","value_template":"{{ value_json.state }}"},{"topic":"zigbee2mqtt_garagem/garagemzigbee/availability","value_template":"{{ value_json.state }}"}],"availability_mode":"all","device":{"identifiers":["zigbee2mqtt_0xa4c1382571d7a1c1"],"manufacturer":"TuYa","model":"Garage door opener (PJ-ZGD01)","name":"garagemzigbee"},"device_class":"garage_door","object_id":"garagemzigbee_garage_door_contact","origin":{"name":"Zigbee2MQTT","sw":"1.33.0-dev","url":"https://www.zigbee2mqtt.io"},"payload_off":true,"payload_on":false,"state_topic":"zigbee2mqtt_garagem/garagemzigbee","unique_id":"0xa4c1382571d7a1c1_garage_door_contact_zigbee2mqtt_garagem","value_template":"{{ value_json.garage_door_contact }}"}' Zigbee2MQTT:debug 2023-09-14 13:00:29: Received MQTT message on 'homeassistant/switch/0xa4c1382571d7a1c1/switch_trigger/config' with data '{"availability":[{"topic":"zigbee2mqtt_garagem/bridge/state","value_template":"{{ value_json.state }}"},{"topic":"zigbee2mqtt_garagem/garagemzigbee/availability","value_template":"{{ value_json.state }}"}],"availability_mode":"all","command_topic":"zigbee2mqtt_garagem/garagemzigbee/set/trigger","device":{"identifiers":["zigbee2mqtt_0xa4c1382571d7a1c1"],"manufacturer":"TuYa","model":"Garage door opener (PJ-ZGD01)","name":"garagemzigbee"},"name":"Trigger","object_id":"garagemzigbee_trigger","origin":{"name":"Zigbee2MQTT","sw":"1.33.0-dev","url":"https://www.zigbee2mqtt.io"},"payload_off":"false","payload_on":"true","state_topic":"zigbee2mqtt_garagem/garagemzigbee","unique_id":"0xa4c1382571d7a1c1_switch_trigger_zigbee2mqtt_garagem","value_template":"{% if value_json.trigger %} true {% else %} false {% endif %}"}' Zigbee2MQTT:info 2023-09-14 13:00:29: Configuring 'garagemzigbee'

In z2m webgui exposes section there is only trigger true or false and linquality in home assistatant, mqtt integration there is a trigger with a toggle i can't select and a sensor, garage door unavailable

what am I doing wrong?

thank you very much

fmnamado commented 1 year ago

Can someone help me out? Thank you!

Twiistz commented 1 year ago

@fmnamado

I don't know if I can help you..

I'm running version 1.33.0-1.

I'm still using my external_converter with the following in configuration.yaml: image Where the door_controller.js is located in the same folder as configuration.yaml and contains: image

After that I restarted Z2M, and added my garage door sensor to my Zigbee Network.

fmnamado commented 1 year ago

Can you please post a prinscreen of the expose tab of your zigbee tuya garage door device? To see what identities if exposes.

Thank you

Twiistz commented 1 year ago

@fmnamado image

fmnamado commented 1 year ago

Thank you for your help. Before I hate the trigger, which wasn't "clickable" and where it says false (the gate status) it said null.

I tried several things ,several combinations like:

Now it is working, but I don't know which one solved it. I will only messe with it in some time (disabling the external converter, then reverting from dev build)

thank you for your help :D