Zigbee2mqtt: Support: Xiaomi Aqara Smart Curtain Motor

Created on 19 Aug 2018  Â·  54Comments  Â·  Source: Koenkk/zigbee2mqtt

I've just one small question:
Has someone already tried to use the Xioami Aqara Smart Curtain Motor with zigbee2mqtt and can maybe share the experiences?

new device support

Most helpful comment

@dzungpv Thanks to your PR I managed to get the curtain motor working. I can use "open, "close", "stop" and set the track percentage.

I had to make some changes to make it work in the latest version. I created PR with the curtain motor support based on your PR. Ideally you could merge my changes into your PR and I'll close mine.

See: https://github.com/Koenkk/zigbee-shepherd-converters/pull/170

All 54 comments

If you doesnt found this Information on the device supported Page we havent implement this.
If you in use of this device please follow the Wiki Page ;)

This is how far i got:
in the node_modules/zigbee-shepherd-converters/devices.js add these lines

{ 
    zigbeeModel: ['lumi.curtain'], // The model ID from: Device with modelID 'lumi.sens' is not supported.
    model: 'ZNCLDJ11LM', // Vendor model number, look on the device for a model number
    vendor: 'Aqara', // Vendor of the device (only used for wiki and startup logging)
    description: 'Aqara Curtain Motor ', // Description of the device, copy from vendor site. (only used for wiki and $
    supports: 'Curtain Motor', // Actions this device supports (only used for wiki)
    fromZigbee: [], // We will add this later
    toZigbee: [], // Should be empty, unless device can be controlled (e.g. lights, switches).
   }, 

But now I am struggeling to convert these types:

2018-8-20 22:20:21 DEBUG Recieved zigbee message with data {"cid":"genAnalogOutput","data":{"61440":0,"presentValue":0}}
2018-8-20 22:20:21 WARN No converter available for 'ZNCLDJ11LM' with cid 'genAnalogOutput' and type 'attReport'
2018-8-20 22:20:21 WARN Please see: https://github.com/Koenkk/zigbee2mqtt/wiki/How-to-support-new-devices.
2018-8-20 22:20:21 DEBUG Recieved zigbee message with data {"cid":"genAnalogOutput","data":{"61440":0,"presentValue":0}}
2018-8-20 22:20:21 WARN No converter available for 'ZNCLDJ11LM' with cid 'genAnalogOutput' and type 'devChange'
2018-8-20 22:20:21 WARN Please see: https://github.com/Koenkk/zigbee2mqtt/wiki/How-to-support-new-devices.
2018-8-20 22:20:48 DEBUG Check online 0x000b57fffe4ab8de

Could you post the output when running with log_level: debug (please post on https://pastebin.com)

I didn't know Xiaomi had this product. I was sort of monitoring a kickstarter project but if this one runs over zigbee, I'm sold! :)

@holeandro do you know what the presentValue means, could this be how much the curtains are closed/open?

  zigbee2mqtt:warn 2018-8-21 23:39:22 No converter available for 'ZNCLDJ11LM' with cid 'genAnalogOutput', type 'devChange' and data '{"cid":"genAnalogOutput","data":{"61440":0,"presentValue":100}}'

@Koenkk thank you to look over it, yes you are right presentValue":100 says the percentage of the curtain. Today I wantet to test if 100 is closed or opened and if the "61440":0 :0 changes as well. But sadly my CC2531 USB sniffer disconnects everythim when i fireup zigbee2mqtt

@holeandro, can you confirm the usb device the dongled is maped to, matches what you have configured?

@Koenkk 100 means closed, 0 means opened

@marcgarciamarti thank you for your input. After reboot, trying other ports e.t.c. LED turned off after around 2 Min. and stopped working. After reflashing the firmware the stick is now running for more 20Min. and i was able to get the log. Thanks.

Recieved zigbee message with data {"cid":"genAnalogOutput","data":{"61440":0,"presentValue":0}} Recieved zigbee message with data {"cid":"genAnalogOutput","data":{"61440":0,"presentValue":0}} Recieved zigbee message with data {"cid":"genAnalogOutput","data":{"61440":52272896,"presentValue":44}} Recieved zigbee message with data {"cid":"genAnalogOutput","data":{"presentValue":44}} Recieved zigbee message with data {"cid":"genAnalogOutput","data":{"61440":52272896,"presentValue":78}} Recieved zigbee message with data {"cid":"genAnalogOutput","data":{"61440":52272896,"presentValue":78}}

@holeandro looks great, could you try following: https://github.com/Koenkk/zigbee2mqtt/wiki/How-to-support-new-devices ?

Could you please provide database.db entrys.
Does the presentvalue reportated constant if Closed or opened Action run.
We need open, close and stop converter. We could show what we could Integrate.

@holeandro Please test this:
devices.js entry:

