Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AduroSmart Eria #939

Closed
gi-el opened this issue Jan 25, 2019 · 22 comments
Closed

AduroSmart Eria #939

gi-el opened this issue Jan 25, 2019 · 22 comments

Comments

@gi-el
Copy link
Contributor

gi-el commented Jan 25, 2019

Hi!

I'm in the process of adding support for AduroSmart Eria devices. I have a wireless switch and some lamps. At the moment I'm running into two issues, that might be related.

Zigbee2mqtt is running in a Docker container with the image koenkk/zigbee2mqtt:1.0.1-arm32v6.

First, the switch. I managed to pair it, and add some lines in devices.js. Now, when zigbee2mqtt starts, at least I see:
0x00158d000198d02e (0x00158d000198d02e): 81825 - AduroSmart Eria wireless dimming switch (EndDevice)

However, any button press results in:

/app/node_modules/zcl-packet/lib/functional.js:27
        throw new Error('Unrecognized cluster');
        ^

Error: Unrecognized cluster
    at new FuncPayload (/app/node_modules/zcl-packet/lib/functional.js:27:15)
    at /app/node_modules/zcl-packet/lib/zcl.js:33:22
    at Dissolve.<anonymous> (/app/node_modules/zcl-packet/lib/zcl.js:121:9)
    at Object.onceWrapper (events.js:315:30)
    at emitOne (events.js:116:13)
    at Dissolve.emit (events.js:211:7)
    at Dissolve.<anonymous> (/app/node_modules/dissolve-chunks/index.js:73:29)
    at emitNone (events.js:106:13)
    at Dissolve.emit (events.js:208:7)
    at emitReadable_ (/app/node_modules/dissolve/node_modules/readable-stream/lib/_stream_readable.js:456:10)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! zigbee2mqtt@1.0.1 start: `node index.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the zigbee2mqtt@1.0.1 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2019-01-25T22_37_27_505Z-debug.log

As per #852 (comment) I've added the console.log line in af.js, but no more logging appears.

The second issue is that I cannot pair the lamps at all. When I put one in pairing mode (and the lamp confirms so by flashing as per the user manual), nothing happens on the zigbee2mqtt side. Not sure what to do next here.

Any help is appreciated. These devices seem a good cheap alternative to Philips Hue lamps - and more importantly (to me) they claim a CRI of 90, so the white light should be of better quality.

@gi-el
Copy link
Contributor Author

gi-el commented Jan 25, 2019

With some logging in zcl-packet/lib/functional.js it looks like clusterID is 64716.

@gi-el
Copy link
Contributor Author

gi-el commented Jan 26, 2019

I'm able to pair with the lamps if they are really close to the controller - did not realize that was an issue as I never encountered that with ZWave.

The lamp shows up as ZLL-ExtendedColo, which makes me believe it's Zigbee Light Link. However, when I use the generic.light_onoff_brightness_colortemp_colorxy convertors, messages sent are timed out, and no messages seem to be received. When the lamp is turned on, the log shows only this:

zigbee-shepherd spinlock: false []
zigbee-shepherd Device: 0x00158d0001a5bad8 already in network
zigbee-shepherd:msgHdlr IND <-- ZDO:endDeviceAnnceInd
zigbee2mqtt:debug 2019-1-26 08:26:38 Check online 0x00158d0001a5bad8 0x00158d0001a5bad8
zigbee-shepherd:request REQ --> ZDO:nodeDescReq
zigbee-shepherd:msgHdlr IND <-- ZDO:nodeDescRsp

I put in a Home Assistant mapping, and the light shows up as 'off', as no messages about its status are received or sent. Trying to turn the light 'on' (while it in reality already is on):

zigbee2mqtt:debug 2019-1-26 08:46:06 Received MQTT message on 'zigbee2mqtt/0x00158d0001a5bad8/set' with data '{"state": "ON"}'
zigbee2mqtt:info 2019-1-26 08:46:06 Zigbee publish to '0x00158d0001a5bad8', genOnOff - on - {} - {"manufSpec":0,"disDefaultRsp":0} - null
zigbee-shepherd:request REQ --> AF:dataRequest, transId: 19
zigbee-shepherd:request RSP <-- AF:dataRequest, status: 0
zigbee-shepherd:af dispatchIncomingMsg(): type: dataConfirm, msg: [object Object]
zigbee-shepherd:msgHdlr IND <-- AF:dataConfirm, transId: 19
zigbee2mqtt:error 2019-1-26 08:46:36 Zigbee publish to '0x00158d0001a5bad8', genOnOff - on - {} - {"manufSpec":0,"disDefaultRsp":0} - null failed with error Error: Timed out after 30000 ms

I will keep messing with this, but any help is appreciated.

@Koenkk
Copy link
Owner

Koenkk commented Jan 26, 2019

Could you post the database.db entry of this device?

@gi-el
Copy link
Contributor Author

gi-el commented Jan 26, 2019

The light, that seems to do very little:

{"id":5,"type":"Router","ieeeAddr":"0x00158d0001a5bad8","nwkAddr":34555,"manufId":4151,"manufName":"Trust International B.V.\u0000","powerSource":"Mains (single phase)","modelId":"ZLL-ExtendedColo","epList":[1,2],"status":"online","joinTime":1548519855,"endpoints":{"1":{"profId":49246,"epId":1,"devId":4096,"inClusterList":[4096],"outClusterList":[4096],"clusters":{"lightLink":{"dir":{"value":3},"attrs":{}}}},"2":{"profId":49246,"epId":2,"devId":528,"inClusterList":[0,3,4,5,6,8,25,768,65535],"outClusterList":[0,3,4,5,6,8,25,768],"clusters":{"genBasic":{"dir":{"value":3},"attrs":{}},"genIdentify":{"dir":{"value":3},"attrs":{}},"genGroups":{"dir":{"value":3},"attrs":{}},"genScenes":{"dir":{"value":3},"attrs":{}},"genOnOff":{"dir":{"value":3},"attrs":{}},"genLevelCtrl":{"dir":{"value":3},"attrs":{}},"genOta":{"dir":{"value":3},"attrs":{}},"lightingColorCtrl":{"dir":{"value":3},"attrs":{}},"manuSpecificCluster":{"dir":{"value":1},"attrs":{}}}}},"_id":"jYs4aKBZWQXrGlzc"}

The switch, that crashes zigbee2mqtt because of "Unknown cluster":

{"id":6,"type":"EndDevice","ieeeAddr":"0x00158d000198d02e","nwkAddr":37999,"manufId":4151,"manufName":"ADUROLIGHT","powerSource":"Battery","modelId":"Adurolight_NCC","epList":[1],"status":"online","joinTime":1548543783,"endpoints":{"1":{"profId":260,"epId":1,"devId":2080,"inClusterList":[0,3,8,4096,64716],"outClusterList":[3,4,6,8,4096,64716],"clusters":{"64716":{"dir":{"value":3},"attrs":{}},"genBasic":{"dir":{"value":1},"attrs":{}},"genIdentify":{"dir":{"value":3},"attrs":{}},"genGroups":{"dir":{"value":2},"attrs":{}},"genOnOff":{"dir":{"value":2},"attrs":{}},"genLevelCtrl":{"dir":{"value":3},"attrs":{}},"lightLink":{"dir":{"value":3},"attrs":{}}}}},"_id":"f25iNaccbDXCgCLF"}

@Koenkk
Copy link
Owner

Koenkk commented Jan 27, 2019

Lets start with the light.

  • Can you post a link to this device?
  • What features does this light support (e.g. color temperature, color, etc.)?
  • Can you try with the following in devices.js:
    {
        zigbeeModel: ['ZLL-ExtendedColo'],
        model: 'TODO',
        vendor: 'AduroSmart Eria',
        description: 'TODO',
        extend: generic.light_onoff_brightness_colortemp_colorxy,
        ep: (device) => {
            return {
                '': 2,
            };
        },
    },

@gi-el
Copy link
Contributor Author

gi-el commented Jan 27, 2019

https://adurosmart.com/products/adurosmart-eria-smart-bulb-a19-white-and-color-dimmable-cri-90-60w-equivalent-hub-required
Some more info: https://www.homedepot.com/p/AduroSmart-ERIA-60-Watt-Equivalent-A19-Dimmable-CRI-90-Wireless-Smart-LED-Light-Bulb-Multi-Color-81809/306568421

Although not fully sure, the descriptions above suggest, dimmable, color and color temperature.
The devices.js snippet results in a crash as soon as I'm doing anything:

zigbee2mqtt:debug 2019-1-27 12:20:13 Received MQTT message on 'zigbee2mqtt/0x00158d0001a5bad8/set' with data '{"state": "ON"}'
/app/lib/extension/devicePublish.js:118
            const converter = model.toZigbee.find((c) => c.key.includes(key));
                                             ^

TypeError: Cannot read property 'find' of undefined
    at Object.keys.forEach (/app/lib/extension/devicePublish.js:118:46)
    at Array.forEach (<anonymous>)
    at DevicePublish.onMQTTMessage (/app/lib/extension/devicePublish.js:117:27)
    at results.extensions.filter.map (/app/lib/controller.js:121:27)
    at Array.map (<anonymous>)
    at Controller.onMQTTMessage (/app/lib/controller.js:121:14)
    at MQTT.onMessage (/app/lib/mqtt.js:81:18)
    at emitThree (events.js:136:13)
    at MqttClient.emit (events.js:217:7)
    at MqttClient._handlePublish (/app/node_modules/mqtt/lib/client.js:987:12)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! zigbee2mqtt@1.0.1 start: `node index.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the zigbee2mqtt@1.0.1 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2019-01-27T20_20_13_481Z-debug.log

