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

Add NHMOTION/UNIDIM/1 (ELKO EKO06984, EKO06985 and EKO06986) #8187

Merged
merged 12 commits into from
Dec 4, 2024

Conversation

FSund
Copy link
Contributor

@FSund FSund commented Oct 25, 2024

I've combined the converters for Schneider WDE002961 (push button dimmer) and Schneider 545D6306 (PIR with relay) to come up with something that seems to work.

This supports on/off, dimming, ballast config, occupancy, and light level/illuminance.

Some testing still remains before it's ready for review.

Can't decide between ELKO or Elko, the database seems to have both entries.

TODO

  • Verify that all functionality works after rewrite using only modern extend
  • Support dimming mode (seems to only support 0: RL-LED and 3: Auto)
  • Verify the dimming mode mapping is correct (0: RL-LED and 3: Auto might be reversed)
  • Support on_level

Optional(?)

  • Sensitivity
  • Detection delay
  • Lux threshold

@peroo
Copy link
Contributor

peroo commented Oct 25, 2024

Just a quick note that I think the vendor should probably be Schneider. The ELKO version is just a white-label of WDE002962.

Also, I have a list of commands sniffed from the gateway during pairing, and when executing commands in the app. Might help with getting all the functionality implemented.

When pairing:
- Set on level 255. Cluster 8, profile 104, endpoint 3, attribute 11, 8bit uint, on level 255.
- Configure reporting, endpoint 3, cluster 0x0b05, attribute 0x011d, 8bit signed int, 127
- Configure reporting, endpoint 3, cluster 0x0b05, attribute 0x011c, 8bit uint, 255
- Configure reporting, endpoint 3, cluster 0x0006, attribute 0x000, boolean, direction reported 0x00 - attribute 0x4001 16bit uint, on time 1.0s, direction reported 0x00
- Configure reporting, endpoint 3, cluster 0x0008, attribute 0x0000, direction reported 0x00, 8bit uint, current level 1
- Configure reporting, endpoint 3, cluster 0x0406, attribute 0x0000, direction reported 0x00, 8bit bitmap
- Configure reporting, endpoint 37, cluster 0x0400, attribute 0x0000, direction reported 0x00, 16bit uint, measured value 441
- Configure reporting, endpoint 37, cluster 0xff19, attribute 0x0000, direction reported 0x00, 16bit uint, 1
- Bind:
    - endpoint 3, cluster 0x0b05
    - endpoint 3, cluster 0x0006
    - endpoint 3, cluster 0x0008
    - endpoint 37, cluster 0x0406
    - endpoint 37, cluster 0x0400
    - endpoint 37, cluster 0xff19

App Commands:
- Dimming mode: endpoint 3, cluster 301, profile 104, attribute 0xe000
    - RL-LED: enum8 0
    - Auto: enum8 3
- Dimming range: endpoint 3, cluster 301:
    - Min: attribute 0x0010, 0-254
    - Max: attribute 0x0011, 0-254
- Toggle mode: endpoint 3, cluster 8:
    - 100%: attribute 0x0011, 8bit uint, on level 254
    - last level: attribute 0x0011, 8bit uint, on level 255
- Sensitivity settings: endpoint 37, cluster 0x0406
    - Medium: attribute 0xe003, uint8 75
    - Low: attribute 0xe003, uint8 50
    - High: attribute 0xe003, uint8 100
- Detection delay: endpoint 37, cluster 406
    - 15s: attribute 0x0010, 16bit uint, 15
    - 300s: attribute 0x0010, 16bit uint, 300
    - 13618: attribute 0x0010, 16bit uint, 300
- Lux threshold, endpoint 37, cluster 0xff19
    - Current lux (21lx): attribute 0x0000, 16bit uint, 13618 (0x3532)
    - 1000lx: attribute 0x0000, 16bit uint, 30001(0x7531)

model: 'EKO06984',
vendor: 'ELKO',
description: 'SmartPir with push dimmer',
fromZigbee: [fz.on_off, fz.brightness, fz.illuminance, fz.level_config, fz.schneider_lighting_ballast_configuration, fz.occupancy],
Copy link
Owner

@Koenkk Koenkk Oct 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you try with modern extend? E.g. extend: [light({configureReporting: true})],, then you can remove fromZigbee, toZigbee, exposes and configure.

@FSund
Copy link
Contributor Author

FSund commented Oct 26, 2024

Also, I have a list of commands sniffed from the gateway during pairing, and when executing commands in the app. Might help with getting all the functionality implemented.

From your list and some testing it seems like some custom tz an fz might be required to support all features.

For example, setting dimmer_mode

z2m: Publish 'set' 'dimmer_mode' to '0x70ac08fffe4959e0' failed: 
'Error: ZCL command 0x70ac08fffe4959e0/3 lightingBallastCfg.write(
{"57344":{"value":1,"type":48}}, 
{"timeout":10000,
  "disableResponse":false,
  "disableRecovery":false,
  "disableDefaultResponse":true,
  "direction":0,
  "reservedBits":0,
  "manufacturerCode":4190,
  "writeUndiv":false
}) 
failed (Status 'INVALID_VALUE')'

I'll try to have a go this weekend, but all suggestions are welcome :)

@FSund FSund changed the title Add ELKO EKO06984, EKO06985 and EKO06986 Add NHMOTION/UNIDIM/1 (Schneider Electric WDE002962 ELKO EKO06984, EKO06985 and EKO06986) Oct 26, 2024
@peroo
Copy link
Contributor

peroo commented Oct 26, 2024

Apologies, on closer inspection I've realized my switch is a slightly different version from yours. I have the NHMOTION/DIMMER/1 - EKO07252, which is the multiwire version. That means that WDE002962 is wrong for this device. I expect the commands to be the same, the difference from my understanding is just electrical, but it's hard to say.

For what it's worth I'm seeing the same errors when setting dimmer_mode 1 or 2. In the past I've used the tz.wiser_dimmer_mode converter which is another version of the schneider dimmer mode, but confusingly auto/led values are opposite from what I've sniffed, which either indicates a difference or my notes are wrong. I can't think of a way to really test.

@FSund
Copy link
Contributor Author

FSund commented Oct 26, 2024

Apologies, on closer inspection I've realized my switch is a slightly different version from yours. I have the NHMOTION/DIMMER/1 - EKO07252, which is the multiwire version. That means that WDE002962 is wrong for this device. I expect the commands to be the same, the difference from my understanding is just electrical, but it's hard to say.

For what it's worth I'm seeing the same errors when setting dimmer_mode 1 or 2. In the past I've used the tz.wiser_dimmer_mode converter which is another version of the schneider dimmer mode, but confusingly auto/led values are opposite from what I've sniffed, which either indicates a difference or my notes are wrong. I can't think of a way to really test.

I see. I think EKO07252 is the replacement for EKO06984/85/86, as those are not sold anymore.

I'll change the vendor back to Elko then I think, since I haven't been able to find any alternative producers for this older dimmer.

I'll try to do some experimentation regarding dimmer mode.

@FSund FSund changed the title Add NHMOTION/UNIDIM/1 (Schneider Electric WDE002962 ELKO EKO06984, EKO06985 and EKO06986) Add NHMOTION/UNIDIM/1 (ELKO EKO06984, EKO06985 and EKO06986) Oct 28, 2024
@FSund
Copy link
Contributor Author

FSund commented Oct 28, 2024

Some updates:

  • The device reports manufacturerName "Schneider Electric" during interview, so I've left it as that for now. But I'm not certain if this name comes from the device itself, or from my converter?

  • I'm having some issues with setting up levelConfig, or specifically on_level. The device has the genLevelCtrl as an input cluster on endpoint 3, and a output cluster on endpoint 37. I'm not sure how to implement this in practice.

Here's the endpoints and clusters

endpoints:
  - id: 3
    output_clusters:
      - genOta
    input_clusters:
      - genBasic
      - genIdentify
      - genGroups
      - genScenes
      - genOnOff
      - genLevelCtrl
      - lightingBallastCfg
      - haDiagnostic
  - id: 37
    output_clusters:
      - genIdentify
      - genOnOff
      - genLevelCtrl
      - msOccupancySensing
    input_clusters:
      - genBasic
      - genIdentify
      - msIlluminanceMeasurement
      - msOccupancySensing
      - haDiagnostic
      - elkoOccupancySettingClusterServer
  - id: 242
    output_clusters:
      - greenPower

@peroo
Copy link
Contributor

peroo commented Oct 28, 2024

  • The device reports manufacturerName "Schneider Electric" during interview, so I've left it as that for now. But I'm not certain if this name comes from the device itself, or from my converter?

That'll be from the device. You can query it in the dev console by reading manufacturerName from the genBasic cluster on endpoint 3.

Some updates on my end.

  • I've verified that my notes had dimming mode backwards, so the existing wiserDimmerControlMode is correct.
  • I've managed to cobble together occupancy sensitivity control, the only thing to note is that since it's manufacturer specific the manufacturerCode needs to be set to Schenider when configuring reporting and setting. zigbee-herdsman has cluster definitions for all these manufacturer specific clusters and attributes, but they were added as Elko specific, and have the wrong manufacturer code, which makes them unusable. I don't think any of these have ever been used anywhere, they were probably just added from documentation, so they should be renamed and updated to apply to Schneider, IMO.
  • I spent hours debugging why the PIR lights green when attached to z2m. Turns out it lights green when the network is open for adoption. 🤦

I'm planning to submit a PR for my device since it's slightly different. We should be able to share most of the implementation.

BTW, there's some Schneider documentation floating around for dimmer switches. It doesn't include PIR functionality, but it's hugely useful for getting accurate documentation of dimmer functionality.
Connected_Universal_Push-button_Dimmer_04-2022_368225_1653575314693_en-US.pdf

@FSund
Copy link
Contributor Author

FSund commented Oct 30, 2024

Anyone know of a way to avoid the _<endpoint name> postfix for the light entity?

With the current setup

deviceEndpoints({endpoints: {light: 3, sensor: 37}}),
light({
effect: false,
powerOnBehavior: false,
color: false,
configureReporting: true,
endpointNames: ['light'],
levelConfig: {},
}),

The light entity in HA is named light.<device name>_light, which is a bit clumsy. I tried endpoint name default, but then it got the postfix _default.

@enoch85
Copy link

enoch85 commented Nov 9, 2024

@FSund How do I your PR into my Prod ENV?

Got it, and it's working for the Swedish version as well. :) This is my device:
https://www.se.com/se/sv/product/WDE002367/exxact-r%C3%B6relsedetektor-med-tryckknapp-10a-som-styrs-med-wiser-by-seappen-via-zigbee-3-0-vit-
(or, not 100% sure)
https://www.se.com/se/sv/product/WDE002962/r%C3%B6relsedetektor-m-dim-med-m%C3%B6jlighet-att-ansluta-neutralledare-exxact-wiser-by-se-zigbee-3-0-rc-0130w-rl-080w-vit/

This is the config

const {} = require('zigbee-herdsman-converters/lib/modernExtend');
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 ota = require('zigbee-herdsman-converters/lib/ota');
const utils = require('zigbee-herdsman-converters/lib/utils');
const globalStore = require('zigbee-herdsman-converters/lib/store');
const e = exposes.presets;
const ea = exposes.access;

const definition = {
    zigbeeModel: ['NHMOTION/DIMMER/1'],
    model: 'WDE002962',
    vendor: 'Schneider Electric',
    description: 'Exxact motion sensor with push dimmer',
    fromZigbee: [
        fz.on_off, 
        fz.brightness, 
        fz.illuminance,
        fz.level_config, 
        fz.schneider_lighting_ballast_configuration,
        fz.occupancy, 
    ],
    toZigbee: [
        tz.light_onoff_brightness, 
        tz.level_config, 
        tz.ballast_config, 
        tz.schneider_dimmer_mode,
    ],
    exposes: [
        e.light_brightness().withLevelConfig(),
        e.occupancy(),
        e.illuminance_lux(),
        e.illuminance(),
        e
            .numeric('ballast_minimum_level', ea.ALL)
            .withValueMin(1)
            .withValueMax(254)
            .withDescription('Specifies the minimum light output of the ballast'),
        e
            .numeric('ballast_maximum_level', ea.ALL)
            .withValueMin(1)
            .withValueMax(254)
            .withDescription('Specifies the maximum light output of the ballast'),
        e
            .enum('dimmer_mode', ea.ALL, ['RC', 'RL'])
            .withDescription('Controls capacitive or inductive dimming mode')
    ],
    configure: async (device, coordinatorEndpoint) => {
        const endpoint = device.getEndpoint(3);
        const binds = ['genOnOff', 'genLevelCtrl', 'lightingBallastCfg'];
        await reporting.bind(endpoint, coordinatorEndpoint, binds);
        await reporting.onOff(endpoint);
        await reporting.brightness(endpoint);

        const endpoint37 = device.getEndpoint(37);
        const binds37 = ['msIlluminanceMeasurement', 'msOccupancySensing'];
        await reporting.bind(endpoint37, coordinatorEndpoint, binds37);
        await reporting.occupancy(endpoint37);
        await reporting.illuminance(endpoint37);
    },
    whiteLabel: [
        {vendor: 'ELKO', model: 'EKO06985'},
        {vendor: 'ELKO', model: 'EKO06986'},
	{vendor: 'Exxact', model: 'WDE002962'},
	{vendor: 'Exxact', model: 'WDE002367'},

    ],
};

module.exports = definition;

@enoch85
Copy link

enoch85 commented Nov 10, 2024

@FSund Could you please add support for the one I posted as well, or do you suggest a separate PR?

@FSund
Copy link
Contributor Author

FSund commented Nov 10, 2024

@enoch85 I have not gotten on_level to work yet, but I suppose that's not required, and can be added later.

Does all functionality work with your Exxact device? Ballast config, illuminance/lux detection etc? In that case I can add the Swedish device to this PR.

@enoch85
Copy link

enoch85 commented Nov 10, 2024

@FSund

Afaik, everything works. The only thing I need really is turning it off and on, and detect presence. Just tested ballast though, and it's also working! 👍🏼 Regarding the on_level I can see that it's on by a change in color on the switch. Please see pic for more info.

Screenshot_2024-11-10-09-19-44-53

Screenshot_2024-11-10-09-24-45-02_3aea4af51f236e4932235fdada7d1643

@enoch85
Copy link

enoch85 commented Nov 10, 2024

Maybe would be nice with an icon of the device though, don't know if this PR covers that?

@FSund
Copy link
Contributor Author

FSund commented Nov 10, 2024

I've added levelConfig to the light extend, but can't get it to respond via the GUI.

But if I set on_level via Dev console it works fine

image

image

I've tried setting it via the Exposes tab and reading via Dev console, but it doesn't seem to change.

Any ideas what I'm doing wrong?

@peroo
Copy link
Contributor

peroo commented Nov 10, 2024

I've pushed my PR which adds extends for ballast and the Schneider specific stuff. Everything should work, though I haven't 100% verified that yet.

#8300

@FSund FSund marked this pull request as ready for review December 3, 2024 09:11
@FSund
Copy link
Contributor Author

FSund commented Dec 3, 2024

I've finally gotten around to clean up this. All functionality is confirmed working on my devices.

Thanks a lot to @peroo for doing the heavy lifting here in #8300.

@enoch85
Copy link

enoch85 commented Dec 3, 2024

@peroo Your integration works perfect! I'm soo grateful, thank you!

@@ -2128,6 +2128,36 @@ const definitions: DefinitionWithExtend[] = [
{vendor: 'Exxact', model: 'WDE003962'},
],
},
{
zigbeeModel: ['NHMOTION/UNIDIM/1'],
model: 'NHMOTION/UNIDIM/1',
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would expect a different model number is written on product page or device, can you use this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be honest I'm not certain that this is actually a Schneider Electric white label product. It looks mostly identical to Elko EKO07250 and related devices, which is definitely produced by Schneider, but this device (EKO06984) seem like an earlier version.

In any case I haven't been able to find the Schneider product number anywhere.

I can change to model: 'EKO06984' and vendor: 'Elko', but in that case I should perhaps move the definition over to elko.ts. In that case I would also have to duplicate a lot of the schneiderElectricExtend functionality.

Copy link

@enoch85 enoch85 Dec 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMHO, why not add the device ID EKO06984 to the already existing models that were merged in #8300? Specifically here: https://github.com/Koenkk/zigbee-herdsman-converters/pull/8300/files#diff-9efd6085fa5f906d335c472b4ab9366dd0effdb29b6bbff96ef4033f4618daeeR2139-R2145

The functionality is probably exactly the same.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The zigbeeModel is different, NHMOTION/UNIDIM/1 vs. NHMOTION/DIMMER/1.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then let's keep NHMOTION/UNIDIM/1

@Koenkk Koenkk merged commit e356332 into Koenkk:master Dec 4, 2024
2 checks passed
@Koenkk
Copy link
Owner

Koenkk commented Dec 4, 2024

Could you also submit a picture for the docs? This can be done by:

  1. Create a fork by clicking here
  2. Go to the public/images/devices directory, Add file -> Upload files
  3. Upload the files and press Commit changes
  4. Press Contribute -> Open pull request -> update title/description -> Create pull request

Make sure that:

  • The filename is NHMOTION-UNIDIM-1.png
  • The size is 512x512
  • The background is transparent (use e.g. Adobe remove background)

@FSund
Copy link
Contributor Author

FSund commented Dec 5, 2024

Could you also submit a picture for the docs? This can be done by:

  1. Create a fork by clicking here
  2. Go to the public/images/devices directory, Add file -> Upload files
  3. Upload the files and press Commit changes
  4. Press Contribute -> Open pull request -> update title/description -> Create pull request

Make sure that:

  • The filename is NHMOTION-UNIDIM-1.png
  • The size is 512x512
  • The background is transparent (use e.g. Adobe remove background)

Docs and images was already added Koenkk/zigbee2mqtt.io#3285

But I see I perhaps used the wrong filenames. Should I rename the image and/or the markdown file?

@Koenkk
Copy link
Owner

Koenkk commented Dec 5, 2024

yes please rename

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

Successfully merging this pull request may close these issues.

4 participants