{
zigbeeModel: ['lumi.curtain'],
model: 'ZNCLDJ11LM',
vendor: 'Aqara',
description: 'Aqara Curtain Motor ',
supports: 'Curtain Motor',
fromZigbee: [fz.ignore_genAnalogOutput_change,fz.curtain_PositionLiftPercentage],
toZigbee: [],
},

fromZigbee.js Entrys:

curtain_PositionLiftPercentage: {
        cid: 'genAnalogInput',
        type: 'attReport',
        convert: (model, msg, publish, options) => {
            return {currentPositionLiftPercentage: precisionRound(msg.data.data['presentValue'], 2)};
        },
    },
ignore_genAnalogOutput_change: {
        cid: 'genAnalogOutput',
        type: 'devChange',
        convert: (model, msg, publish, options) => null,
},

If we see your database.db entrys we could check if we could use the genonOff cluster to turn on / off (like do stop).

Please report back :)

@tb-killa
Hi Tb-killa, i hope you can work with that:
https://pastebin.com/ZNe29pxQ

Cheers

I have this device too and fully connected it to zigbee2mqtt, can get 'presentValue'. But this not auto setup in hass, how to set a config for this so i can control the curtain?
Here the database file content: https://pastebin.com/AgtkrjUS

In Xiaomi app it has a open button, a close button, a pause button and a slide to set the position of the curtain. I find this https://www.home-assistant.io/components/cover.mqtt/

I read the guide here: https://github.com/Koenkk/zigbee2mqtt/wiki/MQTT-topics-and-message-structure
and try to send many command and payload but could not control the curtain.
I find someone do in smartthing.
https://community.smartthings.com/t/xiaomi-curtain-dth-partially-openable/126972.

I also use Ubiqua and capture form the original Xiaomi hub.

For the open/close/pause/slide they use write "multi state ouput"/"analog ouput".

The detail sniffer information here, https://pastebin.com/LPiqHzH3 I censored the MAC.

@Koenkk I have make it work like open, close, stop. But for the partly open (example 50%) it not work.
A guy on Smarthing forum could make it work by write command, but i am not know much about javascript and zigbee-shepherd.

They do like this with smarthing: https://raw.githubusercontent.com/shin4299/XiaomiSJ/master/devicetypes/shinjjang/xiaomi-curtain-sj.src/xiaomi-curtain-sj.groovy

        log.debug "Set Level: ${level}%"
        String hex = Integer.toHexString(Float.floatToIntBits(level)).toUpperCase()
        zigbee.writeAttribute(0x000d, 0x0055, 0x39, hex)

0x000d is an Analog Output cluster id. Attribute id 0x0055 is present value of that cluster. 0x39 is datatype, it is float point, single decision, the hex is the value of the percent open.

I see the api zcl-packet write:

        write { attrId, dataType, attrData }

How to produce command like smarthing api in toZigbee?

I also try:

    curtain_dim_test: {
        key: 'dim',
        attr: ['presentValue'],
        convert: (value, message) => {
            return {
                cid: 'genAnalogOutput',
                cmd: '0x02',
                zclData: {
                    presentValue: value,
                },
            };
        },
    },

But for genAnalogOutput i am not see any command so it could write some value to the curtain but not correctly and it does not work.

@kirovilya Can you help me about this https://github.com/Koenkk/zigbee2mqtt/issues/294#issuecomment-419636303

Try this code but not work:

        configure: (ieeeAddr, shepherd, coordinator, callback) => {
                    const device = shepherd.find(ieeeAddr, 1);
                    const actions = [
                        (cb) => device.write('genAnalogOutput', 'presentValue', value.toString(16), function (err, data) {
                                if (!err)
                                        console.log(data);    // 'value'
                                }),
                    ];

                    execute(device, actions, callback);
                },

@dzungpv I do not undestand what can i do? :)

@dzungpv Shouldn´t we use the official zigbee cluster for get them integrate ?
As i see we actually use the genAnalogInput but we also got the right closuresWindowCovering cluster.
From my point of view we should ignore genAnalogInput and use only closuresWindowCovering cluster.
Maybe we need a bind configure part to get them work and reporting.?

What do other people think about this?

@tb-killa Yes i use it like this:

    curtain_windowcoverings: {
        key: 'state',
        attr: ['windowcoverings_state'],
        convert: (value, message) => {// value: 'upOpen','stop','downClose'
            return {
                cid: 'closuresWindowCovering',
                cmd: value,
                zclData: {},
            };
        },
    },

But original hub they don't use standard closuresWindowCovering for partly open, they use genAnalogOutput write. What we can do when manufacturer don't follow the standard? We must do like they do. I am waiting the track for final test the code before submit PR.

Many features not work like original app like set positive/reverse, clear the stroke save in memory, disable/enable manual control, all they use write to genBasic.

Now i can write some device like this https://github.com/Koenkk/zigbee-shepherd-converters/pull/74/commits/107fbe21b2c7ed3fa4a48822559da228722c039f#diff-3e0c275bd41af699153bf59d8dda4a2aR117 but not for this curtain, problem with the datatype: 0x42.
I only decode the raw hex data, but zigbee2mqtt now not support use raw data with write command, must use hex2string convert and when it convert to data but not keep the same format like "0x0000010100080007 " become 10100080007 so it not work.

So we must add function to write raw data to any device like smarting do.

Anyone can help to solve this problem? @kirovilya @Koenkk

I'd love to get this working but I don't understand the mechanics of how the program works. Is there somewhere I can learn this? Need some help to be able to modify the files via #549. This is my first device that I'm trying to get working.

Here's the debug log output after I pair the device:

  zigbee2mqtt:debug 2018-10-28 22:45:08 Received zigbee message of type 'devInterview' with data '"0x00158d0002883cd0"'
  zigbee2mqtt:debug 2018-10-28 22:45:08 Received zigbee message of type 'attReport' with data '{"cid":"genBasic","data":{"modelId":"lumi.curtain","appVersion":1}}' of device 'lumi.curtain' (0x00158d0002883cd0)
  zigbee2mqtt:warn 2018-10-28 22:45:08 Device with modelID 'lumi.curtain' is not supported.
  zigbee2mqtt:warn 2018-10-28 22:45:08 Please see: https://github.com/Koenkk/zigbee2mqtt/wiki/How-to-support-new-devices
  zigbee2mqtt:debug 2018-10-28 22:45:08 Received zigbee message of type 'devInterview' with data '"0x00158d0002883cd0"'
  zigbee2mqtt:debug 2018-10-28 22:45:08 Received zigbee message of type 'devInterview' with data '"0x00158d0002883cd0"'
  zigbee2mqtt:debug 2018-10-28 22:45:08 Received zigbee message of type 'devInterview' with data '"0x00158d0002883cd0"'
  zigbee2mqtt:debug 2018-10-28 22:45:08 Received zigbee message of type 'devInterview' with data '"0x00158d0002883cd0"'
  zigbee2mqtt:debug 2018-10-28 22:45:09 Received zigbee message of type 'devInterview' with data '"0x00158d0002883cd0"'
  zigbee2mqtt:debug 2018-10-28 22:45:09 Received zigbee message of type 'devInterview' with data '"0x00158d0002883cd0"'
  zigbee2mqtt:debug 2018-10-28 22:45:09 Received zigbee message of type 'devInterview' with data '"0x00158d0002883cd0"'
  zigbee2mqtt:debug 2018-10-28 22:45:09 Received zigbee message of type 'attReport' with data '{"cid":"genBasic","data":{"65281":{"3":0,"5":39,"7":"0x0000000000000000","8":4384,"9":256,"100":255}}}' of device 'lumi.curtain' (0x00158d0002883cd0)
  zigbee2mqtt:warn 2018-10-28 22:45:09 Device with modelID 'lumi.curtain' is not supported.
  zigbee2mqtt:warn 2018-10-28 22:45:09 Please see: https://github.com/Koenkk/zigbee2mqtt/wiki/How-to-support-new-devices
  zigbee2mqtt:debug 2018-10-28 22:45:09 Received zigbee message of type 'devInterview' with data '"0x00158d0002883cd0"'
  zigbee2mqtt:debug 2018-10-28 22:45:09 Received zigbee message of type 'devInterview' with data '"0x00158d0002883cd0"'
  zigbee2mqtt:debug 2018-10-28 22:45:09 Received zigbee message of type 'devInterview' with data '"0x00158d0002883cd0"'
  zigbee2mqtt:debug 2018-10-28 22:45:09 Received zigbee message of type 'devInterview' with data '"0x00158d0002883cd0"'
  zigbee2mqtt:debug 2018-10-28 22:45:09 Received zigbee message of type 'devIncoming' with data '"0x00158d0002883cd0"' of device 'lumi.curtain' (0x00158d0002883cd0)
  zigbee2mqtt:info 2018-10-28 22:45:09 Device incoming...
  zigbee2mqtt:info 2018-10-28 22:45:09 MQTT publish, topic: 'zigbee2mqtt/bridge/log', payload: '{"type":"pairing","message":"device incoming"}'
  zigbee2mqtt:warn 2018-10-28 22:45:09 Device with modelID 'lumi.curtain' is not supported.
  zigbee2mqtt:warn 2018-10-28 22:45:09 Please see: https://github.com/Koenkk/zigbee2mqtt/wiki/How-to-support-new-devices
  zigbee2mqtt:debug 2018-10-28 22:45:09 Received zigbee message of type 'devStatus' with data '"online"' of device 'lumi.curtain' (0x00158d0002883cd0)
  zigbee2mqtt:warn 2018-10-28 22:45:09 Device with modelID 'lumi.curtain' is not supported.
  zigbee2mqtt:warn 2018-10-28 22:45:09 Please see: https://github.com/Koenkk/zigbee2mqtt/wiki/How-to-support-new-devices