@gi-el
Copy link
Contributor Author

gi-el commented Jan 27, 2019

When instead of the extend I add the fromZigbee and toZigbee lines for the generic light, it works! Brightness, on/off, color and color temperature all as expected.

@Koenkk
Copy link
Owner

Koenkk commented Jan 28, 2019

Great, could you make a PR? Then we can continue with the next device.

@gi-el
Copy link
Contributor Author

gi-el commented Jan 28, 2019

I'm happy to. There are some (minor) issues - we can discuss those on the PR.

@gi-el
Copy link
Contributor Author

gi-el commented Jan 28, 2019

One issue that I think is not related to the code, so discussing here:

I have three of these bulbs and they are very close together. Looking at the network map, one is connected to the controller, the two others are connected to the first one acting as a router. One of the lamps (consistently the same one) that is connected through the router sometimes gets in a state where it doesn't seem to accept commands. The log shows

zigbee2mqtt:error 2019-1-28 09:37:51 Zigbee publish to '0x00158d0001990169', genOnOff - off - {} - {"manufSpec":0,"disDefaultRsp":0} - 2 failed with error Error: AF data request fails, status code: 233. MAC no ack.

This happened a few times, and I seemed to be able to get it working again by turning the physical power off and on to the lamp, and restarting zigbee2mqtt. Or so I thought... it seems to be the exact physical position of the lamp. Switching out one lamp with another, the lamp in the same position now becomes non-responsive. If I move the lamp literally an inch up or down, it works. In that exact same spot, it doesn't. It shows online in the network map, has good link quality, connects through a router (other lamp) that's very close, but doesn't accept commands. Hold it an inch higher - all good. Have you ever seen something like this before? Happy to move this to a new issue if you prefer, because while troubleshooting and typing I realize it has little to do with the original issue.

