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

Legrand 067776(A): Support calibration + Venetian mode #6333

Merged
merged 7 commits into from
Oct 30, 2023

Conversation

FabianMangold
Copy link
Contributor

@FabianMangold FabianMangold commented Oct 24, 2023

This PR:

  • includes a small refactoring of Legrand related devices / libraries
  • enables calibration on 067776 / 067776A devices
  • adds support for Venetian (BSO) mode

@Koenkk: A couple of questions / remarks:
1.) The reporting does not work reliably yet. I am somewhat puzzled with the reporting of attributes. Can you give me pointers as how to fix this or where to look for potential issues ?

  • The device seems to report attributes regardless of the configured reporting. (I assume there is not much we can do about that, unless we explicitly disregard those reports)
  • While the manufacturer code is honoured for readAttribute requests, it is ignored for attribute reports.
    As an example, this is an excerpt from database.db for one of the devices:
{
  "61444": 25,
  "currentPositionLiftPercentage": 100,
  "currentPositionTiltPercentage": 0,
  "tuyaMotorReversal": 4,
  "moesCalibrationTime": 0,
  "tuyaMovingState": 100,
  "tuyaCalibration" :1
  }

Attribute 61444 (0xF004) should read "calibrationMode" following zigbee-herdsman PR#784, which as mentioned, works for readAttributes but not for reports.

2.) In order to avoid code duplication, i wanted to merge 067776 / 067776A devices in the device definition.
Shouldn't the following work ?

  {
        zigbeeModel: [' Shutter switch with neutral\u0000\u0000\u0000'],
        model: '067776',
        vendor: 'Legrand',
        description: 'Netatmo wired shutter switch',
        whiteLabel: [
            {model: '067776A',
            vendor: 'Legrand',
            description: 'Netatmo wired shutter switch with level control (NLLV)',
            meta: {supportsLevelDetection: false},
            fingerprint: [{modelID: ' Shutter SW with level control\u0000', manufacturerID: 4129}]},
        ],
        ota: ota.zigbeeOTA,
        meta: {supportsLevelDetection: false},

Thanks a lot.

P.S: I'll take a look at the failing test shortly. Looks like:

  • my new Meta definition
  • and including a function in "exposes"
    causes troubles.

@Koenkk
Copy link
Owner

Koenkk commented Oct 24, 2023

1.) The reporting does not work reliably yet. I am somewhat puzzled with the reporting of attributes. Can you give me pointers as how to fix this or where to look for potential issues ?

Can you try to include the manufacturer code when configuring the attribute reporting?

While the manufacturer code is honoured for readAttribute requests, it is ignored for attribute reports.
As an example, this is an excerpt from database.db for one of the devices:

Can you provide the herdsman debug log when this is reported?

2.) In order to avoid code duplication, i wanted to merge 067776 / 067776A devices in the device definition.
Shouldn't the following work ?

You can merge them, the whitelabel -> meta part is not needed

@FabianMangold
Copy link
Contributor Author

FabianMangold commented Oct 24, 2023

