Skip to content

Conversation

@sbraz
Copy link
Contributor

@sbraz sbraz commented Nov 9, 2025

Hello,
This is a work-in-progress attempt to finish the cluster move, based on work from #8728 and the discussion in Koenkk/zigbee-herdsman#1310.

See also Koenkk/zigbee-herdsman#1547.

I haven't looked at the CI errors yet because the main problem is that the custom cluster doesn't work for some code paths:

[2025-11-09 20:13:58] warning:  zhc:lixee: Failed to read zigbee attributes during startup: Error: Cluster with name 'liXeeCustom' does not exist

And

[2025-11-09 20:14:08] warning:  zhc:lixee: Was not able to detect the Linky linky_mode. Default to historique

@Koenkk, @Nerivec, could you please help me make this work? I assume the cluster definition should occur "earlier" or that the code doesn't properly use the newly-defined cluster?

event.data.device
.getEndpoint(1)
.read("liXeePrivate", ["linkyMode", "currentTarif"], {manufacturerCode: null})
.read("liXeeCustom", ["linkyMode", "currentTarif"], {manufacturerCode: null})
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is where I see one of the failures:

[2025-11-09 20:13:58] warning:  zhc:lixee: Failed to read zigbee attributes during startup: Error: Cluster with name 'liXeeCustom' does not exist

Copy link
Collaborator

@Nerivec Nerivec Nov 9, 2025

Choose a reason for hiding this comment

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

Try keeping the name of the cluster same as before. It can create weird states with existing networks when "just" renaming a cluster. (same thing for below comment)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can try but I assume I need to patch cluster.js, otherwise, how do I know that https://github.com/svenjochems/zigbee-herdsman/blob/8fee7b14de74c3e2d62dd3d7a15c73e161ff742d/src/zspec/zcl/definition/cluster.ts#L4518 won't be used instead of my custom cluster?

In #8728 (comment), the recommendation was to rename the cluster, that's why I did it.

Copy link
Collaborator

@Nerivec Nerivec Nov 9, 2025

Choose a reason for hiding this comment

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

You can override herdsman locally for ZHC. You clone the repo, install deps, remove the cluster from cluster.ts, build the project. And then in ZHC folder, you do pnpm link ../zigbee-herdsman (to proper location). Make sure it shows it linked the location (else repeat the command, sometimes the first try doesn't work with pnpm). And then build ZHC again.

We found out some issues in a PR a short while back when renaming a custom cluster due to how it is saved/cached in the database (no longer points to the right place). It broke a lot of installations. Easiest is just to not rename it.

Copy link
Contributor Author

@sbraz sbraz Nov 9, 2025

Choose a reason for hiding this comment

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

Thanks for the hints. I was still working with external converter but it was getting too much hassle so I spawned a completely separate Z2M instance, with the current branch and with Koenkk/zigbee-herdsman#1547.

While restoring the old name fixed the not able to detect the Linky linky_mode error, this one still remains:

[2025-11-10 00:11:27] warning:  zhc:lixee: Failed to read zigbee attributes during startup: Error: Cluster with name 'liXeePrivate' does not exist

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 following changes fixes it, do we want to do this?

diff --git a/src/devices/lixee.ts b/src/devices/lixee.ts
index 989b84d18..2c29dd553 100644
--- a/src/devices/lixee.ts
+++ b/src/devices/lixee.ts
@@ -1999,7 +1999,7 @@ export const definitions: DefinitionWithExtend[] = [
             if (event.type === "start") {
                 event.data.device
                     .getEndpoint(1)
-                    .read("liXeePrivate", ["linkyMode", "currentTarif"], {manufacturerCode: null})
+                    .read(0xFF66, ["linkyMode", "currentTarif"], {manufacturerCode: null})
                     .catch((e) => {
                         // https://github.com/Koenkk/zigbee2mqtt/issues/11674
                         logger.warning(`Failed to read Zigbee attributes during startup: ${e}`, NS);

Copy link
Owner

Choose a reason for hiding this comment

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

No we don't, should use liXeePrivate here. If that doesn't work, before this line do console.log(event.data.device._customClusters) and see if the cluster is in there.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Koenkk, event.data.device._customClusters is an empty object: {}.

Copy link
Owner

Choose a reason for hiding this comment

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

Then for some reason the m.deviceAddCustomCluster is not being executed, can you compare if its done the same way as for other devices?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

They seem quite similar:

m.deviceAddCustomCluster("RadarSensorHeiman", {

extend: [local.modernExtend.addCustomClusterManuSpecificNikoConfig()],

extend: [m.onOff({powerOnBehavior: false}), ...shellyModernExtend.shellyCustomClusters(), shellyModernExtend.shellyWiFiSetup()],

I tried to make the code look as close as possible to other cluster move PRs which I checked.

How can I make it easier for you to debug this problem?

// biome-ignore lint/suspicious/noImplicitAnyLet: ignored using `--suppress`
let lMode;
try {
lMode = endpoint.clusters[clustersDef._0xFF66].attributes.linkyMode;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

And this is the other read failure:

[2025-11-09 20:14:08] warning:  zhc:lixee: Was not able to detect the Linky linky_mode. Default to historique

@sbraz sbraz force-pushed the zlinky_move_cluster branch from 5e85bd9 to 34f1b61 Compare November 9, 2025 19:27
/* 0x0227 */ "daysProfileCurrentCalendar",
/* 0x0228 */ "daysProfileNextCalendar",
] as const;
const kWhP = options?.kWh_precision ? options.kWh_precision : 0;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unrelated question: why is the default to round to the kWh? Other devices I have seem to default to 2 decimals. Could we change the default?

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.

3 participants