EDIT: I don't think this has anything to do with this specific lamp. The three lamps are in a fixture like this (https://www.target.com/p/avenal-shaded-arc-floor-lamp-project-62-153/-/A-52937505) and I can rotate the base a few inches and one of the lamps doesn't respond; rotate it in the other direction and a different light doesn't respond. They all show online in the network map. The link quality of the router-lamp is on the low end (15-ish) - but that's not the lamp that has issues (sometimes it has and the other ones don't). I think there's more to "parent" than I know and the controller might still try to talk directly to the lamps? Anyway, I've ordered parts to make a sniffer with RF and antenna, that will likely fix it. Apologies for this long-winding non-report :0.

@Koenkk
Copy link
Owner

Koenkk commented Jan 28, 2019

Can you update to the latest dev branch? This has a more complete network map.

@gi-el
Copy link
Contributor Author

gi-el commented Jan 28, 2019

Looks like they're all connected to each other as routers with good link quality, but also to the controller with close to zero link quality. Assuming depending on the exact location some messages don't get through, and aren't routed through the routers as there also is a direct connection. Is there anything that can be done about that (e.g., retry through a router)? Not that big of an issue - as said, I'm already in the process of getting an RF+antenna setup and this is only relevant if you're at the edge of the network range I suppose...

Working on PR against latest dev branch - only issue I see is that the devices don't seem to update status after setting it - i.e., the fromZigbee functions don't get called under normal operation and hence the state doesn't include brightness, color, etc, but only ON or OFF. fromZigbee functions do get called when requesting zigbee2mqtt/<dev>/get and the state is updated correctly. What's the advised way of automatically calling the get function after set (this all for proper Home Assistant integration)?

@Koenkk
Copy link
Owner

Koenkk commented Jan 29, 2019

The state isn't updated because the commands don't succeed, hopefully this will be fixed by your new RF coordinator.

@gi-el
Copy link
Contributor Author

gi-el commented Jan 29, 2019

I think these lamps just don't send updates when their state is changed. Even with the lamps positioned close to the controller and the commands obviously succeeding, state only shows on or off and nothing else. When issueing an explicit get for brightness/color, the lamp responds and the state gets updated.

@Koenkk
Copy link
Owner

Koenkk commented Jan 30, 2019

Can you try with

    // AduroSmart
    {
        zigbeeModel: ['ZLL-ExtendedColo'],
        model: '81809',
        vendor: 'AduroSmart',
        description: 'ERIA colors and white shades smart light bulb A19',
        extend: generic.light_onoff_brightness_colortemp_colorxy,
        configure: (ieeeAddr, shepherd, coordinator, callback) => {
            const device = shepherd.find(ieeeAddr, 2);
            const cfg = {direction: 0, attrId: 0, dataType: 16, minRepIntval: 0, maxRepIntval: 1000, repChange: 0};
            const actions = [
                (cb) => device.bind('genOnOff', coordinator, cb),
                (cb) => device.foundation('genOnOff', 'configReport', [cfg], foundationCfg, cb),
            ];

            execute(device, actions, callback);
        },
        ep: (device) => {
            return {
                '': 2,
            };
        },
    },

@gi-el
Copy link
Contributor Author

gi-el commented Feb 1, 2019

Doesn't seem to fix anything. The only time the state actually seems to get updated (besides on/off, which always worked) is when explicitly publishing to the get topic. The color and brightness are not being updated on the state topic at any other moment.

When I turn the light on, this is in the log:

  zigbee2mqtt:debug 2019-1-31 18:43:21 Received MQTT message on 'zigbee2mqtt/adurosmart_eria_extended_color_3/set' with data '{"state": "ON"}'
  zigbee2mqtt:info 2019-1-31 18:43:21 Zigbee publish to device '0x00158d0001990169', genOnOff - on - {} - {"manufSpec":0,"disDefaultRsp":0} - 2
2019-02-01T02:43:21.668Z zigbee-shepherd:request REQ --> AF:dataRequest, transId: 23
2019-02-01T02:43:21.693Z zigbee-shepherd:request RSP <-- AF:dataRequest, status: 0
2019-02-01T02:43:21.713Z zigbee-shepherd:msgHdlr IND <-- ZDO:srcRtgInd
2019-02-01T02:43:21.726Z zigbee-shepherd:af dispatchIncomingMsg(): type: dataConfirm, msg: [object Object]
2019-02-01T02:43:21.726Z zigbee-shepherd:msgHdlr IND <-- AF:dataConfirm, transId: 23
2019-02-01T02:43:21.735Z zigbee-shepherd:af dispatchIncomingMsg(): type: incomingMsg, msg: [object Object]
2019-02-01T02:43:21.739Z zigbee-shepherd:msgHdlr IND <-- AF:incomingMsg, transId: 0
2019-02-01T02:43:21.740Z zigbee-shepherd:af dispatchIncomingMsg(): type: zclIncomingMsg, msg: [object Object]
2019-02-01T02:43:21.749Z zigbee-shepherd:request REQ --> AF:dataRequest, transId: 24
  zigbee2mqtt:info 2019-1-31 18:43:21 MQTT publish: topic 'zigbee2mqtt/adurosmart_eria_extended_color_3', payload '{"state":"ON"}'
2019-02-01T02:43:21.769Z zigbee-shepherd:request RSP <-- AF:dataRequest, status: 0
2019-02-01T02:43:21.805Z zigbee-shepherd:af dispatchIncomingMsg(): type: dataConfirm, msg: [object Object]
2019-02-01T02:43:21.807Z zigbee-shepherd:msgHdlr IND <-- AF:dataConfirm, transId: 24
2019-02-01T02:43:21.825Z zigbee-shepherd:af dispatchIncomingMsg(): type: incomingMsg, msg: [object Object]
2019-02-01T02:43:21.835Z zigbee-shepherd:msgHdlr IND <-- AF:incomingMsg, transId: 0
2019-02-01T02:43:21.836Z zigbee-shepherd:af dispatchIncomingMsg(): type: zclIncomingMsg, msg: [object Object]

Changing color or brightness looks similar, with only on/off state reported, no brightness.

The configuration does seem to be accepted:

2019-02-01T03:55:34.644Z zigbee-shepherd-converters:devices Configured '(cb) => device.foundation('genLevelCtrl', 'configReport', [cfgLevel], foundationCfg, cb)' with result 'OK'
  zigbee2mqtt:info 2019-1-31 19:55:34 Succesfully configured adurosmart_eria_extended_color_1 (0x00158d0001a5bad8)

I've also tried with a genLevelCtrl configReport:

        configure: (ieeeAddr, shepherd, coordinator, callback) => {
            const device = shepherd.find(ieeeAddr, 2);
            const cfgLevel = {direction: 0, attrId: 0, dataType: 32, minRepIntval: 0, maxRepIntval: 1000, repChange: 1};
            const actions = [
                (cb) => device.bind('genLevelCtrl', coordinator, cb),
                (cb) => device.foundation('genLevelCtrl', 'configReport', [cfgLevel], foundationCfg, cb),
            ];

            execute(device, actions, callback);
        },

When manually retrieving state, this is the log:

 zigbee2mqtt:debug 2019-1-31 19:40:29 Received MQTT message on 'zigbee2mqtt/adurosmart_eria_extended_color_1/get' with data '{"brightness":""}'
  zigbee2mqtt:info 2019-1-31 19:40:29 Zigbee publish to device '0x00158d0001a5bad8', genLevelCtrl - read - [{"attrId":0}] - {"manufSpec":0,"disDefaultRsp":0} - 2
2019-02-01T03:40:29.916Z zigbee-shepherd:request REQ --> AF:dataRequest, transId: 11
2019-02-01T03:40:29.935Z zigbee-shepherd:request RSP <-- AF:dataRequest, status: 0
2019-02-01T03:40:29.958Z zigbee-shepherd:af dispatchIncomingMsg(): type: dataConfirm, msg: [object Object]
2019-02-01T03:40:29.959Z zigbee-shepherd:msgHdlr IND <-- AF:dataConfirm, transId: 11
2019-02-01T03:40:29.997Z zigbee-shepherd:af dispatchIncomingMsg(): type: incomingMsg, msg: [object Object]
2019-02-01T03:40:30.031Z zigbee-shepherd:msgHdlr IND <-- AF:incomingMsg, transId: 0
2019-02-01T03:40:30.033Z zigbee-shepherd:af dispatchIncomingMsg(): type: zclIncomingMsg, msg: [object Object]
  zigbee2mqtt:debug 2019-1-31 19:40:30 Received zigbee message of type 'devChange' with data '{"cid":"genLevelCtrl","data":{"currentLevel":77}}' of device 'ZLL-ExtendedColo' (0x00158d0001a5bad8)
  zigbee2mqtt:info 2019-1-31 19:40:30 MQTT publish: topic 'zigbee2mqtt/adurosmart_eria_extended_color_1', payload '{"state":"ON","brightness":77}'

Interesting enough, this state is remembered by zigbee2mqtt, any command after this will now report the same brightness back that we got from this explicit get command.

@Koenkk
Copy link
Owner

Koenkk commented Feb 2, 2019

The brightness and color is never reported back, as Home Assistant doesn't need a confirmation, this is not needed (the slider will stay at the position where you moved it to).

@gi-el
Copy link
Contributor Author

gi-el commented Feb 2, 2019

  1. Independent of Home Assistant, if I subscribe to a device's state topic I think the expected behavior would be to get updates when the device's state changes. If somebody else changes the state (by publishing to the state/set topci), I would probably expect a state update. With these lights, this isn't happening. This is an issue with the lights, but it's something we can likely work around in zigbee2mqtt
  2. According to the documentation and my experience, Home Assistant does actually want confirmation. It tries to display the actual state of the light, not necessarily what it thinks it should be. This way, you're sure that your command has been received by the lamp. The docs for MQTT lights say: "When a state topic is not available, the light will work in optimistic mode. In this mode, the light will immediately change state after every command. Otherwise, the light will wait for state confirmation from the device (message from state_topic)."

So for this specific light, I see three solutions:
a) Set the Home Assistant MQTT light entry to optimistic. I've tried this (by changing the JSON entry for the light in homeassistant.js) and it works, it does give the expected behavior in HA, but it doesn't actually solve for 1) above.
b) Force the reading of the state over ZigBee after writing it. I've tried this as well by making new light entries for this light and adding readAfterWriteTime: 100 in the new entries in toZigbee.js. This also works nicely and actually makes sure the current state is correctly reflecting what the light actually is doing
c) Implement some form of optimistic mode in zigbee2mqtt. If a device has "optimistic" set, we would publish the expected state once it has been successfully sent to the device (and cache it in state.json). I have not tried this.