Just to clarify the previous question (which you've probably edited), the function in exposes is required due to the self reference to meta (i.e. _067776.getCalibrationModes(this.meta)). When not wrapped in a function, the scope is different, and "this" undefined.

  • Yes, I had done that via endpoint.configureReporting optioons it, the results are identical.
  • I will check the logs ASAP (sorry currently on a trip)
  • I believe the meta is actually required, as the 067776 is not an NLLV switch, while the 067776A is. Therefore, the newly introduced "supportsLevelDetection" meta attribute is required.
    Regardless, even if i get rid of the meta part, the switch gets detected as a bticino switch. Haven't debugged it, but does a device description have precendence over a whitelabel with a proper fingerprint ?

@FabianMangold
Copy link
Contributor Author

FabianMangold commented Oct 24, 2023

Regarding reporting:

I've updated the code, and added the manufacturer code back to the configuration.
Database.db shows that the reporting is configured accordingly (the manufacturer code is not visible in the FrontEnd):

[
  {
    "cluster": 258,
    "attrId": 8,
    "minRepIntval": 1,
    "maxRepIntval": 120,
    "repChange": 1,
    "manufacturerCode": 4129
  },
  {
    "cluster": 258,
    "attrId": 9,
    "minRepIntval": 1,
    "maxRepIntval": 120,
    "repChange": 1,
    "manufacturerCode": 4129
  },
  {
    "cluster": 258,
    "attrId": 61442,
    "minRepIntval": 1,
    "maxRepIntval": 120,
    "repChange": 1,
    "manufacturerCode": 4129
  }
]

The reported attributes remain "generic":

{
  "61444": 25,
  "currentPositionLiftPercentage": 100,
  "currentPositionTiltPercentage": 0,
  "tuyaMotorReversal": 4,
  "tuyaMovingState": 100,
  "tuyaCalibration": 1,
  "moesCalibrationTime": 0
}

Logs:
Is there anything special you are interested in ? A short excerpt is attached hereafter:

Received Zigbee message from 'XXX', type 'attributeReport', cluster 'closuresWindowCovering', data '{"61444":25,"moesCalibrationTime":25,"tuyaCalibration":1,"tuyaMovingState":98}' from endpoint 1 with groupID 0

zigbee-herdsman:controller:log Received 'zcl' data '{"frame":{"Header":{"frameControl":{"frameType":0,"manufacturerSpecific":false,"direction":1,"disableDefaultResponse":true,"reservedBits":0},"transactionSequenceNumber":25,"manufacturerCode":null,"commandIdentifier":10},"Payload":[{"attrId":61441,"dataType":32,"attrData":1},{"attrId":61444,"dataType":32,"attrData":25}],"Command":{"ID":10,"name":"report","parameters":[{"name":"attrId","type":33},{"name":"dataType","type":32},{"name":"attrData","type":1000}]}},"address":7729,"endpoint":1,"linkquality":100,"groupID":0,"wasBroadcast":false,"destinationEndpoint":1}' +7s

As can bee seen, those attributes were never requested and are "generic", not Manufacturer specific.
Here is another one that matches my example:
Received Zigbee message from 'XXX, type 'attributeReport', cluster 'closuresWindowCovering', data '{"tuyaMotorReversal":4}' from endpoint 1 with groupID 0
This attribute was requested, but should read "calibrationMode"

@FabianMangold
Copy link
Contributor Author

I've isolated 2 frames that depict the situation pretty well.

The first is the reply to the readrequest that was requested via the "calibration_mode" TZ converter (specifying the manufacturer code):
zigbee-herdsman:controller:log Received 'zcl' data '{"frame":{"Header":{"frameControl":{"frameType":0,"manufacturerSpecific":true,"direction":1,"disableDefaultResponse":true,"reservedBits":0},"transactionSequenceNumber":14,"manufacturerCode":4129,"commandIdentifier":1},"Payload":[{"attrId":61442,"status":0,"dataType":48,"attrData":4}],"Command":{"ID":1,"name":"readRsp","parameters":[{"name":"attrId","type":33},{"name":"status","type":32},{"name":"dataType","type":32,"conditions":[{"type":"statusEquals","value":0}]},{"name":"attrData","type":1000,"conditions":[{"type":"statusEquals","value":0}]}]}},"address":7729,"endpoint":1,"linkquality":100,"groupID":0,"wasBroadcast":false,"destinationEndpoint":1}' +169ms

The second is a simple attribute report (command 10) that happens to report the same attribute (61442)
zigbee-herdsman:controller:log Received 'zcl' data '{"frame":{"Header":{"frameControl":{"frameType":0,"manufacturerSpecific":false,"direction":1,"disableDefaultResponse":true,"reservedBits":0},"transactionSequenceNumber":200,"manufacturerCode":null,"commandIdentifier":10},"Payload":[{"attrId":61442,"dataType":48,"attrData":4}],"Command":{"ID":10,"name":"report","parameters":[{"name":"attrId","type":33},{"name":"dataType","type":32},{"name":"attrData","type":1000}]}},"address":39958,"endpoint":1,"linkquality":184,"groupID":0,"wasBroadcast":false,"destinationEndpoint":1}' +947ms

@Koenkk
Copy link
Owner

Koenkk commented Oct 25, 2023

but does a device description have precendence over a whitelabel with a proper fingerprint ?

The white label also contains a description, this will be used if the fingerprint matches

As can bee seen, those attributes were never requested and are "generic", not Manufacturer specific.
Here is another one that matches my example:
Received Zigbee message from 'XXX, type 'attributeReport', cluster 'closuresWindowCovering', data '{"tuyaMotorReversal":4}' from endpoint 1 with groupID 0
This attribute was requested, but should read "calibrationMode"

I see the issue, I will check this later, or is this blocking this pr from being merged?

@FabianMangold
Copy link
Contributor Author

FabianMangold commented Oct 25, 2023

Please disregard my comment regarding the whitelabel and merging the devices.
Albeit being very similar, both devices are based on different firmware code bases (NLV vs NLLV), and seem to behave slightly differently.
Therefore, keeping them distinct is probably way better, if you agree on that.

No please merge, this is not blocking. The only feature that doesn't work (yet) is the reporting of the blind position when the switch is in "Venetian Mode". Other than that, everything is OK and unchanged. I will work on the missing reporting and converters once reporting works as expetected.

I may have a patch for ZH regarding the reporting issue, i simply need a but more time.... unless you can fix it faster :)
Thanks a lot.

@FabianMangold
Copy link
Contributor Author

FabianMangold commented Oct 26, 2023

Hi @Koenkk,
A potential fix for the erroneous attribute names on "AttributeReport" is available here:
Koenkk/zigbee-herdsman#787

@@ -313,7 +313,7 @@ describe('index.js', () => {


if (device.meta) {
containsOnly(['disableActionGroup', 'multiEndpoint', 'multiEndpointSkip', 'multiEndpointEnforce', 'applyRedFix', 'disableDefaultResponse', 'supportsEnhancedHue', 'timeout', 'supportsHueAndSaturation', 'battery', 'coverInverted', 'turnsOffAtBrightness1', 'coverStateFromTilt', 'pinCodeCount', 'tuyaThermostatSystemMode', 'tuyaThermostatPreset', 'tuyaDatapoints', 'tuyaThermostatPresetToSystemMode', 'thermostat', 'separateWhite', 'publishDuplicateTransaction', 'tuyaSendCommand'], Object.keys(device.meta));
containsOnly(['disableActionGroup', 'multiEndpoint', 'multiEndpointSkip', 'multiEndpointEnforce', 'applyRedFix', 'disableDefaultResponse', 'supportsEnhancedHue', 'timeout', 'supportsHueAndSaturation', 'battery', 'coverInverted', 'turnsOffAtBrightness1', 'coverStateFromTilt', 'pinCodeCount', 'tuyaThermostatSystemMode', 'tuyaThermostatPreset', 'tuyaDatapoints', 'tuyaThermostatPresetToSystemMode', 'thermostat', 'separateWhite', 'publishDuplicateTransaction', 'tuyaSendCommand', 'supportsLevelDetection'], Object.keys(device.meta));
Copy link
Owner

Choose a reason for hiding this comment

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

If I understand correctly, supportsLevelDetection is Legrand specific, I propose to name it legrandSupportsLevelDetection

.withDescription('Blinks the built-in LED to make it easier to identify the device'),
e.binary('led_in_dark', ea.ALL, 'ON', 'OFF')
.withDescription('Enables the built-in LED allowing to see the switch in the dark'),
_067776.getCalibrationModes(this.meta),
Copy link
Owner

Choose a reason for hiding this comment

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

Is the whole expose() function only needed to read from this.meta? If yes, I propose to drop the whole supportsLevelDetection and do something like this:

exposes: [_067776.getCover(), e.action(['moving', 'identify']), _067776.getCalibrationModes(true)]

Where true indicates it supportsLevelDetection

@FabianMangold
Copy link
Contributor Author

FabianMangold commented Oct 28, 2023

Hi @Koenkk,
Thanks for your feedback. I've modified the code accordingly and simplified it.
I cannot completely get rid of functions, as the supported calibration modes need to be determined in the FZ /TZ.
Is this approach better? The code is more legible indeed.
Cheers.

'Specific (NLLV)': {ID: 1, onlyNLLV: true},
'Up/Down/Stop': {ID: 2, onlyNLLV: false},
'Temporal': {ID: 3, onlyNLLV: false},
'Venetian (BSO)': {ID: 4, onlyNLLV: false},
Copy link
Owner

Choose a reason for hiding this comment

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

Last thing before this can be merged, could you make these snake_case? e.g. classic_nllv, venetian_bso

Copy link
Contributor Author

@FabianMangold FabianMangold Oct 29, 2023

Choose a reason for hiding this comment

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

Those strings are required in the frontend, but let me change the structure somewhat, it is not optimum indeed.
I suppose you wish to avoid having string literals (containing special characters) as keys, right ?

Copy link
Owner

Choose a reason for hiding this comment

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

I meant the values itself (the structure is fine). No special characters indeed, no spaces and only lower case, e.g. Venetian (BSO) should become venetion_bso, Up/Down/Stop -> up_down_stop.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh okay, sure. Let me change it then.
Just figured that it would look better as "text", like so:

grafik

Copy link
Contributor Author

@FabianMangold FabianMangold Oct 29, 2023

Choose a reason for hiding this comment

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

PR updated accordingly.

grafik

I understand that those strings are way better when stored in the state.
Just out of curiosity, is there any reason i didn't think of ?

Copy link
Owner

Choose a reason for hiding this comment

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

Not all people use the frontend, e.g. when you publish directly to MQTT, you don't want to deal with special chars.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fair point, thanks @Koenkk

Introduced a Legrand specific library
* Added array of supported calibration modes
* Added FZ/TZ to support calibration modes
* Added 067776(A) specific helper methods
Requires zigbee-herdsman PR#784
* Support calibration mode switching
* Support Venetian (BSO) mode
Added manufacturer code to reporting
Avoid the usage of string litterals as keys
Changed description to snake_case
@Koenkk Koenkk merged commit a7b5667 into Koenkk:master Oct 30, 2023
1 check passed
@Koenkk
Copy link
Owner

Koenkk commented Oct 30, 2023

Thanks!

@philippk75
Copy link

hello, I use the Bticino N4027C switches. Since last night's update from Zigbee2MQTT in HA, my Bticino N4027C switches have had the Legrand picture automatically replaced (which I don't like) and I'm suddenly finding all the settings with calibration etc. The calibration of the blinds also works, but also with the blinds I find the tilt angle, which makes little sense (how can I remove it), with the venetian I have not managed to perform the calibration or change the tilt angle?

Greetings

Philipp

@jd1900
Copy link
Contributor

jd1900 commented Nov 2, 2023

FabianMangold

Thank you FabianMangold, very well explained.
It would be great to add to here: https://www.zigbee2mqtt.io/devices/067776.html @Koenkk

@syntesys87
Copy link

syntesys87 commented Nov 2, 2023

hello, I use the Bticino N4027C switches. Since last night's update from Zigbee2MQTT in HA, my Bticino N4027C switches have had the Legrand picture automatically replaced (which I don't like) and I'm suddenly finding all the settings with calibration etc. The calibration of the blinds also works, but also with the blinds I find the tilt angle, which makes little sense (how can I remove it), with the venetian I have not managed to perform the calibration or change the tilt angle?

Greetings

Philipp

I have also the same problem, my K4027C is recognized as 067776A and calibration does not work well. I also tried to calibrate, but classic_nllv is not working, with specific it starts calibrating but fails, tried with temporal but fails... The firmware seems equal but I think there are some differences... The other problem I found is that after the association with Z2Mqtt, the LED does not change color from RED or power off...
I am available to do tests, if you want even on a short notice via Skype, Teams or similar; I'm Italian, but I speak/understand English. I am a programmer and a system administrator, I can provide content both as a tester and as a developer but I would also like to understand how everything works, so I can contribute.

@syntesys87
Copy link

This is a log extraction:
Info 2023-11-02 19:24:11MQTT publish: topic 'zigbee2mqtt/0x0004740000b79969', payload '{"action":null,"calibration_mode":"specific_nllv","led_in_dark":null,"linkquality":128,"position":100,"state":"CLOSE","tilt":0,"update":{"installed_version":3556351,"latest_version":3556351,"state":"idle"},"update_available":null}'
Info 2023-11-02 19:24:12MQTT publish: topic 'zigbee2mqtt/0x0004740000b79969', payload '{"action":null,"calibration_mode":"specific_nllv","led_in_dark":null,"linkquality":116,"position":50,"state":"OPEN","tilt":0,"update":{"installed_version":3556351,"latest_version":3556351,"state":"idle"},"update_available":null}'
Info 2023-11-02 19:24:20MQTT publish: topic 'zigbee2mqtt/0x0004740000b79969', payload '{"action":null,"calibration_mode":"specific_nllv","led_in_dark":null,"linkquality":124,"position":0,"state":"OPEN","tilt":0,"update":{"installed_version":3556351,"latest_version":3556351,"state":"idle"},"update_available":null}'
Info 2023-11-02 19:24:49MQTT publish: topic 'zigbee2mqtt/0x0004740000b79969', payload '{"action":null,"calibration_mode":"specific_nllv","led_in_dark":null,"linkquality":120,"position":0,"state":"OPEN","tilt":0,"update":{"installed_version":3556351,"latest_version":3556351,"state":"idle"},"update_available":null}'
Info 2023-11-02 19:25:16MQTT publish: topic 'zigbee2mqtt/0x0004740000b79969', payload '{"action":null,"calibration_mode":"specific_nllv","led_in_dark":null,"linkquality":128,"position":100,"state":"CLOSE","tilt":0,"update":{"installed_version":3556351,"latest_version":3556351,"state":"idle"},"update_available":null}'
Info 2023-11-02 19:25:45MQTT publish: topic 'zigbee2mqtt/0x0004740000b79969', payload '{"action":null,"calibration_mode":"specific_nllv","led_in_dark":null,"linkquality":108,"position":0,"state":"OPEN","tilt":0,"update":{"installed_version":3556351,"latest_version":3556351,"state":"idle"},"update_available":null}'
Info 2023-11-02 19:27:15MQTT publish: topic 'zigbee2mqtt/0x0004740000b79969', payload '{"action":null,"calibration_mode":"specific_nllv","led_in_dark":null,"linkquality":116,"position":9,"state":"OPEN","tilt":0,"update":{"installed_version":3556351,"latest_version":3556351,"state":"idle"},"update_available":null}'
Info 2023-11-02 19:27:41MQTT publish: topic 'zigbee2mqtt/0x0004740000b79969', payload '{"action":null,"calibration_mode":"specific_nllv","led_in_dark":null,"linkquality":104,"position":100,"state":"CLOSE","tilt":0,"update":{"installed_version":3556351,"latest_version":3556351,"state":"idle"},"update_available":null}'
Info 2023-11-02 19:28:34MQTT publish: topic 'zigbee2mqtt/0x0004740000b79969', payload '{"action":null,"calibration_mode":"specific_nllv","led_in_dark":null,"linkquality":104,"position":61,"state":"CLOSE","tilt":0,"update":{"installed_version":3556351,"latest_version":3556351,"state":"idle"},"update_available":null}'

With K4027C classic_nllv not working, with specific it calibrates but I think some parameter is not he same as 067776...

@FabianMangold
Copy link
Contributor Author

FabianMangold commented Nov 2, 2023

Hi @philippk75,

This is very unfortunate indeed. The 067776A were integrated in the Legrand device library using the following fingerprint:

fingerprint: [
            {modelID: ' Shutter SW with level control\u0000', manufacturerID: 4129},
],

Those attributes get reported by my actual Legrand 067776A devices. Given the fact the BTicino devices use the very same Legrand NLLV firmware (or it might be the otherway arround actually), i suppose that your BTicino devices report the same attributes.
Could you please send all attributes of your switche's GenBasic cluster, so that we can compare it between the BTicino and Legrand switches ?
Thanks

@FabianMangold
Copy link
Contributor Author

FabianMangold commented Nov 2, 2023

@philippk75 and @syntesys87,
While the BTicino and K4027C seems to share the same firmware, I have no information about the hardware.
Before being able to switch calibration modes, your switches are likely have worked in "Up_Down_Stop" mode right ?
Can you remember what was first reported by Z2M right after the update ?
Are the switches operating as "before" when switching back to the original mode ?

@philippk75: You are absolutely right regarding the tilt. This is only relevant when the switch is operating in venetian mode. Let's check if this option can be made conditional.

And last but not least, the changes were tested on Legrand 067776 and 067776A. I cannot vouch for the BTicino devices, as i have none available for testing. In case those changes really don't work, we should fingerprint the devices and ensure the BTicino devices get detected and treated as such.

@philippk75
Copy link

Hi @philippk75,

This is very unforunate indeed. The 067776A were integrated in the Legrand device library using the following fingerprint:

fingerprint: [
            {modelID: ' Shutter SW with level control\u0000', manufacturerID: 4129},
],

Those attributes get reported by my actual Legrand 067776A devices. Given the fact the BTicino devices use the very same Legrand NLLV firmware (or it might be the otherway arround actually), i suppose that your BTicino devices report the same attributes. Could you please send all attributes of your switche's GenBasic cluster, so that we can compare it between the BTicino and Legrand switches ? Thanks

hello, could you explan how send the attributes?

@syntesys87
Copy link

@philippk75 and @syntesys87, While the BTicino and K4027C seems to share the same firmware, I have no information about the hardware. Before being able to switch calibration modes, your switches are likely have worked in "Up_Down_Stop" mode right ? Can you remember what was first reported by Z2M right after the update ? Are the switches operating as "before" when switching back to the original mode ?

@philippk75: You are absolutely right regarding the tilt. This is only relevant when the switch is operating in venetian mode. Let's check if this option can be made conditional.

The problem is that in every mode I set, the switch works as up/down/close. With classic_nllv the calibration does not start, also not in temporal mode. The switch operates as before. I think I have logs before and after the update, if you need.

@FabianMangold
Copy link
Contributor Author

hello, could you explan how send the attributes?

The easiest way is to use the Z2M frontend. Click on the device, open the "Dev Console" tabsheet, select the GenBasic Cluster, then select the attributes (please limit it to 4 items per iteration) and click Read.
The device will then send the attributes back, You may have to do this several times, as select too many attributes simultaneously may not fit in one single ZigBee message. Also, certain attributes may not be available, so don't worry about those.

@philippk75
Copy link

@philippk75 and @syntesys87, While the BTicino and K4027C seems to share the same firmware, I have no information about the hardware. Before being able to switch calibration modes, your switches are likely have worked in "Up_Down_Stop" mode right ? Can you remember what was first reported by Z2M right after the update ? Are the switches operating as "before" when switching back to the original mode ?
@philippk75: You are absolutely right regarding the tilt. This is only relevant when the switch is operating in venetian mode. Let's check if this option can be made conditional.

The problem is that in every mode I set, the switch works as up/down/close. With classic_nllv the calibration does not start, also not in temporal mode. The switch operates as before. I think I have logs before and after the update, if you need.

hello, i confirm, my Bticino N4027C ist able to control the tile inclination :-)

@FabianMangold
Copy link
Contributor Author

@syntesys87: It could very well be, that the BTicino switches simply do not support those modes. Only Legrand / BTicino could tell really. Is there any way your could check if the official "App" supports those modes with those devices?
In a first step, it might be easier just to avoid using those modes on BItico devices, and we should open a new thread to check if those modes can be supported on those devices.
Again, the changes were only meant to be for Legrand devices, not the BTicino ones.

@FabianMangold
Copy link
Contributor Author

Oh interesting @philippk75 (CC: @syntesys87). So it does work on BTicino devices too.
Are you in Venetian Mode now ? How did you calibrate it ? Is the procedure i meantioned above Okay or did you change anything ?

@philippk75
Copy link

The easiest way is to use the Z2M frontend. Click on the device, open the "Dev Console" tabsheet, select the GenBasic Cluster, then select the attributes (please limit it to 4 items per iteration) and click Read.
The device will then send the attributes back, You may have to do this several times, as select too many attributes simultaneously may not fit in one single ZigBee message. Also, certain attributes may not be available, so don't worry about those.

hello, this ist the log, is this enough? für he other attibutes i get an erroer while reading?

2023-11-02 20:54:42Read result of 'genBasic': {"zclVersion":2,"appVersion":0,"stackVersion":67,"hwVersion":13}
2023-11-02 20:57:25Read result of 'genBasic': {"manufacturerName":" Legrand\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000","modelId":" Shutter SW with level control\u0000"}
2023-11-02 20:57:56Read result of 'genBasic': {"dateCode":" \u000020230406\u0000\u0000\u0000\u0000\u0000","powerSource":1}
2023-11-02 20:58:15Read result of 'genBasic': {"dateCode":" \u000020230406\u0000\u0000\u0000\u0000\u0000","powerSource":1,"appProfileVersion":0,"swBuildId":"0036"}

@philippk75
Copy link

@syntesys87: It could very well be, that the BTicino switches simply do not support those modes. Only Legrand / BTicino could tell really. Is there any way your could check if the official "App" supports those modes with those devices? In a first step, it might be easier just to avoid using those modes on BItico devices, and we should open a new thread to check if those modes can be supported on those devices. Again, the changes were only meant to be for Legrand devices, not the BTicino ones.

i understand, we were involuntarily added after the update and suddenly we no longer have bticino buttons but legrand :-) can this be reversed?

@syntesys87
Copy link

The N4027C and K4027C seems to have the same firmware, for Zigbee2MQTT documentation. These are the screenshots of my configuration from Home+Control app of one switch and it's equal to all the others:
Photos-001.zip

I can provide also the logs from Netatmo integration.

@philippk75
Copy link

philippk75 commented Nov 2, 2023

Oh interesting @philippk75 (CC: @syntesys87). So it does work on BTicino devices too.
Are you in Venetian Mode now ? How did you calibrate it ? Is the procedure i meantioned above Okay or did you change anything ?

at the moment i can only change the inclination of the tile physically on the switch by holding longer the up or down buttom... i cannont selct a venetian mode in the driver of the device, ist there an option in the legrand driver?

i didn't understand how to make the calibaration of the device, the procedure was too complex for me ;-) i only applyid the venetian calibration, but they change anything, the tilt option seems not to work

@FabianMangold
Copy link
Contributor Author

FabianMangold commented Nov 2, 2023

Ja, deshalb frage ich nach den Details!
Thanks for the attribute report. Your device reports the same attributes than my Legrand ones, with the exception of the HW version.
Your BTicino ones report HW version 13,
My Legrand 067776 HW version 8
and the 078887A HW version 1

Those attributes can be used to differentiate the devices in Z2M.
Now we need to device if we need to revert back, or leave it as is.
I am confused, because you say that the device is able to control the tilt angle, which seems to be confirmed by @syntesys87 screenshots.

Should Bticino devices get the feature set as well, or should we "try" to revert back to the former behaviour ?
Just looping @Koenkk in here :)

@FabianMangold
Copy link
Contributor Author

@philippk75: The calibration procedure is necessary, otherwise the "switch" cannot apply the tilt angle.
Could you please attempt to calibrate one of your blinds ? Just did it on one of mine, and i confirm that the procedure works for me.

@philippk75
Copy link

@philippk75: The calibration procedure is necessary, otherwise the "switch" cannot apply the tilt angle. Could you please attempt to calibrate one of your blinds ? Just did it on one of mine, and i confirm that the procedure works for me.

I would like the bticino to be able to control the inclination of the slats. it would be nice to see the old picture back and the old name of the device :-) maybee you could me explan in german how to calibrate and how to set the ebenetian mode?

@philippk75
Copy link

@philippk75: The calibration procedure is necessary, otherwise the "switch" cannot apply the tilt angle.
Could you please attempt to calibrate one of your blinds ? Just did it on one of mine, and i confirm that the procedure works for me.

maybee in german it's easier to understand? i have venetians and traditional roller shutter, it would be fine that the tile option would be visible only für venetians

@philippk75
Copy link

  • Temporal:
    Once the blind is in the up position, start the calibration by pressing and holding the down button, until the blind reaches to bottom stop. Once there, the relay should click. Then shortly press down down button again and subsequently press and hold the up button until the blind gets to the upper stop.
    Repeat the cycle: Press and hold down until the blind reaches the bottom stop, then press and hold until it reaches the top position (Note that there is no need to shortly press the down button in the second sweep cycle)
  • Venetian / BSO
    Similar to the temporal calibration method, with the exception of the second sweep cycle!
    In essence, do the first sweep as mentioned in the "Temporal" section, and once done, press and hold the down button until the venetian blind reaches the botton position. Then press and hold the UP switch: this switch will then calibrate the blind tilt angle by activating the switch briefly 4 times in a sequence.

i tried your procedure for the venetian mode, but it doesn't work, maybee because i have an automatic calibration mode? for the calibration i only hd to push simultanly the up an down buttom, than the led lights yellow and the shutter movs up an down an then the led turn to blue.

@FabianMangold
Copy link
Contributor Author

FabianMangold commented Nov 2, 2023

Well, the procedure may differ. The problem is that those are not officially documented.
The description above reflects the procedures that worked for me on Legrand devices,. Those were mostly determine by "trial and error".
Pressing Up and Down indeed puts the device in calibration mode, but this was not required for me. Changing the calibration mode with Z2M automatically put the device in that mode, and thus, the calibration could be started straightaway.
Can you please try the temporal one ? This procedure is the one i got from the Legrand App, and has proven to be reliable. I just want to check if this works on BTicino devices as well. Once calibrated, you won't be able to set the tilt, but to request a position..
If this works reliably, we can take it from there, and tacke the Venetian mode in a second step.

Regarding the remaining open items, I have to check with @Koenkk as Z2m doesn't support this (AFAIK) out of the box:

  • Device identification: All attributes seem to be identical, only the HW version is different. Unforunately, this attribute cannot (yet) be used for fingerprinting a device
  • Conditional Tilt: Would it be possible to dynamically re-evaluate the "exposes" array upon change of an attribute (i.e. the calibration_mode in this speific case ?)

@syntesys87
Copy link

syntesys87 commented Nov 3, 2023

@FabianMangold how did you approach the debug of NLLV firmware and the tries you did for make this working? I would debug how it works in the app and replicate it in Zigbee2MQTT.