And the database.db:

{"$$indexCreated":{"fieldName":"id","unique":true,"sparse":false}}
{"id":1,"type":"Coordinator","ieeeAddr":"0x00124b0018ed33fb","nwkAddr":0,"manufId":0,"epList":[1,2,3,4,5,6],"status":"online","joinTime":1540766625,"endpoints":{"1":{"profId":260,"epId":1,"devId":5,"inClusterList":[],"outClusterList":[],"clusters":{}},"2":{"profId":257,"epId":2,"devId":5,"inClusterList":[],"outClusterList":[],"clusters":{}},"3":{"profId":261,"epId":3,"devId":5,"inClusterList":[],"outClusterList":[],"clusters":{}},"4":{"profId":263,"epId":4,"devId":5,"inClusterList":[],"outClusterList":[],"clusters":{}},"5":{"profId":264,"epId":5,"devId":5,"inClusterList":[],"outClusterList":[],"clusters":{}},"6":{"profId":265,"epId":6,"devId":5,"inClusterList":[],"outClusterList":[],"clusters":{}}},"_id":"FFQ7Q8UyKAeRKuTZ"}
{"id":2,"type":"Router","ieeeAddr":"0x00158d0002883cd0","nwkAddr":42825,"manufId":4447,"epList":[1],"status":"online","joinTime":1540766708,"endpoints":{"1":{"profId":260,"epId":1,"devId":514,"inClusterList":[0,1,3,4,5,6,10,13,19,258,1030],"outClusterList":[1,6,10,13,19,25,258,1030],"clusters":{}}},"_id":"j9LsY9gpUGwfgMaM"}
{"id":2,"type":"Router","ieeeAddr":"0x00158d0002883cd0","nwkAddr":42825,"manufId":4447,"manufName":"LUMI","powerSource":"Mains (single phase)","modelId":"lumi.curtain","epList":[1],"status":"online","joinTime":1540766708,"endpoints":{"1":{"profId":260,"epId":1,"devId":514,"inClusterList":[0,1,3,4,5,6,10,13,19,258,1030],"outClusterList":[1,6,10,13,19,25,258,1030],"clusters":{}}},"_id":"j9LsY9gpUGwfgMaM"}
{"id":2,"type":"Router","ieeeAddr":"0x00158d0002883cd0","nwkAddr":42825,"manufId":4447,"manufName":"LUMI","powerSource":"Mains (single phase)","modelId":"lumi.curtain","epList":[1],"status":"online","joinTime":1540766708,"endpoints":{"1":{"profId":260,"epId":1,"devId":514,"inClusterList":[0,1,3,4,5,6,10,13,19,258,1030],"outClusterList":[1,6,10,13,19,25,258,1030],"clusters":{"genBasic":{"dir":{"value":1},"attrs":{"zclVersion":1,"appVersion":32,"stackVersion":2,"hwVersion":17,"manufacturerName":"LUMI","modelId":"lumi.curtain","dateCode":"08-13-2018","powerSource":1}},"genPowerCfg":{"dir":{"value":3},"attrs":{"mainsVoltage":0}},"genIdentify":{"dir":{"value":1},"attrs":{"identifyTime":0}},"genGroups":{"dir":{"value":1},"attrs":{"nameSupport":0}},"genScenes":{"dir":{"value":1},"attrs":{"count":0,"currentScene":0,"currentGroup":0,"sceneValid":0,"nameSupport":0,"lastCfgBy":"0xffffffffffffffff"}},"genOnOff":{"dir":{"value":3},"attrs":{"onOff":0}},"genTime":{"dir":{"value":3},"attrs":{}},"genAnalogOutput":{"dir":{"value":3},"attrs":{"maxPresentValue":0,"minPresentValue":0,"outOfService":0,"presentValue":255,"statusFlags":0}},"genMultistateOutput":{"dir":{"value":3},"attrs":{"numberOfStates":6,"outOfService":0,"presentValue":0,"statusFlags":0}},"genOta":{"dir":{"value":2},"attrs":{}},"closuresWindowCovering":{"dir":{"value":3},"attrs":{"windowCoveringType":4,"configStatus":123,"currentPositionLiftPercentage":255,"windowCoveringMode":0}},"msOccupancySensing":{"dir":{"value":3},"attrs":{"occupancy":0,"occupancySensorType":0}}}}},"_id":"j9LsY9gpUGwfgMaM"}

Posting my debug with updated devices.js per #549:

zigbee2mqtt:info 2018-10-30 15:19:07 Logging to directory: 'data/log/2018-10-30.22-19-07'
zigbee2mqtt:debug 2018-10-30 15:19:07 Removing old log directory 'data/log/2018-10-30.22-01-31'
zigbee2mqtt:debug 2018-10-30 15:19:07 Using zigbee-shepherd with settings: '{"net":{"panId":6754,"channelList":[11]},"dbPath":"/app/data/database.db","sp":{"baudRate":115200,"rtscts":true}}'
zigbee2mqtt:debug 2018-10-30 15:19:07 Loaded state from file /app/data/state.json
zigbee2mqtt:info 2018-10-30 15:19:07 Starting zigbee2mqtt version 0.1.8 (commit #97cc56b)
zigbee2mqtt:info 2018-10-30 15:19:07 Starting zigbee-shepherd
zigbee2mqtt:info 2018-10-30 15:19:08 zigbee-shepherd started
zigbee2mqtt:info 2018-10-30 15:19:08 Coordinator firmware version: '20180815'
zigbee2mqtt:debug 2018-10-30 15:19:08 zigbee-shepherd info: {"enabled":true,"net":{"state":"Coordinator","channel":11,"panId":"0x1a62","extPanId":"0xdddddddddddddddd","ieeeAddr":"0x00124b0018ed33fb","nwkAddr":0},"firmware":{"transportrev":2,"product":0,"version":"2.6.3","revision":20180815},"startTime":1540937948,"joinTimeLeft":0}
zigbee2mqtt:info 2018-10-30 15:19:08 Currently 1 devices are joined:
zigbee2mqtt:info 2018-10-30 15:19:08 unknown (0x00158d0002883cd0): ZNCLDJ11LM - Aqara Aqara Curtain Motor  (Router)
zigbee2mqtt:info 2018-10-30 15:19:08 Zigbee: disabling joining new devices.
zigbee2mqtt:info 2018-10-30 15:19:08 Connecting to MQTT server at mqtt://192.168.1.100
zigbee2mqtt:debug 2018-10-30 15:19:08 Using MQTT client ID: 'zigbee2mqtt_docker'
zigbee2mqtt:info 2018-10-30 15:19:08 zigbee-shepherd ready
zigbee2mqtt:info 2018-10-30 15:19:08 Connected to MQTT server
zigbee2mqtt:info 2018-10-30 15:19:08 MQTT publish, topic: 'zigbee2mqtt/bridge/state', payload: 'online'
zigbee2mqtt:debug 2018-10-30 15:19:08 Soft reset timeout disabled
zigbee2mqtt:debug 2018-10-30 15:20:08 Check online unknown 0x00158d0002883cd0
zigbee2mqtt:debug 2018-10-30 15:21:08 Check online unknown 0x00158d0002883cd0
zigbee2mqtt:debug 2018-10-30 15:22:08 Check online unknown 0x00158d0002883cd0
zigbee2mqtt:debug 2018-10-30 15:23:08 Check online unknown 0x00158d0002883cd0
zigbee2mqtt:debug 2018-10-30 15:24:07 Saving state to file /app/data/state.json
zigbee2mqtt:debug 2018-10-30 15:24:08 Check online unknown 0x00158d0002883cd0
zigbee2mqtt:debug 2018-10-30 15:25:08 Check online unknown 0x00158d0002883cd0

@dzungpv If i remebre corretly, you were able to open and close the curtain, what was the magic, but you are waiting for raw functionality to configure the curtain as with the original APP?

Does the open close function work as a ‘go to XX %’ command or is it really
just open and close with no mid controls?

On Sun, Nov 4, 2018 at 12:56 PM holeandro notifications@github.com wrote:

@dzungpv https://github.com/dzungpv If i remebre corretly, you were
able to open and close the curtain, what was the magic, but you are waiting
for raw functionality to configure the curtain as with the original APP?

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/Koenkk/zigbee2mqtt/issues/294#issuecomment-435705188,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AQFpUexoyAS6rH9-33wPIoOFXgw7UG9fks5ur1SZgaJpZM4WDCbz
.

any updates on this?

I've given up and am using the aqara hub as I don't have the programing skills to make any additions.

On Dec 14, 2018, at 5:54 PM, greynoO notifications@github.com wrote:

any updates on this?

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.

@dzungpv Thanks to your PR I managed to get the curtain motor working. I can use "open, "close", "stop" and set the track percentage.

I had to make some changes to make it work in the latest version. I created PR with the curtain motor support based on your PR. Ideally you could merge my changes into your PR and I'll close mine.

See: https://github.com/Koenkk/zigbee-shepherd-converters/pull/170

@Evildime @dzungpv
Thank you very much for your work.
A kind of a chrismas present for me.

The device is supported now in the dev branch.

For Home Assistant users: this device also supports position, something which is not yet discovered by zigbee2mqtt (as I don't have the device I cannot test this).

Could somebody make a PR for this? This has to be extended based on this.

Shout-out to @dzungpv and @Evildime for making this work!

@Koenkk I spend the last two hours trying to integrate the position in Home Assistent but was not able to figure out how to exactly modify the homeassistant.js.

The Curtain is discovered in Home Assistant without issues and I can open, close and stop it's movement without any configuration. Also the position is correctly reported.

I tried adding the lines
position_topic: true,
set_position_topic: true,
set_position_template: '{{ value_json.position }}'

within the cover configuration but that does not seem to work. As I'm not really using Home Assistant I'm happy to try suggestions but have to little experience to make it work.

@evildime no problem, somebody else in this thread probably has more experience. thanks again!

FYI: Xiaomi will release a new Curtain Motor with a battery.
https://de.aliexpress.com/af/aqara-B1.html?SearchText=aqara+B1

the cover.set_cover_position service in Home Assistant does not seem to work with this?
Open, close and stop works fine!

Can you check with the latest dev branch? Note that after updating and starting zigbee2mqtt you need to restart home assistant. The position slider should also show up in home assistant now.

I would love to but I get this error when using the edge-version addon:

  zigbee2mqtt:info 2/24/2019, 11:03:30 PM MQTT publish: topic 'homeassistant/sensor/0x00158d0002752f2d/linkquality/config', payload '{"unit_of_measurement":"-","value_template":"{{ value_json.linkquality }}","state_topic":"zigbee2mqtt/0x00158d0002752f2d","json_attributes_topic":"zigbee2mqtt/0x00158d0002752f2d","name":"0x00158d0002752f2d_linkquality","unique_id":"0x00158d0002752f2d_linkquality_zigbee2mqtt","device":{"identifiers":"zigbee2mqtt_0x00158d0002752f2d","name":"0x00158d0002752f2d","sw_version":"Zigbee2mqtt 1.1.1","model":"Aqara door & window contact sensor (MCCGQ11LM)","manufacturer":"Xiaomi"},"availability_topic":"zigbee2mqtt/bridge/state"}'
/app/lib/extension/homeassistant.js:593
            const topic = `${config.type}/${entityID}/${config.object_id}/config`;
                                    ^
TypeError: Cannot read property 'type' of undefined
    at mapping.(anonymous function).forEach (/app/lib/extension/homeassistant.js:593:37)
    at Array.forEach (<anonymous>)
    at HomeAssistant.discover (/app/lib/extension/homeassistant.js:592:36)
    at zigbee.getAllClients.forEach (/app/lib/extension/homeassistant.js:573:22)
    at Array.forEach (<anonymous>)
    at HomeAssistant.onMQTTConnected (/app/lib/extension/homeassistant.js:570:37)
    at extensions.filter.forEach (/app/lib/controller.js:83:75)
    at Array.forEach (<anonymous>)
    at Controller.onMQTTConnected (/app/lib/controller.js:83:58)
    at MqttClient.client.on (/app/lib/mqtt.js:44:13)
npm
 ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: `node index.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

@greynoO sorry, made a typo, should be fixed now.

@greynoO sorry, made a typo, should be fixed now.

still the same error TypeError: Cannot read property 'type' of undefined unfortunately!

Are you sure you are running the latest -edge?

It is working now, after I installed it again (maybe you did some changes in the meantime? Didn't check it!)

I noticed that the related arrows are disabled now, if the cover is opened / closed. But this is not reliable (at least for me), so whenever a curtain is closed, sometimes the arrow is disabled, sometimes it's not. I even had the situation that a curtain is closed and I cannot reopen it with the arrow because it's disabled.

BUT I noticed that everything is fine if I open/close it with the position slider. So my suggestion would be to use the set position functionality for fully opening (100) and closing (0) the cover?

The window icon does not change when using the arrows (which worked previously) but when using the slider it does correctly.

Also I have 4 motors but only 2 of them have the slider?

Using the position slider to open/close is not something that can be influenced by zigbee2mqtt. Could you find out how to reproduce it?

I mean you could map the open / close to directly set the position in the code instead of using the other code snippet that uses the "real" open/close operation? Now that this functionality is ported to the main branch I have this problem constantly :(

I could map the arrow button to set the position instead of close/open, however when these are disabled you cannot use them?

Could you provide the logging when you run in a problematic situation?

No, not map position to the arrows, only position(0) for close and position(100) for open as currently this is the only way to reliably get the correct state as it seems!

Logging from the Hass.io addon?

E.g. now I closed the curtain with the down arrow. The up arrow is still deactivated (down arrow still active) and when opening the slider, it is on 100 but should be on 0.

zigbee2mqtt:info 3/18/2019, 5:03:15 PM Zigbee publish to device '0x00158d0002b0b41b', closuresWindowCovering - downClose - {} - {"manufSpec":0,"disDefaultRsp":0} - null

Another curtain is completely closed, up arrow still deactivated (down still activated) and the slider is on 85 when I look it up.

Can you provide the complete zigbee2mqtt logging when setting the position and having the deactivated arrow. (with log_level: debug, http://www.zigbee2mqtt.io/configuration/configuration.html)

This was done using the edge addon:

Curtain is fully open. Just using the down arrow gives me this log:

zigbee2mqtt:debug 3/19/2019, 7:49:42 PM Received MQTT message on 'zigbee2mqtt/0x00158d0002b09378/set' with data 'CLOSE'
  zigbee2mqtt:info 3/19/2019, 7:49:42 PM Zigbee publish to device '0x00158d0002b09378', closuresWindowCovering - downClose - {} - {"manufSpec":0,"disDefaultRsp":0} - null
  zigbee2mqtt:debug 3/19/2019, 7:49:43 PM Received zigbee message of type 'attReport' with data '{"cid":"genBasic","data":{"1028":2}}' of device 'lumi.curtain' (0x00158d0002b09378)
  zigbee2mqtt:debug 3/19/2019, 7:49:43 PM Received zigbee message of type 'devChange' with data '{"cid":"genBasic","data":{"1028":2}}' of device 'lumi.curtain' (0x00158d0002b09378)
  zigbee2mqtt:debug 3/19/2019, 7:49:49 PM Received zigbee message of type 'attReport' with data '{"cid":"genBasic","data":{"1028":4}}' of device 'lumi.curtain' (0x00158d0002b09378)
  zigbee2mqtt:debug 3/19/2019, 7:49:49 PM Received zigbee message of type 'devChange' with data '{"cid":"genBasic","data":{"1028":4}}' of device 'lumi.curtain' (0x00158d0002b09378)
  zigbee2mqtt:debug 3/19/2019, 7:49:49 PM Received zigbee message of type 'attReport' with data '{"cid":"closuresWindowCovering","data":{"currentPositionLiftPercentage":14}}' of device 'lumi.curtain' (0x00158d0002b09378)
  zigbee2mqtt:debug 3/19/2019, 7:49:49 PM Received zigbee message of type 'devChange' with data '{"cid":"closuresWindowCovering","data":{"currentPositionLiftPercentage":14}}' of device 'lumi.curtain' (0x00158d0002b09378)

Problem: Arrow status is not updated (up stays inactive, down stays active), Slider stays on 100.
currentPositionLiftPercentage just seems to be wrong here. The curtain is fully closed, but maybe the motor just reports it wrong? I may note that in previous versions the icon (opened/closed) was toggled perfectly when just using the arrows! Not anymore.

/edit: nope, here currentPositionLiftPercentage is reported as 0 but same problem:

zigbee2mqtt:debug 3/19/2019, 8:13:02 PM Received MQTT message on 'zigbee2mqtt/0x00158d0002b09378/set' with data 'CLOSE'
  zigbee2mqtt:info 3/19/2019, 8:13:02 PM Zigbee publish to device '0x00158d0002b09378', closuresWindowCovering - downClose - {} - {"manufSpec":0,"disDefaultRsp":0} - null
  zigbee2mqtt:debug 3/19/2019, 8:13:03 PM Received zigbee message of type 'attReport' with data '{"cid":"genBasic","data":{"1028":2}}' of device 'lumi.curtain' (0x00158d0002b09378)
  zigbee2mqtt:debug 3/19/2019, 8:13:03 PM Received zigbee message of type 'devChange' with data '{"cid":"genBasic","data":{"1028":2}}' of device 'lumi.curtain' (0x00158d0002b09378)
  zigbee2mqtt:debug 3/19/2019, 8:13:07 PM Received zigbee message of type 'attReport' with data '{"cid":"genBasic","data":{"1028":0}}' of device 'lumi.curtain' (0x00158d0002b09378)
  zigbee2mqtt:debug 3/19/2019, 8:13:07 PM Received zigbee message of type 'devChange' with data '{"cid":"genBasic","data":{"1028":0}}' of device 'lumi.curtain' (0x00158d0002b09378)
  zigbee2mqtt:debug 3/19/2019, 8:13:07 PM Received zigbee message of type 'attReport' with data '{"cid":"closuresWindowCovering","data":{"currentPositionLiftPercentage":0}}' of device 'lumi.curtain' (0x00158d0002b09378)
  zigbee2mqtt:debug 3/19/2019, 8:13:07 PM Received zigbee message of type 'devChange' with data '{"cid":"closuresWindowCovering","data":{"currentPositionLiftPercentage":0}}' of device 'lumi.curtain' (0x00158d0002b09378)

Now closing with the position slider (using another curtain motor, by setting it to 0).
Here the arrows get updated correctly:

zigbee2mqtt:debug 3/19/2019, 7:55:27 PM Received zigbee message of type 'attReport' with data '{"cid":"genAnalogOutput","data":{"61440":0,"presentValue":0}}' of device 'lumi.curtain' (0x00158d0002b0b41b)
  zigbee2mqtt:info 3/19/2019, 7:55:27 PM MQTT publish: topic 'zigbee2mqtt/0x00158d0002b0b41b', payload '{"state":"CLOSE","position":0,"running":false,"linkquality":68}'
  zigbee2mqtt:debug 3/19/2019, 7:55:27 PM Received zigbee message of type 'devChange' with data '{"cid":"genAnalogOutput","data":{"61440":0}}' of device 'lumi.curtain' (0x00158d0002b0b41b)
  zigbee2mqtt:info 3/19/2019, 7:55:27 PM MQTT publish: topic 'zigbee2mqtt/0x00158d0002b0b41b', payload '{"state":"CLOSE","position":null,"running":false,"linkquality":68}'

I also noticed that the slider is not updated when using an arrow and then the stop button midway:

zigbee2mqtt:info 3/19/2019, 8:01:43 PM MQTT publish: topic 'zigbee2mqtt/0x00158d0002b09378', payload '{"state":"CLOSE","position":0,"running":true,"linkquality":42}'
  zigbee2mqtt:debug 3/19/2019, 8:01:43 PM Received zigbee message of type 'devChange' with data '{"cid":"genAnalogOutput","data":{"61440":63202560}}' of device 'lumi.curtain' (0x00158d0002b09378)
  zigbee2mqtt:info 3/19/2019, 8:01:43 PM MQTT publish: topic 'zigbee2mqtt/0x00158d0002b09378', payload '{"state":"CLOSE","position":null,"running":true,"linkquality":42}'
  zigbee2mqtt:debug 3/19/2019, 8:01:43 PM Received zigbee message of type 'devChange' with data '{"cid":"closuresWindowCovering","data":{"currentPositionLiftPercentage":0}}' of device 'lumi.curtain' (0x00158d0002b09378)
  zigbee2mqtt:debug 3/19/2019, 8:01:45 PM Received MQTT message on 'zigbee2mqtt/0x00158d0002b09378/set' with data 'STOP'
  zigbee2mqtt:info 3/19/2019, 8:01:45 PM Zigbee publish to device '0x00158d0002b09378', closuresWindowCovering - stop - {} - {"manufSpec":0,"disDefaultRsp":0} - null
  zigbee2mqtt:debug 3/19/2019, 8:01:45 PM Received zigbee message of type 'devChange' with data '{"cid":"closuresWindowCovering","data":{"currentPositionLiftPercentage":23}}' of device 'lumi.curtain' (0x00158d0002b09378)
  zigbee2mqtt:debug 3/19/2019, 8:01:46 PM Received zigbee message of type 'attReport' with data '{"cid":"genBasic","data":{"1028":0}}' of device 'lumi.curtain' (0x00158d0002b09378)
  zigbee2mqtt:debug 3/19/2019, 8:01:46 PM Received zigbee message of type 'devChange' with data '{"cid":"genBasic","data":{"1028":0}}' of device 'lumi.curtain' (0x00158d0002b09378)
  zigbee2mqtt:debug 3/19/2019, 8:01:46 PM Received zigbee message of type 'attReport' with data '{"cid":"closuresWindowCovering","data":{"currentPositionLiftPercentage":31}}' of device 'lumi.curtain' (0x00158d0002b09378)
  zigbee2mqtt:debug 3/19/2019, 8:01:46 PM Received zigbee message of type 'devChange' with data '{"cid":"closuresWindowCovering","data":{"currentPositionLiftPercentage":31}}' of device 'lumi.curtain' (0x00158d0002b09378)

Although the currentPositionLiftPercentage is received!

@greynoO thanks for the detailed logging! the position converter was missing, added that now.

Can you check with the latest edge? (wait 3 hours before trying this)

Thank you very much, it's working fine now! Although I would still suggest to use position(0) and position(100) for downClose and openUp. As at least for me the motors do not always report 0 or 100 back initially (I have four motors). Eventually they do, if I click on the arrow again for 1-2 times. This would solve this problem and I don't see a downside to it?

@greynoO done! please check latest dev branch (or edge in +- 2 hours).

Could somebody with the original gateway sniff the packets when setting the track direction? Your help is greatly appreciated. (See https://github.com/Koenkk/zigbee2mqtt/issues/1639#issuecomment-502443362).

can someone help me please to integrate ZNCLDJ11LM in HA? I'm using ZNCLDJ11LM cover.curtain_158d0004117c61 in lovelace, I see a state of curtain but nothing happens when i click on arrow
HA log:
ERROR (SyncWorker_4) [xiaomi_gateway] Got error element in data {"error":"Invalid key"}

Was this page helpful?
0 / 5 - 0 ratings