My preference would be option b) above, as it actually gives the most accurate information and mimics what the light normally should be doing anyway. Let me know what you think and I'll make a PR for your preferred solution.

Then we can move on to the switch :).

@Koenkk
Copy link
Owner

Koenkk commented Feb 2, 2019

I think I misunderstood you.

The state_topic is used to determine the ON/OFF state of the device. Zigbee2mqtt published to this topic when the command succeed (!= confirmed by the device). This is because many devices don't confirm this.

Can you confirm when the zigbee command succeeds, the state is correctly updated?

@gi-el
Copy link
Contributor Author

gi-el commented Feb 3, 2019

Thanks for your help getting the lights working perfectly! I'm having some slightly different models on the way, so more will be supported soon!

Next, on to the remote. Could you give some pointers as to how to solve the unknown cluster error, or maybe just ignore it?

@Koenkk
Copy link
Owner

Koenkk commented Feb 3, 2019

Add a console.log(clusterId, direction, cmd) to https://github.com/Koenkk/zcl-packet/blob/master/lib/functional.js#L25 to find out the cluster ID.

After that you have to define the cluster and it's commands like I did in: Koenkk/zcl-id@4db172c and Koenkk/zcl-packet@e233d22

@gi-el
Copy link
Contributor Author

gi-el commented Feb 5, 2019

I think we can close this issue - both the lights and the switch are supported now in the dev branch. Thanks for all your help!

@gi-el gi-el closed this as completed Feb 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants