zigbee2mqtt icon indicating copy to clipboard operation
zigbee2mqtt copied to clipboard

wrong module detection

Open apages2 opened this issue 3 years ago β€’ 41 comments

Link

https://www.zigbee2mqtt.io/devices/067776.html

Model

067726A

Description

Netatmo wired shutter switch

Vendor

LEGRAND

Picture (link)

https://www.zigbee2mqtt.io/devices/067776.html

Database entry

"device": {"applicationVersion": 0,"dateCode": " \u000020221202\u0000\u0000\u0000\u0000\u0000","hardwareVersion": 1,"manufacturerID": 4129,"manufacturerName": " Legrand","model": "K4027C/L4027C/N4027C/NT4027C","networkAddress": 13499,"powerSource": "Mains (single phase)","softwareBuildID": "002c","stackVersion": 66,"type": "Router","zclVersion": 2},

Notes

Hello

my Legrand 067726A module is detected as BTICINO K4027C/L4027C/N4027C/NT4027C module. It seems to work on basic up/down/stop actions, but the LED remains flashing green and the specific "support position" configuration does not work (no calibration)

Best regards

apages2 avatar Sep 29 '23 08:09 apages2

Same issue here but the led stays red in my case ~~and I can't seem to get the rolling shutter move~~ (edit: wiring issue).

Diaoul avatar Oct 02 '23 17:10 Diaoul

database.db entry

{
  "id": 54,
  "type": "Router",
  "ieeeAddr": "0x0004740000a434c1",
  "nwkAddr": 56064,
  "manufId": 4129,
  "manufName": " Legrand\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000",
  "powerSource": "Mains (single phase)",
  "modelId": " Shutter SW with level control\u0000",
  "epList": [
    1,
    242
  ],
  "endpoints": {
    "1": {
      "profId": 260,
      "epId": 1,
      "devId": 514,
      "inClusterList": [
        0,
        3,
        4,
        5,
        15,
        64513,
        258
      ],
      "outClusterList": [
        0,
        64513,
        5,
        25,
        258
      ],
      "clusters": {
        "genBasic": {
          "attributes": {
            "appVersion": 0
          }
        }
      },
      "binds": [
        {
          "cluster": 15,
          "type": "endpoint",
          "deviceIeeeAddress": "0x00124b00237dfb5a",
          "endpointID": 1
        },
        {
          "cluster": 258,
          "type": "endpoint",
          "deviceIeeeAddress": "0x00124b00237dfb5a",
          "endpointID": 1
        },
        {
          "cluster": 3,
          "type": "endpoint",
          "deviceIeeeAddress": "0x00124b00237dfb5a",
          "endpointID": 1
        }
      ],
      "configuredReportings": [
        {
          "cluster": 258,
          "attrId": 8,
          "minRepIntval": 1,
          "maxRepIntval": 62000,
          "repChange": 1
        }
      ],
      "meta": {}
    },
    "242": {
      "profId": 41440,
      "epId": 242,
      "devId": 102,
      "inClusterList": [
        33
      ],
      "outClusterList": [
        33
      ],
      "clusters": {},
      "binds": [],
      "configuredReportings": [],
      "meta": {}
    }
  },
  "appVersion": 0,
  "stackVersion": 66,
  "hwVersion": 4,
  "dateCode": " \u000020230221\u0000\u0000\u0000\u0000\u0000",
  "swBuildId": "002c",
  "zclVersion": 2,
  "interviewCompleted": true,
  "meta": {
    "configured": -904845555
  },
  "lastSeen": 1696267835803,
  "defaultSendRequestWhen": "immediate"
}

Diaoul avatar Oct 02 '23 17:10 Diaoul

Trying out things... (papertrail)

legrand.js

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 e = exposes.presets;
const ea = exposes.access;