I see from logs of Netatmo plugin in Home Assistant this: 2023-11-03 11:47:33.293 DEBUG (MainThread) [pyatmo.home] Setting state for home (62134d6bd95995623b03a8ba) according to {'modules': [{'id': '---', 'target_position': 49, 'bridge': ---'}]} (I removed MAC addresses from component and bridge).

@FabianMangold
Copy link
Contributor Author

FabianMangold commented Nov 3, 2023

Hi @syntesys87;
I am sorry, but is a bit of our the scope here, and I think this should be moved over to another thread.
This this is the wrong place for such discussions, as this thread is meant to address topics arround this PR.
Unless there is no major issues, new discussions threads should be started elsewhere.
Thanks for your understanding. This simplifies tracking for everyone.

We still need to tackle the two points above however:

  • Device identification: I will submit a PR to address that.
    Cross referencing issue Z2M issue #19108, as it seems that there is devices exposing even different HW versions out there.
  • Conditional "exposes": This is more a nice to have, and not directly linked to this PR, it's just inherent to the way Z2m works, and a bit of a corner case, as the device supports so many different features.

@philippk75
Copy link

Well, the procedure may differ. The problem is that those are not officially documented. The description above reflects the procedures that worked for me on Legrand devices,. Those were mostly determine by "trial and error". Pressing Up and Down indeed puts the device in calibration mode, but this was not required for me. Changing the calibration mode with Z2M automatically put the device in that mode, and thus, the calibration could be started straightaway. Can you please try the temporal one ? This procedure is the one i got from the Legrand App, and has proven to be reliable. I just want to check if this works on BTicino devices as well. Once calibrated, you won't be able to set the tilt, but to request a position.. If this works reliably, we can take it from there, and tacke the Venetian mode in a second step.

Regarding the remaining open items, I have to check with @Koenkk as Z2m doesn't support this (AFAIK) out of the box:

  • Device identification: All attributes seem to be identical, only the HW version is different. Unforunately, this attribute cannot (yet) be used for fingerprinting a device
  • Conditional Tilt: Would it be possible to dynamically re-evaluate the "exposes" array upon change of an attribute (i.e. the calibration_mode in this speific case ?)

hello, temporal seems to work, at least the rollo corrket reacts accordingly... with classical.nllv and specific.nllv the calibration process also starts automatically and does everything by itself.

what are your next activities?

@FabianMangold
Copy link
Contributor Author

FabianMangold commented Nov 3, 2023

Hi @philippk75 ,
So are you confirming that "everything" works with your BTicino devices ?
If so, could you please comment this issue here ?
Could you please tell us how you managed to calibrate the switches in temporal mode ? @syntesys87's devices don't (yet) seem to cooperate!

The next step is to identify the devices properly, so that the names match again. Would you mind opening another issue for that, so that we can work on it ?
I am still puzzled, as different users report different results. Therefore we need to wait for some more feedback.

Thanks

@philippk75
Copy link

hello,

i said that the specific calibration mode works and i can stwich to positions, not only 0%, 50% or 100%. I can not check if the temporal mode works, after that the rollo shutters worked.

i found this document that explains the calibration for venetian in italian, the procedure sesms different: https://professionisti.bticino.it/sites/default/files/2022-08/2022_Novit%C3%A0%20impianto%20Smart_gestione%20tapparelle%20frangisole.pdf

@philippk75
Copy link

hello,

i said that the specific calibration mode works and i can stwich to positions, not only 0%, 50% or 100%. I can not check if the temporal mode works, after that the rollo shutters worked.

i found this document that explains the calibration for venetian in italian, the procedure sesms different: https://professionisti.bticino.it/sites/default/files/2022-08/2022_Novit%C3%A0%20impianto%20Smart_gestione%20tapparelle%20frangisole.pdf

hello, thanks, this means that we have to wait the next zibee2mqtt update? or can we start somethings manuel?

@Crystian182
Copy link

  • Temporal:
    Once the blind is in the up position, start the calibration by pressing and holding the down button, until the blind reaches to bottom stop. Once there, release the button, and shortly press the down button. The relay should then click. Subsequently press and hold the up button until the blind gets to the upper stop.
    Repeat the cycle: Press and hold down until the blind reaches the bottom stop, then press and hold until it reaches the top position (Note that there is no need to shortly press the down button in the second sweep cycle)

hi @FabianMangold,
I calibrated my shutter with specific_nllv mode, by pressing up and down buttons for 7 seconds.
The calibration worked fine but i don’t trust the percentages i set via homeassistant, since they are different from what i visually perceive.
I would like to manually define my own percentages, so i was looking at the temporal mode, which should fit my case allowing me to define where’s the point at 0% and where’s 100%. Isn’t it?
If yes, should i send the temporal calibration command via homeassistant before starting the procedure you described? Or it is not neeeded and i could just start the procedure when the blind is at my target up position?

@jbouv55151
Copy link

hello,
i said that the specific calibration mode works and i can stwich to positions, not only 0%, 50% or 100%. I can not check if the temporal mode works, after that the rollo shutters worked.
i found this document that explains the calibration for venetian in italian, the procedure sesms different: https://professionisti.bticino.it/sites/default/files/2022-08/2022_Novit%C3%A0%20impianto%20Smart_gestione%20tapparelle%20frangisole.pdf

hello, thanks, this means that we have to wait the next zibee2mqtt update? or can we start somethings manuel?

Hi,
Did you managed to use the tilt option with Venetian mode ?

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.

7 participants