const definition = {
    zigbeeModel: [' Shutter SW with level control\u0000'],
    model: '067726A',
    vendor: 'Legrand',
    description: 'Netatmo wired shutter switch with level',
    fromZigbee: [fz.identify, fz.ignore_basic_report, fz.legrand_binary_input_moving, fz.cover_position_tilt, fz.legrand_led_in_dark],
    toZigbee: [tz.cover_state, tz.cover_position_tilt, tz.legrand_identify, tz.legrand_settingEnableLedInDark],
    ota: ota.zigbeeOTA,
    configure: async (device, coordinatorEndpoint, logger) => {
        const endpoint = device.getEndpoint(1);
        await reporting.bind(endpoint, coordinatorEndpoint, ['genBinaryInput', 'closuresWindowCovering', 'genIdentify']);
        await reporting.currentPositionLiftPercentage(endpoint);
    },
    exposes: [e.cover_position(),
        e.binary('led_in_dark', ea.ALL, 'ON', 'OFF').withDescription(`Enables the LED when the power socket is turned off,
        allowing to see it in the dark`)],
};

module.exports = definition;

This seems to work but led still red and no cover position.

Diaoul avatar Oct 02 '23 18:10 Diaoul

Well that's it, this is the max I can do :grimacing: I'm not sure it changed anything ant BTicino and Legrand seem to actually be in the same basked device-wise.

Diaoul avatar Oct 02 '23 18:10 Diaoul

@apages2 does this solve the module still thinking it's in pairing mode issue even after pairing?

Diaoul avatar Oct 04 '23 07:10 Diaoul

yes, but the push request has a problem because it is duplicated with the BTICINO module. Under discussion with koenkk

apages2 avatar Oct 04 '23 07:10 apages2

Hi @apages2 and @Diaoul ,

Basic support for 067776A was added to the DEV branch today. Can you please try this, and close this issue in case the problem is solved ?

Regarding the pairing mode, you may need to:

  • Try to power cycle it (that worked for some of my devices)
  • Unfortunately "Factory reset" the device and (there is a small dip-switch underneath the down button, next to the LED) and subsequently re-pair it once more.

FabianMangold avatar Oct 09 '23 18:10 FabianMangold

Wanted to test today but I cannot without a docker image and there is no image for dev builds :cry: Edit: never mind, wrong repo, testing now

Diaoul avatar Oct 21 '23 11:10 Diaoul

@FabianMangold Seems to be recognized correctly :+1: A few comments:

  • I still have the red led staying even after factory reset then pairing, it works fine with the Legrand gateway
  • There is no way to trigger the "calibration" from zigbee2mqtt it seems
  • Manually triggering the calibration with the buttons has no effect
  • Blink works (overrides the red light)
  • Led in dark does not work (light still red)
  • Action (in exposes tab) does not seem to report anything
  • Position seems to be 0-50-100 but since I cannot trigger calibration, hard to say what the culprit is really

All in all, it does not seem that there is a lot of improvements compared to the previous situation with the exception of the correct detection.

Diaoul avatar Oct 21 '23 11:10 Diaoul

I'll sniff the traffic on the Legrand gateway and report back with the logs (in a few days).

Diaoul avatar Oct 21 '23 13:10 Diaoul

Hi @Diaoul,

The latest DEV build contains an update, that features switching the calibration mode on the switch. The behaviour you've described is somewhat odd, I cannot reproduce this on any of my device.

You may want to give this build a try, and attempt to switch the calibration modes. Switching to a simple "Up/Down/Stop" may help to "reset" the device to a normal state.

FabianMangold avatar Oct 31 '23 21:10 FabianMangold

Testing now, I'll report back when I've played a bit with the calibrations.

Diaoul avatar Nov 01 '23 22:11 Diaoul

So the options work, it triggers the calibration. But then, asking for a position just does 0 or 100% :shrug: Regarding the led, it's still blinking green or continuous red like it was right before pairing (depends if I pressed the reset button after reset or not). I've not yet had the time to sniff the network with the Legrand gateway to see what the difference is.

Diaoul avatar Nov 02 '23 08:11 Diaoul

Hi @Diaoul, Well, first of all, your device must be paired, otherwise it would not answer to the requests sent by Z2M. In order to request a position, the switch must first be "calibrated", as the switch has no actual knowledge of the actual position a blind in the first place! (Please keep in mind that there is no feedback loop / sensor, the switch remains a switch after all)! I'll reply to similar questions in PR#6333 shortly (you may want to read through this as well), but in a nutshell, you will have to go through the calibration learning prior requesting a position.

When switching modes, the switch automatically enters "calibration mode". Therefore, i suppose that your switch is currently locked there. If i were you, i would deliberately mess up the calibration, and start over. To do so, simply physically press and stay on the down button until the blind is down and you hear the relay click, then press down shortly, and then press and stay on the up button until the blind is fully open. This process must be repeated twice. Once done, the switch is back is "normal" mode, but with a messed up calibration. I would then start the process over. Can you please try this ? This worked just fine for all of my devices.

Sniffing the traffic might be interesting, albeit unrelevant at this stage, as the Legrand GW uses the very same commands and attributes to handle the situation. Please let us know the outcome.

FabianMangold avatar Nov 02 '23 10:11 FabianMangold

Well, first of all, your device must be paired

They are, although the led's pattern does not change from before to after pairing.

In order to request a position, the switch must first be "calibrated"

I triggered a calibration by switching to "specific_nllv" which did the same thing as pressing the up + down button for 5 seconds when connected to the Legrand Gateway: the led turns orange and the auto calibration starts.

you will have to go through the calibration learning prior requesting a position

With the Legrand gateway, the above calibration worked and I could request a position.

Sniffing the traffic might be interesting, albeit unrelevant at this stage

It's really weird that my module still has the LED as if it was not paired but is paired nonetheless. I do not have this behavior when connected to the Legrand Gateway. I suspect this causes the module to behave weirdly and that I could learn more by sniffing the traffic. If you did that already, let me know and I will not waste my time πŸ˜…

I will try your calibration technique πŸ‘

Diaoul avatar Nov 02 '23 11:11 Diaoul

They are, although the led's pattern does not change from before to after pairing.

That's really odd, i really cannot reproduce this. To be honest, i remember one similar situation when i first bought the switches a couple of month back, and i may have gotten rid of this by re-forcing a firmware update. Probably not the finest way, but given the fact i wanted to update anyway.... Might be worth trying this on one of your devices.

I triggered a calibration by switching to "specific_nllv" which did the same thing as pressing the up + down button for 5 seconds when connected to the Legrand Gateway: the led turns orange and the auto calibration starts.

Interesting. I've added some notes here: https://github.com/Koenkk/zigbee-herdsman-converters/pull/6333#issuecomment-1790548665 Would you mind checking / confirming or obviously commenting on those findings ? I have no Legrand GW and thus my findings are reverse-engineering and trial and errors. I have to check my config. once back home, but on top of my head, i am using the classic mode on my NLLV switches, not the specific mode. Would you know the difference ? I am interested in the BSO mode anyway, therefore i have not lost much time on the NLLV modes really, but i am happy to assist if i can.

We probably should update the documentation once we've confirmed the calibration modes. I am not yet happy with the BSO calibration mode, and am still working on that.

Just looping @Koenkk in here, for info only.

FabianMangold avatar Nov 02 '23 11:11 FabianMangold

FYI my firmware version is 0036 (on the Zigbee2MQTT dashboard)

re-forcing a firmware update

How do you do that?

i am using the classic mode on my NLLV switches, not the specific mode. Would you know the difference ?

I actually don't know, I just know that when I used the classic one, nothing happened so I switched to the specific one and auto-calibration started :shrug:

Diaoul avatar Nov 02 '23 11:11 Diaoul

Which is the latest, and that’s okay. I just meant you could reforce the update in order to go through an OTA cycle and see what happens. That worked back then for me (albeit I had updated from an super old FW version)

FabianMangold avatar Nov 02 '23 12:11 FabianMangold

I cannot capture the gateway's network key because when pairing there is no device announcement message :flushed: @Koenkk is there something I should do to capture the traffic specifically on Legrand's Gateway? Maybe there is some other kind of security?

When monitoring I see an Association Request from the module followed by an Association Response from the gateway then the following messages are encrypted :confused:

Diaoul avatar Nov 02 '23 20:11 Diaoul